MCPcopy Index your code
hub / github.com/CapSoftware/Cap / getCameraMediaStream

Function getCameraMediaStream

apps/chrome-extension/src/offscreen/recorder.ts:370–389  ·  view source on GitHub ↗
(
	webcam: WebcamSettings,
	audio: boolean | MediaTrackConstraints,
)

Source from the content-addressed store, hash-verified

368 (error.name === "NotFoundError" || error.name === "OverconstrainedError");
369
370const getCameraMediaStream = async (
371 webcam: WebcamSettings,
372 audio: boolean | MediaTrackConstraints,
373) => {
374 try {
375 return await navigator.mediaDevices.getUserMedia({
376 video: getVideoConstraint(webcam),
377 audio,
378 });
379 } catch (error) {
380 if (!shouldRetryDefaultCamera(webcam, error)) {
381 throw error;
382 }
383
384 return navigator.mediaDevices.getUserMedia({
385 video: true,
386 audio,
387 });
388 }
389};
390
391const tabCaptureConstraints = (streamId: string, includeAudio: boolean) =>
392 ({

Callers 2

getCameraPreviewStreamFunction · 0.85
getMainStreamFunction · 0.85

Calls 2

getVideoConstraintFunction · 0.85
shouldRetryDefaultCameraFunction · 0.85

Tested by

no test coverage detected