mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: Added connection object to network quality event
parent
482d03d8e9
commit
67c50862bb
|
@ -929,7 +929,11 @@ export class Session extends EventDispatcher {
|
||||||
*/
|
*/
|
||||||
onNetworkQualityLevelChangedChanged(msg): void {
|
onNetworkQualityLevelChangedChanged(msg): void {
|
||||||
if (msg.connectionId === this.connection.connectionId) {
|
if (msg.connectionId === this.connection.connectionId) {
|
||||||
this.ee.emitEvent('networkQualityLevelChanged', [new NetworkQualityLevelChangedEvent(this, msg.qualityLevel)]);
|
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)]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
import { Event } from './Event';
|
import { Event } from './Event';
|
||||||
import { Session } from '../../OpenVidu/Session';
|
import { Session } from '../../OpenVidu/Session';
|
||||||
|
import { Connection } from '../../OpenVidu/Connection';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines event `networkQualityLevelChangedEvent` dispatched by [[Session]].
|
* Defines event `networkQualityLevelChangedEvent` dispatched by [[Session]].
|
||||||
|
@ -29,13 +30,15 @@ export class NetworkQualityLevelChangedEvent extends Event {
|
||||||
* New value of the property (after change, current value)
|
* New value of the property (after change, current value)
|
||||||
*/
|
*/
|
||||||
qualityLevel: Object;
|
qualityLevel: Object;
|
||||||
|
connection: Connection
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
constructor(target: Session, qualityLevel: Object) {
|
constructor(target: Session, qualityLevel: Object, connection: Connection) {
|
||||||
super(false, target, 'networkQualityLevelChanged');
|
super(false, target, 'networkQualityLevelChanged');
|
||||||
this.qualityLevel = qualityLevel;
|
this.qualityLevel = qualityLevel;
|
||||||
|
this.connection = connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue