mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: fix Map refactoring bugs (for..in not working on Map)
parent
d91721c11d
commit
f672090757
|
@ -616,22 +616,20 @@ export class Session extends EventDispatcher {
|
|||
if (type === 'publisherStartSpeaking') {
|
||||
this.startSpeakingEventsEnabled = true;
|
||||
// If there are already available remote streams, enable hark 'speaking' event in all of them
|
||||
for (const connectionId in this.remoteConnections) {
|
||||
const str = this.remoteConnections.get(connectionId)?.stream;
|
||||
if (!!str && str.hasAudio) {
|
||||
str.enableStartSpeakingEvent();
|
||||
}
|
||||
this.remoteConnections.forEach(remoteConnection => {
|
||||
if (!!remoteConnection.stream && remoteConnection.stream.hasAudio) {
|
||||
remoteConnection.stream.enableStartSpeakingEvent();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === 'publisherStopSpeaking') {
|
||||
this.stopSpeakingEventsEnabled = true;
|
||||
// If there are already available remote streams, enable hark 'stopped_speaking' event in all of them
|
||||
for (const connectionId in this.remoteConnections) {
|
||||
const str = this.remoteConnections.get(connectionId)?.stream;
|
||||
if (!!str && str.hasAudio) {
|
||||
str.enableStopSpeakingEvent();
|
||||
}
|
||||
this.remoteConnections.forEach(remoteConnection => {
|
||||
if (!!remoteConnection.stream && remoteConnection.stream.hasAudio) {
|
||||
remoteConnection.stream.enableStopSpeakingEvent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -648,22 +646,20 @@ export class Session extends EventDispatcher {
|
|||
if (type === 'publisherStartSpeaking') {
|
||||
this.startSpeakingEventsEnabledOnce = true;
|
||||
// If there are already available remote streams, enable hark 'speaking' event in all of them once
|
||||
for (const connectionId in this.remoteConnections) {
|
||||
const str = this.remoteConnections.get(connectionId)?.stream;
|
||||
if (!!str && str.hasAudio) {
|
||||
str.enableOnceStartSpeakingEvent();
|
||||
}
|
||||
this.remoteConnections.forEach(remoteConnection => {
|
||||
if (!!remoteConnection.stream && remoteConnection.stream.hasAudio) {
|
||||
remoteConnection.stream.enableOnceStartSpeakingEvent();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === 'publisherStopSpeaking') {
|
||||
this.stopSpeakingEventsEnabledOnce = true;
|
||||
// If there are already available remote streams, enable hark 'stopped_speaking' event in all of them once
|
||||
for (const connectionId in this.remoteConnections) {
|
||||
const str = this.remoteConnections.get(connectionId)?.stream;
|
||||
if (!!str && str.hasAudio) {
|
||||
str.enableOnceStopSpeakingEvent();
|
||||
}
|
||||
this.remoteConnections.forEach(remoteConnection => {
|
||||
if (!!remoteConnection.stream && remoteConnection.stream.hasAudio) {
|
||||
remoteConnection.stream.enableOnceStopSpeakingEvent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -682,12 +678,11 @@ export class Session extends EventDispatcher {
|
|||
if (remainingStartSpeakingListeners === 0) {
|
||||
this.startSpeakingEventsEnabled = false;
|
||||
// If there are already available remote streams, disable hark in all of them
|
||||
for (const connectionId in this.remoteConnections) {
|
||||
const str = this.remoteConnections.get(connectionId)?.stream;
|
||||
if (!!str) {
|
||||
str.disableStartSpeakingEvent(false);
|
||||
}
|
||||
this.remoteConnections.forEach(remoteConnection => {
|
||||
if (!!remoteConnection.stream) {
|
||||
remoteConnection.stream.disableStartSpeakingEvent(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (type === 'publisherStopSpeaking') {
|
||||
|
@ -695,12 +690,11 @@ export class Session extends EventDispatcher {
|
|||
if (remainingStopSpeakingListeners === 0) {
|
||||
this.stopSpeakingEventsEnabled = false;
|
||||
// If there are already available remote streams, disable hark in all of them
|
||||
for (const connectionId in this.remoteConnections) {
|
||||
const str = this.remoteConnections.get(connectionId)?.stream;
|
||||
if (!!str) {
|
||||
str.disableStopSpeakingEvent(false);
|
||||
}
|
||||
this.remoteConnections.forEach(remoteConnection => {
|
||||
if (!!remoteConnection.stream) {
|
||||
remoteConnection.stream.disableStopSpeakingEvent(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
@ -852,7 +846,7 @@ export class Session extends EventDispatcher {
|
|||
|
||||
if (!!msg.from) {
|
||||
// Signal sent by other client
|
||||
this.getConnection(msg.from, "Connection '" + msg.from + "' unknow when 'onNewMessage'. Existing remote connections: "
|
||||
this.getConnection(msg.from, "Connection '" + msg.from + "' unknown when 'onNewMessage'. Existing remote connections: "
|
||||
+ JSON.stringify(this.remoteConnections.keys()) + '. Existing local connection: ' + this.connection.connectionId)
|
||||
|
||||
.then(connection => {
|
||||
|
@ -1100,13 +1094,13 @@ export class Session extends EventDispatcher {
|
|||
someReconnection = true;
|
||||
}
|
||||
// Re-establish Subscriber streams
|
||||
for (let remoteConnection of Object.values(this.remoteConnections)) {
|
||||
this.remoteConnections.forEach(remoteConnection => {
|
||||
if (!!remoteConnection.stream && remoteConnection.stream.streamIceConnectionStateBroken()) {
|
||||
logger.warn('Re-establishing Subscriber ' + remoteConnection.stream.streamId);
|
||||
remoteConnection.stream.initWebRtcPeerReceive(true);
|
||||
someReconnection = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!someReconnection) {
|
||||
logger.info('There were no media streams in need of a reconnection');
|
||||
}
|
||||
|
|
|
@ -780,7 +780,7 @@ export class Stream extends EventDispatcher {
|
|||
return false;
|
||||
}
|
||||
if (this.isLocal() && !!this.session.openvidu.advancedConfiguration.forceMediaReconnectionAfterNetworkDrop) {
|
||||
logger.warn('OpenVidu Browser advanced configuration option "forceMediaReconnectionAfterNetworkDrop" is enabled. Publisher stream ' + this.streamId + 'will force a reconnection');
|
||||
logger.warn('OpenVidu Browser advanced configuration option "forceMediaReconnectionAfterNetworkDrop" is enabled. Stream ' + this.streamId + ' will force a reconnection');
|
||||
return true;
|
||||
}
|
||||
const iceConnectionState: RTCIceConnectionState = this.getRTCPeerConnection().iceConnectionState;
|
||||
|
|
|
@ -60,7 +60,8 @@ export class SessionDisconnectedEvent extends Event {
|
|||
const session = <Session>this.target;
|
||||
|
||||
// Dispose and delete all remote Connections
|
||||
for (const connectionId in session.remoteConnections) {
|
||||
session.remoteConnections.forEach(remoteConnection => {
|
||||
const connectionId = remoteConnection.connectionId;
|
||||
if (!!session.remoteConnections.get(connectionId)?.stream) {
|
||||
session.remoteConnections.get(connectionId)?.stream!.disposeWebRtcPeer();
|
||||
session.remoteConnections.get(connectionId)?.stream!.disposeMediaStream();
|
||||
|
@ -74,7 +75,7 @@ export class SessionDisconnectedEvent extends Event {
|
|||
session.remoteConnections.get(connectionId)?.dispose();
|
||||
}
|
||||
session.remoteConnections.delete(connectionId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -97,7 +97,7 @@ export class StreamEvent extends Event {
|
|||
if (this.stream.streamManager) this.stream.streamManager.removeAllVideos();
|
||||
|
||||
// Delete stream from Session.remoteStreamsCreated map
|
||||
delete this.stream.session.remoteStreamsCreated[this.stream.streamId];
|
||||
this.stream.session.remoteStreamsCreated.delete(this.stream.streamId);
|
||||
|
||||
// Delete StreamOptionsServer from remote Connection
|
||||
const remoteConnection = this.stream.session.remoteConnections.get(this.stream.connection.connectionId);
|
||||
|
|
Loading…
Reference in New Issue