webrtc.js: fix tearing down
This commit is contained in:
parent
fe6267fe0d
commit
7865c31387
@ -60,7 +60,11 @@ function setError(text) {
|
|||||||
function resetVideo() {
|
function resetVideo() {
|
||||||
// Release the webcam and mic
|
// Release the webcam and mic
|
||||||
if (local_stream_promise)
|
if (local_stream_promise)
|
||||||
local_stream_promise.then(stream => { stream.stop(); });
|
local_stream_promise.then(stream => {
|
||||||
|
if (stream) {
|
||||||
|
stream.getTracks().forEach(function (track) { track.stop(); });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Reset the video element and stop showing the last received frame
|
// Reset the video element and stop showing the last received frame
|
||||||
var videoElement = getVideoElement();
|
var videoElement = getVideoElement();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user