Displaying Remote Audio/Video
Implement the logic to receive and display remote audio and video streams from connected peers in your application.
See and Hear Others
WebRTC enables direct communication, but how do we actually see and hear what a remote peer is sending?
- We'll learn how to capture incoming audio/video data.
- Then, how to display this data in your web application using standard HTML elements.
- This is crucial for building video calls, live streaming, and more!
The 'ontrack' Event
When a remote peer sends a media stream, your RTCPeerConnection needs to know about it. This is handled by the ontrack event.
- The
ontrackevent is triggered on yourRTCPeerConnectionobject. - It fires when a new
MediaStreamTrack(like an audio or video track) is received from the remote peer. - This event is your gateway to accessing the remote media.
All lessons in this course
- Accessing User Media Devices
- Adding and Removing Media Tracks
- Displaying Remote Audio/Video
- Controlling Media Quality and Constraints