From a1d00e2d08efcb54899f403dee696a666b871e1d Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:41:11 -0700 Subject: [PATCH] Desktop: Allow VideoSupport to accept a MediaStream --- src/node/ringrtc/VideoSupport.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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: {