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".
pull/690/head
Juan Navarro 2022-01-28 13:56:46 +01:00
parent 4fe0a4fda2
commit 786f1009fb
1 changed files with 3 additions and 3 deletions

View File

@ -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) {