diff --git a/openvidu-browser/src/OpenVidu/Session.ts b/openvidu-browser/src/OpenVidu/Session.ts index 6bc5a075..14906d24 100644 --- a/openvidu-browser/src/OpenVidu/Session.ts +++ b/openvidu-browser/src/OpenVidu/Session.ts @@ -71,6 +71,7 @@ const platform: PlatformUtils = PlatformUtils.getInstance(); * - signal ([[SignalEvent]]) * - recordingStarted ([[RecordingEvent]]) * - recordingStopped ([[RecordingEvent]]) + * - networkQualityLevelChanged ([[NetworkQualityLevelChangedEvent]]) * - reconnecting * - reconnected * @@ -935,9 +936,13 @@ export class Session extends EventDispatcher { if (msg.connectionId === this.connection.connectionId) { this.ee.emitEvent('networkQualityLevelChanged', [new NetworkQualityLevelChangedEvent(this, msg.qualityLevel, this.connection)]); } else { - this.getConnection(msg.connectionId, 'Connection not found for connectionId ' + msg.connectionId).then((connection: Connection) => { - this.ee.emitEvent('networkQualityLevelChanged', [new NetworkQualityLevelChangedEvent(this, msg.qualityLevel, connection)]); - }); + this.getConnection(msg.connectionId, 'Connection not found for connectionId ' + msg.connectionId) + .then((connection: Connection) => { + this.ee.emitEvent('networkQualityLevelChanged', [new NetworkQualityLevelChangedEvent(this, msg.qualityLevel, connection)]); + }) + .catch(openViduError => { + logger.error(openViduError); + }); } } @@ -1135,7 +1140,7 @@ export class Session extends EventDispatcher { } sendVideoData(streamManager: StreamManager, intervalSeconds: number = 1) { - if( + if ( platform.isChromeBrowser() || platform.isChromeMobileBrowser() || platform.isOperaBrowser() || platform.isOperaMobileBrowser() || platform.isElectron() || (platform.isSafariBrowser() && !platform.isIonicIos()) || platform.isAndroidBrowser() || platform.isSamsungBrowser() || platform.isIonicAndroid() || diff --git a/openvidu-browser/src/OpenViduInternal/Events/FilterEvent.ts b/openvidu-browser/src/OpenViduInternal/Events/FilterEvent.ts index bdb0fa58..ab327f17 100644 --- a/openvidu-browser/src/OpenViduInternal/Events/FilterEvent.ts +++ b/openvidu-browser/src/OpenViduInternal/Events/FilterEvent.ts @@ -16,7 +16,6 @@ */ import { Event } from './Event'; -import { Stream } from '../../OpenVidu/Stream'; import { Filter } from '../../OpenVidu/Filter'; diff --git a/openvidu-browser/src/OpenViduInternal/Events/NetworkQualityLevelChangedEvent.ts b/openvidu-browser/src/OpenViduInternal/Events/NetworkQualityLevelChangedEvent.ts index 0eb423b2..a9eba26b 100644 --- a/openvidu-browser/src/OpenViduInternal/Events/NetworkQualityLevelChangedEvent.ts +++ b/openvidu-browser/src/OpenViduInternal/Events/NetworkQualityLevelChangedEvent.ts @@ -20,22 +20,25 @@ import { Session } from '../../OpenVidu/Session'; import { Connection } from '../../OpenVidu/Connection'; /** - * Defines event `networkQualityLevelChangedEvent` dispatched by [[Session]]. - * This event is fired when the network quality of the local connection changes + * Defines event `networkQualityLevelChanged` dispatched by [[Session]]. + * This event is fired when the network quality level of a [[Connection]] changes. */ export class NetworkQualityLevelChangedEvent extends Event { + /** + * New value of the network quality level + */ + qualityLevel: number; /** - * New value of the property (after change, current value) + * Connection for whom the network quality level changed */ - qualityLevel: Object; connection: Connection /** * @hidden */ - constructor(target: Session, qualityLevel: Object, connection: Connection) { + constructor(target: Session, qualityLevel: number, connection: Connection) { super(false, target, 'networkQualityLevelChanged'); this.qualityLevel = qualityLevel; this.connection = connection;