vue项目如何播放m3u8格式视频

安装依赖

 npm install @easydarwin/easyplayer --save
 npm install copy-webpack-plugin@5.1.2 --save-dev

找到public/index.html

在node_modeols里面找到@easydarwin下的dist/compent/EasyPlayer-lib.min.js和EasyPlayer.wasm两个文件复制到pubilc目录下

引入

	<script src="./EasyPlayer-lib.min.js"></script>

再要播放的地方

1、引入

import EasyPlayer from "@easydarwin/easyplayer"

2、注册

在components中

components:{
    
    EasyPlayer}

3、使用组件

在模板中

<EasyPlayer :id="Math.floor(Math.random()*1+1)" :videoUrl=item :live="true" />

4、样式自己调整

5、双击可全屏

结果

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_71585401/article/details/130426396