fix(audio): check for session availability on exitAudio

Mostly benign, but exitAudio/forceExitAudio was throwing an unhandled
error when called on sessions with no active audio because the
underlying bridge methods did not check whether there was an active
session to stop beforehand.
This commit is contained in:
prlanzarin 2022-10-27 16:13:27 +00:00
parent 32734586fb
commit 031bedf3ca
3 changed files with 8 additions and 3 deletions

View File

@ -413,8 +413,11 @@ export default class FullAudioBridge extends BaseAudioBridge {
const mediaElement = document.getElementById(MEDIA_TAG);
this.clearReconnectionTimeout();
this.broker.stop();
this.broker = null;
if (this.broker) {
this.broker.stop();
this.broker = null;
}
if (mediaElement && typeof mediaElement.pause === 'function') {
mediaElement.pause();

View File

@ -297,7 +297,7 @@ export default class KurentoAudioBridge extends BaseAudioBridge {
exitAudio() {
const mediaElement = document.getElementById(MEDIA_TAG);
this.broker.stop();
if (this.broker) this.broker.stop();
this.clearReconnectionTimeout();
if (mediaElement && typeof mediaElement.pause === 'function') {

View File

@ -1375,6 +1375,8 @@ export default class SIPBridge extends BaseAudioBridge {
}
exitAudio() {
if (this.activeSession == null) return Promise.resolve();
return this.activeSession.exitAudio();
}