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