diff --git a/src/node/ringrtc/VideoSupport.ts b/src/node/ringrtc/VideoSupport.ts index 2ee1935c..d6ae6bc9 100644 --- a/src/node/ringrtc/VideoSupport.ts +++ b/src/node/ringrtc/VideoSupport.ts @@ -85,6 +85,7 @@ export class GumVideoCaptureOptions { maxFramerate = 30; preferredDeviceId?: string; screenShareSourceId?: string; + mediaStream?: MediaStream; } interface GumConstraints extends MediaStreamConstraints { @@ -192,7 +193,14 @@ export class GumVideoCapturer { return cameras; } - private getUserMedia(options: GumVideoCaptureOptions): Promise { + private async getUserMedia( + options: GumVideoCaptureOptions + ): Promise { + // Return provided media stream + if (options.mediaStream) { + return options.mediaStream; + } + const constraints: GumConstraints = { audio: false, video: {