Refining the Initial Properties on Self and Peer
Let’s refresh our memories about the requestUserMedia() function you built back in Requesting User-Media Permissions. Recall that it looked like this:
| async function requestUserMedia(media_constraints) { |
| $self.mediaStream = new MediaStream(); |
| $self.media = await navigator.mediaDevices |
| .getUserMedia(media_constraints); |
| $self.mediaStream.addTrack($self.media.getTracks()[0]); |
| displayStream($self.mediaStream, '#self'); |
| } |
That function has the effect of requesting user permission to access the devices you include in $self.mediaConstraints. So far, that’s been a single video device. Once a user grants permission for your app to access the camera, the function goes on to use ...
Get Programming WebRTC now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.