vue 项目使用H5 video标签播放m3u8格式的视频
1.安装插件:npm installvideo.js --saveccnpinstall videojs-contrib-hls --save2.引入:import "video.js/dist/video-js.css";import videojs from "video.js";import "videojs-contrib-hls";3.video.js配置项...
·
1.安装插件:
npm install video.js --save
ccnp install videojs-contrib-hls --save
2.引入:
import "video.js/dist/video-js.css";
import videojs from "video.js";
import "videojs-contrib-hls";
3.video.js配置项
mounted() {
videojs(
"my-video",
{
bigPlayButton: false,
textTrackDisplay: false,
posterImage: true,
errorDisplay: false,
controlBar: true
},
function() {
this.play();
}
);
},
4.页面上使用
<video poster="../assets/video.png" id="my-video" class="video-js vjs-default-skin" controls preload="auto">
<source :src="videoURL+'/hls/1917-2/video.m3u8'" type="application/x-mpegURL">
</video>
poster属性:带有预览图(海报图片)的视频播放器
就这样ending,ok了!!
更多推荐
已为社区贡献2条内容
所有评论(0)