From 786f1009fb03aca778dc022686ef2e69503f6075 Mon Sep 17 00:00:00 2001 From: Juan Navarro Date: Fri, 28 Jan 2022 13:56:46 +0100 Subject: [PATCH] openvidu-browser: Stream.typeOfVideo backwards compatibility fix Stream.typeOfVideo was a string and cannot be changed into an Enum without breaking some client applications. However, it is possible for us to start using an Enum internally, and exporting this property as a union of strings, which is what is generated by "keyof typeof Enum". --- openvidu-browser/src/OpenVidu/Stream.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openvidu-browser/src/OpenVidu/Stream.ts b/openvidu-browser/src/OpenVidu/Stream.ts index 6a9e5166..3cb50b9b 100644 --- a/openvidu-browser/src/OpenVidu/Stream.ts +++ b/openvidu-browser/src/OpenVidu/Stream.ts @@ -118,7 +118,7 @@ export class Stream { * * If [[hasVideo]] is false, this property is undefined */ - typeOfVideo?: TypeOfVideo; + typeOfVideo?: keyof typeof TypeOfVideo; /** * StreamManager object ([[Publisher]] or [[Subscriber]]) in charge of displaying this stream in the DOM @@ -930,7 +930,7 @@ export class Stream { iceServers: this.getIceServersConf(), mediaStream: this.mediaStream, mediaServer: this.session.openvidu.mediaServer, - typeOfVideo: this.typeOfVideo + typeOfVideo: this.typeOfVideo ? TypeOfVideo[this.typeOfVideo] : undefined, }; if (this.session.openvidu.mediaServer !== 'mediasoup') { @@ -1095,7 +1095,7 @@ export class Stream { onIceConnectionStateException: (exceptionName: ExceptionEventName, message: string, data?: any) => { this.session.emitEvent('exception', [new ExceptionEvent(this.session, exceptionName, this, message, data)]) }, iceServers: this.getIceServersConf(), mediaServer: this.session.openvidu.mediaServer, - typeOfVideo: this.typeOfVideo + typeOfVideo: this.typeOfVideo ? TypeOfVideo[this.typeOfVideo] : undefined, }; if (reconnect) {