openvidu-browser: minor updates in NetworkQualityLevelChangedEvent

pull/553/head
pabloFuente 2020-10-17 19:46:22 +02:00
parent b4c1df1878
commit 47f090b2cb
3 changed files with 17 additions and 10 deletions

View File

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

View File

@ -16,7 +16,6 @@
*/
import { Event } from './Event';
import { Stream } from '../../OpenVidu/Stream';
import { Filter } from '../../OpenVidu/Filter';

View File

@ -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;