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:
parent
32734586fb
commit
031bedf3ca
@ -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();
|
||||
|
@ -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') {
|
||||
|
@ -1375,6 +1375,8 @@ export default class SIPBridge extends BaseAudioBridge {
|
||||
}
|
||||
|
||||
exitAudio() {
|
||||
if (this.activeSession == null) return Promise.resolve();
|
||||
|
||||
return this.activeSession.exitAudio();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user