安裝依賴
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兩個文件復(fù)制到pubilc目錄下
引入
<script src="./EasyPlayer-lib.min.js"></script>
再要播放的地方
1、引入
import EasyPlayer from "@easydarwin/easyplayer"
2、注冊
在components中
components:{EasyPlayer}
3、使用組件
在模板中文章來源:http://www.zghlxwxcb.cn/news/detail-609579.html
<EasyPlayer :id="Math.floor(Math.random()*1+1)" :videoUrl=item :live="true" />
4、樣式自己調(diào)整
5、雙擊可全屏
結(jié)果
文章來源地址http://www.zghlxwxcb.cn/news/detail-609579.html
到了這里,關(guān)于vue項目如何播放m3u8格式視頻的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!