MCPcopy
hub / github.com/webrtc/samples / getMedia

Function getMedia

src/content/getusermedia/resolution/js/main.js:229–244  ·  view source on GitHub ↗
(constraints)

Source from the content-addressed store, hash-verified

227};
228
229function getMedia(constraints) {
230 if (stream) {
231 stream.getTracks().forEach(track => {
232 track.stop();
233 });
234 }
235
236 clearErrorMessage();
237 videoblock.style.display = 'none';
238 if (videoSelect.value !== '') {
239 constraints.video.deviceId = {exact: videoSelect.value};
240 }
241 console.log('getUserMedia constraints: ' + JSON.stringify(constraints));
242 navigator.mediaDevices.getUserMedia(constraints)
243 .then(gotStream, handleError);
244}

Callers 1

main.jsFile · 0.70

Calls 3

clearErrorMessageFunction · 0.85
getTracksMethod · 0.80
getUserMediaMethod · 0.80

Tested by

no test coverage detected