Si cargo el reproductor antes de comenzar la transmisión en vivo y luego empiezo a transmitir después de un momento en que no reproduce el video, ¿cómo manejo este problema?
Hay mi código que llamo para ejecutar video html5 con hls
playVideo(videoLink:string){ console.log("video link", videoLink); const video = document.getElementsByTagName('video')[0]; if (Hls.isSupported()) { /*var hls = new Hls({ debug: true, });*/ var hls = new Hls(); hls.loadSource(videoLink); hls.attachMedia(video); hls.on(Hls.Events.MEDIA_ATTACHED, function () { video.play(); }); } // hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled. // When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (ie .m3u8 URL) directly to the video element through the `src` property. // This is using the built-in support of the plain video element, without using hls.js. else if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoLink; video.addEventListener('canplay', function () { video.play(); }); }}
<div class="container-video" *ngIf="videoFinish == false; else videoStopped"> <video id="video" width="700" height="400" preload="auto" controls> </video> </div>