Skip to content

Commit

Permalink
openvidu-browser: minor updates in NetworkQualityLevelChangedEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloFuente committed Oct 17, 2020
1 parent b4c1df1 commit 47f090b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
13 changes: 9 additions & 4 deletions openvidu-browser/src/OpenVidu/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const platform: PlatformUtils = PlatformUtils.getInstance();
* - signal ([[SignalEvent]])
* - recordingStarted ([[RecordingEvent]])
* - recordingStopped ([[RecordingEvent]])
* - networkQualityLevelChanged ([[NetworkQualityLevelChangedEvent]])
* - reconnecting
* - reconnected
*
Expand Down Expand Up @@ -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);
});
}
}

Expand Down Expand Up @@ -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() ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

import { Event } from './Event';
import { Stream } from '../../OpenVidu/Stream';
import { Filter } from '../../OpenVidu/Filter';


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 47f090b

Please sign in to comment.