Merge pull request #4639 from IgorA100/patch-885163
Fix: Solving the MUTED issue when using video-rtc.js & Added an "onplay" event triggered when playback startscopilot/refactor-filepath-handling^2
commit
3dce095a10
|
|
@ -163,16 +163,23 @@ export class VideoRTC extends HTMLElement {
|
|||
* https://developer.chrome.com/blog/autoplay/
|
||||
*/
|
||||
play() {
|
||||
this.video.play().catch(() => {
|
||||
if (!this.video.muted) {
|
||||
this.video.play().then(_ => {
|
||||
this.onplay();
|
||||
})
|
||||
.catch(er => {
|
||||
if (er.name === 'NotAllowedError' && !this.video.muted) {
|
||||
this.video.muted = true;
|
||||
this.video.play().catch(er => {
|
||||
console.warn(er);
|
||||
});
|
||||
this.play();
|
||||
} else {
|
||||
console.warn(er);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onplay() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Send message to server via WebSocket
|
||||
* @param {Object} value
|
||||
|
|
@ -318,7 +325,7 @@ export class VideoRTC extends HTMLElement {
|
|||
this.pc = null;
|
||||
}
|
||||
|
||||
this.video.src = '';
|
||||
this.video.removeAttribute('src');
|
||||
this.video.srcObject = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue