<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>videoJs</title>
<link href="https://vjs.zencdn.net/7.6.6/video-js.css" rel="stylesheet" />
<!-- If you'd like to support IE8 (for Video.js versions prior to v7) -->
<script src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
</head>
<body>
<section id="videoPlayer">
<video id="my-video" style="clear:both;display:block;margin:auto;width:100%;" width="1280" height="720" class="video-js vjs-default-skin vjs-big-play-centered" poster="">
<source src="https://new.iskcd.com/20211013/4leWZywE/index.m3u8" type="application/x-mpegURL" id="target">
<!-上述可改为自己的.m3u8-->
</video>
</section>
<script src="https://vjs.zencdn.net/7.6.6/video.js"></script>
<script type="text/javascript">
var player = videojs('my-video', {
"poster": "", "controls": "true" }, function() {
this.on('play', function() {
console.log('正在播放');
});
this.on('pause', function() {
console.log("暂停中")
});
this.on('ended', function() {
console.log('结束');
})
});
</script>
</body>
</html>
H5通过js实现播放m3u8外链video-js
猜你喜欢
转载自blog.csdn.net/weixin_45987577/article/details/124506835
今日推荐
周排行