mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 05:49:22 +00:00
Fix Chrome issue
This commit is contained in:
parent
d4c2152ecd
commit
778b20ee33
@ -681,7 +681,23 @@ class CallWindow extends CustomEvents {
|
||||
videoEl.muted = muted;
|
||||
|
||||
videoEl.srcObject = stream
|
||||
videoEl.play()
|
||||
|
||||
// Fix Chrome exception: DOMException: play() failed because the user didn't interact with the document first.
|
||||
try {
|
||||
await videoEl.play()
|
||||
} catch(e) {
|
||||
console.error("Caught play() error", e)
|
||||
notify("Please click anywhere on the page to resume video call");
|
||||
|
||||
// Wait for user interaction before trying again
|
||||
document.addEventListener("click", () => {
|
||||
if(videoEl.isConnected)
|
||||
videoEl.play()
|
||||
}, {
|
||||
once: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
this.videoEls.set(peerID, videoEl)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user