我如何将这个 m3u8 嵌入到我的网页中?
How do i embed this m3u8 into my webpage?
我的标题说明了一切。我有 m3u8 文件需要嵌入
尝试使用此方法(如下),但它显示 "video format or mime type is not supported"
<div id='player'>
<video width=100% height=100% src="http://cdncities.com/deranalive/deranalive/playlist.m3u8" type="application/x-shockwave-flash" controls autoplay>
</video>
</div>
我试过 jwplayer wizard,在那里它可以工作,但它不是免费的....我不知道该怎么做。
有人知道免费播放器吗?或该代码的解决方案?
谢谢。
只有 Safari 6.0+ 具有本机 HLS 支持。您不能在桌面上将其与 HTML5 一起使用。
通过 Flash 支持 HLS 的免费播放器是 mediaelement.js
先生,您可以关注此文件:
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video"></video>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('http://cdncities.com/deranalive/deranalive/playlist.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 = 'http://cdncities.com/deranalive/deranalive/playlist.m3u8';
video.addEventListener('canplay',function() {
video.play();
});
}
</script>
我的标题说明了一切。我有 m3u8 文件需要嵌入
尝试使用此方法(如下),但它显示 "video format or mime type is not supported"
<div id='player'>
<video width=100% height=100% src="http://cdncities.com/deranalive/deranalive/playlist.m3u8" type="application/x-shockwave-flash" controls autoplay>
</video>
</div>
我试过 jwplayer wizard,在那里它可以工作,但它不是免费的....我不知道该怎么做。
有人知道免费播放器吗?或该代码的解决方案?
谢谢。
只有 Safari 6.0+ 具有本机 HLS 支持。您不能在桌面上将其与 HTML5 一起使用。
通过 Flash 支持 HLS 的免费播放器是 mediaelement.js
先生,您可以关注此文件:
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video"></video>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('http://cdncities.com/deranalive/deranalive/playlist.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 = 'http://cdncities.com/deranalive/deranalive/playlist.m3u8';
video.addEventListener('canplay',function() {
video.play();
});
}
</script>