Network quality level new value and old value

pull/553/head
pabloFuente 2020-11-04 19:27:58 +01:00
parent b3f9fa3a40
commit 242b023c2c
3 changed files with 13 additions and 6 deletions

View File

@ -957,11 +957,11 @@ export class Session extends EventDispatcher {
*/
onNetworkQualityLevelChangedChanged(msg): void {
if (msg.connectionId === this.connection.connectionId) {
this.ee.emitEvent('networkQualityLevelChanged', [new NetworkQualityLevelChangedEvent(this, msg.qualityLevel, this.connection)]);
this.ee.emitEvent('networkQualityLevelChanged', [new NetworkQualityLevelChangedEvent(this, msg.newValue, msg.oldValue, 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.ee.emitEvent('networkQualityLevelChanged', [new NetworkQualityLevelChangedEvent(this, msg.newValue, msg.oldValue, connection)]);
})
.catch(openViduError => {
logger.error(openViduError);

View File

@ -30,7 +30,12 @@ export class NetworkQualityLevelChangedEvent extends Event {
/**
* New value of the network quality level
*/
qualityLevel: number;
newValue: number;
/**
* Old value of the network quality level
*/
oldValue: number;
/**
* Connection for whom the network quality level changed
@ -40,9 +45,10 @@ export class NetworkQualityLevelChangedEvent extends Event {
/**
* @hidden
*/
constructor(target: Session, qualityLevel: number, connection: Connection) {
constructor(target: Session, newValue: number, oldValue: number, connection: Connection) {
super(false, target, 'networkQualityLevelChanged');
this.qualityLevel = qualityLevel;
this.newValue = newValue;
this.oldValue = oldValue;
this.connection = connection;
}

View File

@ -99,7 +99,8 @@ public class ProtocolElements {
public static final String NETWORKQUALITYLEVELCHANGED_METHOD = "networkQualityLevelChanged";
public static final String NETWORKQUALITYCHANGED_CONNECTIONID_PARAM = "connectionId";
public static final String NETWORKQUALITYCHANGED_QUALITYLEVEL_PARAM = "qualityLevel";
public static final String NETWORKQUALITYCHANGED_NEWVALUE_PARAM = "newValue";
public static final String NETWORKQUALITYCHANGED_OLDVALUE_PARAM = "oldValue";
public static final String FORCEDISCONNECT_METHOD = "forceDisconnect";
public static final String FORCEDISCONNECT_CONNECTIONID_PARAM = "connectionId";