June 2024
Beginner to intermediate
268 pages
6h 26m
English
Recall that we set up logic to attach media tracks to the call in Sending Media Tracks. On the receiving side, we need logic that’s going to listen for the remote peer’s media coming in over the WebRTC connection and then set the peer <video>’s srcObject to the incoming stream. To do this, find the skeletal handleRtcPeerTrack() callback function you defined earlier and put some flesh on its bones:
| | function handleRtcPeerTrack({ track, streams: [stream] }) { |
| | console.log('Attempt to display media from peer...'); |
| | displayStream(stream, '#peer'); |
| | } |
Once more we see destructuring assignment at work: this time, it pulls out the returned track and stream from the event object returned by ...
Read now
Unlock full access