diff --git a/app/static/site.js b/app/static/site.js index e92531e0..24230e71 100644 --- a/app/static/site.js +++ b/app/static/site.js @@ -691,9 +691,9 @@ document.addEventListener("DOMContentLoaded", () => { } // Click to load WebRTC - document.querySelectorAll('[data-enabled=True] video.webrtc.placeholder').forEach((v) => { - v.parentElement.addEventListener("click", () => { loadWebRTC(v, true) }, { "once": true }); - v.addEventListener('pause', () => { v.removeAttribute('autoplay'); }); + document.querySelectorAll('[data-enabled=True] video.webrtc.placeholder').forEach((videoElement) => { + videoElement.addEventListener("play", () => { loadWebRTC(videoElement) }, { "once": true }); + videoElement.addEventListener('pause', () => { videoElement.removeAttribute('autoplay'); }); }); // Auto-play video function autoplay(action) { diff --git a/app/static/webrtc.js b/app/static/webrtc.js index 65740521..cc84a2a9 100644 --- a/app/static/webrtc.js +++ b/app/static/webrtc.js @@ -138,17 +138,10 @@ class Receiver { let vid = document.querySelector(`video[data-cam='${this.signalJson.cam}']`); vid.srcObject = event.streams[0]; vid.autoplay = true; - vid.playsInline = true; vid.play().catch((err) => { console.info('play() error:', err); }); } - play(video) { - video.autoplay = true; - video.playsInline = true; - return video.play(); - } - onConnectionStateChange() { if (this.restartTimeout !== null) { return; }