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了!!

Logo

前往低代码交流专区

更多推荐