Properly release local media devices when user turns off their cam
This commit is contained in:
parent
3a334a8d68
commit
f4568b9087
|
@ -1376,12 +1376,6 @@ const app = Vue.createApp({
|
|||
|
||||
// Stop broadcasting.
|
||||
stopVideo() {
|
||||
this.webcam.elem.srcObject = null;
|
||||
this.webcam.stream = null;
|
||||
this.webcam.active = false;
|
||||
this.webcam.muted = false;
|
||||
this.whoTab = "online";
|
||||
|
||||
// Close all WebRTC sessions.
|
||||
for (username of Object.keys(this.WebRTC.pc)) {
|
||||
this.closeVideo(username, "answerer");
|
||||
|
@ -1390,6 +1384,18 @@ const app = Vue.createApp({
|
|||
// Hang up on mutual cameras.
|
||||
this.unMutualVideo();
|
||||
|
||||
// Close the local camera devices completely.
|
||||
this.webcam.stream.getTracks().forEach(track => {
|
||||
track.stop();
|
||||
});
|
||||
|
||||
// Reset all front-end state.
|
||||
this.webcam.elem.srcObject = null;
|
||||
this.webcam.stream = null;
|
||||
this.webcam.active = false;
|
||||
this.webcam.muted = false;
|
||||
this.whoTab = "online";
|
||||
|
||||
// Tell backend our camera state.
|
||||
this.sendMe();
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user