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

Function init

src/content/getusermedia/record/js/main.js:179–189  ·  view source on GitHub ↗
(constraints, isGetDisplayMedia)

Source from the content-addressed store, hash-verified

177}
178
179async function init(constraints, isGetDisplayMedia) {
180 try {
181 const stream = isGetDisplayMedia ?
182 await navigator.mediaDevices.getDisplayMedia(constraints) :
183 await navigator.mediaDevices.getUserMedia(constraints);
184 handleSuccess(stream);
185 } catch (e) {
186 console.error('Source open error:', e);
187 errorMsgElement.innerHTML = `Source error: ${e.toString()}`;
188 }
189}
190
191async function onStart(isGetDisplayMedia) {
192 document.querySelector('button#start-gum').disabled = true;

Callers 1

onStartFunction · 0.70

Calls 3

getUserMediaMethod · 0.80
errorMethod · 0.80
handleSuccessFunction · 0.70

Tested by

no test coverage detected