fix(audio): check if backup stream exists before trying to clean it up
This commit is contained in:
parent
ec1879f96b
commit
bf802ced4c
@ -97,8 +97,10 @@ export default class BaseAudioBridge {
|
|||||||
newStream = await navigator.mediaDevices.getUserMedia(constraints);
|
newStream = await navigator.mediaDevices.getUserMedia(constraints);
|
||||||
await this.setInputStream(newStream);
|
await this.setInputStream(newStream);
|
||||||
this.inputDeviceId = deviceId;
|
this.inputDeviceId = deviceId;
|
||||||
backupStream.getAudioTracks().forEach((track) => track.stop());
|
if (backupStream && backupStream.active) {
|
||||||
backupStream = null;
|
backupStream.getAudioTracks().forEach((track) => track.stop());
|
||||||
|
backupStream = null;
|
||||||
|
}
|
||||||
|
|
||||||
return newStream;
|
return newStream;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user