June 2024
Beginner to intermediate
268 pages
6h 26m
English
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 ...
Read now
Unlock full access