我正在使用Lity 2.4.0灯箱来启动HLS m3u8流,但是在单击我的视频上的播放时让灯箱显示时遇到了问题。您能为我指出我做错了什么正确的方向吗?
这是我的代码,应该打开带有我的视频的lity灯箱,但它所要做的只是播放没有灯箱的视频:
if (Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('https://mnmedias.api.telequebec.tv/m3u8/29880.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,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 (i.e. .m3u8 URL) directly to the video element throught 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 = 'https://mnmedias.api.telequebec.tv/m3u8/29880.m3u8';
video.addEventListener('canplay',function() {
video.play();
});
}
<script src="https://video-dev.github.io/hls.js/dist/hls.js"></script>
<center>
<video width="560" height="315" id="video" controls data-lity></video>
</center>