forked from hibas123/ScreenSharingThing
Make old video streams stop
This commit is contained in:
parent
e887908a45
commit
3f8358fa4c
@ -96,6 +96,8 @@ function bitrateTransform(sdp) {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
let currentStream = undefined;
|
||||
peer.on("open", (id) => {
|
||||
console.log("ID", id);
|
||||
sf.streamId_text = id;
|
||||
@ -115,6 +117,10 @@ peer.on("open", (id) => {
|
||||
video: true,
|
||||
})
|
||||
.then((stream) => {
|
||||
if(currentStream) {
|
||||
currentStream.getTracks().forEach(track => track.stop())
|
||||
}
|
||||
currentStream = stream;
|
||||
let v = sf.localVideo;
|
||||
v.srcObject = stream;
|
||||
v.play();
|
||||
|
Loading…
Reference in New Issue
Block a user