MCPcopy
hub / github.com/CapSoftware/Cap / getMainStream

Function getMainStream

apps/chrome-extension/src/offscreen/recorder.ts:466–485  ·  view source on GitHub ↗
(request: StartRecordingRequest)

Source from the content-addressed store, hash-verified

464};
465
466const getMainStream = async (request: StartRecordingRequest) => {
467 if (request.mode === "tab") {
468 if (!request.tabStreamId) throw new Error("Tab stream id is missing");
469 return navigator.mediaDevices.getUserMedia(
470 tabCaptureConstraints(
471 request.tabStreamId,
472 request.settings.systemAudio.enabled,
473 ),
474 );
475 }
476
477 if (request.mode === "camera") {
478 return getCameraMediaStream(
479 request.settings.webcam,
480 getAudioConstraint(request.settings.microphone),
481 );
482 }
483
484 return getDisplayStream(request.mode, request.settings.systemAudio.enabled);
485};
486
487const getAudioConstraint = (
488 microphone: MicrophoneSettings,

Callers 1

startRecordingFunction · 0.85

Calls 4

tabCaptureConstraintsFunction · 0.85
getCameraMediaStreamFunction · 0.85
getAudioConstraintFunction · 0.85
getDisplayStreamFunction · 0.85

Tested by

no test coverage detected