赞
踩
npm install @easydarwin/easywasmplayer --save
安装好之后,在node-modules中,会出现@easydarwin–>easywasmplayer
文件
如果在vscode中没有找到,可以进入到文件夹中进行查找
找到文件夹下的EasyWasmPlayer.js
和libDecoder.wasm
将其复制到public
文件夹下
<script src="./EasyWasmPlayer.js"></script>
页面
<div class="video-box">
<div id="Player"></div>
</div>
变量
player: "",
vUrl: "",
方法
//播放方法
doVideo() {
this.player = new WasmPlayer(null, "Player", this.callbackfun);
this.player.play(this.vUrl, 1);
},
//回调方法
callbackfun(e) {
console.log(e)
},
//关闭视频
this.player.destroy(this.vUrl)
//暂停视频
this.player.pause(this.vUrl);
这个是b站开源的,具体就不讲了,大家可以自己研究
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。