From 75b88175cb01e68cd32ca45d4921fc69dd4202f1 Mon Sep 17 00:00:00 2001 From: Flamenco Date: Tue, 25 Jan 2022 12:49:23 -0500 Subject: [PATCH] Check for outboundStreamOpts before accessing it This method should be the same as the others in regards to checking for valid property. It seems the extra logic for `isElectron` evaded the correct checking when calling from an incoming stream. Error reported: TypeError: Cannot read properties of undefined (reading 'publisherProperties') ``` --- openvidu-browser/src/OpenVidu/Stream.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openvidu-browser/src/OpenVidu/Stream.ts b/openvidu-browser/src/OpenVidu/Stream.ts index fbf51165..288c47f2 100644 --- a/openvidu-browser/src/OpenVidu/Stream.ts +++ b/openvidu-browser/src/OpenVidu/Stream.ts @@ -548,12 +548,15 @@ export class Stream { * @hidden */ isSendScreen(): boolean { + if (!this.outboundStreamOpts) { + return false; + } let screen = this.outboundStreamOpts.publisherProperties.videoSource === 'screen'; if (platform.isElectron()) { screen = typeof this.outboundStreamOpts.publisherProperties.videoSource === 'string' && this.outboundStreamOpts.publisherProperties.videoSource.startsWith('screen:'); } - return !!this.outboundStreamOpts && screen; + return screen; } /**