From 96af7d32251c289f83f6671997333697ae1a56b2 Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Mon, 23 Oct 2023 12:09:17 +0200 Subject: [PATCH] openvidu-angular: Avoid possible errors applying custom frame rate --- .../lib/services/openvidu/openvidu.service.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/openvidu/openvidu.service.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/openvidu/openvidu.service.ts index 2d6d549807..199ce6080f 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/openvidu/openvidu.service.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/openvidu/openvidu.service.ts @@ -245,8 +245,22 @@ export class OpenViduService { this.disconnectSession(this.screenSession); } + /** + * + * Apply the new resolution to the video stream if it is CAMERA type. + * @param streamManager + * @internal + */ async updateVideoEncodingParameters(streamManager: StreamManager) { - if (!streamManager) return; + if ( + !streamManager || + !streamManager.stream || + !streamManager.stream.getMediaStream() || + streamManager.stream.typeOfVideo === VideoType.SCREEN + ) { + return; + } + const track = streamManager?.stream.getMediaStream().getVideoTracks()[0]; const videoSender = streamManager?.stream .getRTCPeerConnection()