Browse Source

Fix group call connection sound

master
Eduard Kuzmenko 3 years ago
parent
commit
cee5890594
  1. 3
      src/helpers/audioAssetPlayer.ts
  2. 10
      src/lib/appManagers/appGroupCallsManager.ts

3
src/helpers/audioAssetPlayer.ts

@ -19,6 +19,7 @@ export default class AudioAssetPlayer<AssetName extends string> { @@ -19,6 +19,7 @@ export default class AudioAssetPlayer<AssetName extends string> {
try {
const audio = this.createAudio();
audio.autoplay = true;
audio.src = ASSETS_PATH + name;
audio.loop = loop;
audio.play();
@ -39,7 +40,7 @@ export default class AudioAssetPlayer<AssetName extends string> { @@ -39,7 +40,7 @@ export default class AudioAssetPlayer<AssetName extends string> {
}
public stopSound() {
this.audio.pause();
this.audio?.pause();
}
public cancelDelayedPlay() {

10
src/lib/appManagers/appGroupCallsManager.ts

@ -469,10 +469,6 @@ export class AppGroupCallsManager { @@ -469,10 +469,6 @@ export class AppGroupCallsManager {
const connection = connectionInstance.createPeerConnection();
connection.addEventListener('negotiationneeded', () => {
if(!rejoin) {
this.startConnectingSound();
}
connectionInstance.negotiate();
});
@ -485,7 +481,9 @@ export class AppGroupCallsManager { @@ -485,7 +481,9 @@ export class AppGroupCallsManager {
currentGroupCall.dispatchEvent('state', currentGroupCall.state);
const {iceConnectionState} = connection;
if(iceConnectionState !== 'connected' && iceConnectionState !== 'closed') {
if(iceConnectionState === 'disconnected' || iceConnectionState === 'checking' || iceConnectionState === 'new') {
this.startConnectingSound();
} else {
this.stopConnectingSound();
}
@ -541,6 +539,8 @@ export class AppGroupCallsManager { @@ -541,6 +539,8 @@ export class AppGroupCallsManager {
this.setCurrentGroupCall(currentGroupCall);
log('set currentGroupCall', groupCallId, currentGroupCall);
this.startConnectingSound();
return connectionInstance.negotiate();
}
}

Loading…
Cancel
Save