拷贝大佬们,起码验证能用再写文章,找到的各种坑
@easydarwin/easywasmplayer - npm
区别
easyplayer:在与vue2结合的时候没有问题,但是用在vue3中,就是提示各种缺东西,你就是将所有文件引入到index.html都不行。网上还各种瞎bb,测试了吗?
easywasmplayer:与vue3可以结合
在index.html中引入
<script src="/public/EasyWasmPlayer.js"></script>
<template><div class="box"><div id="Player"></div></div>
</template>
<script>export default {data() {return {player: '',url: 'http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8'}},mounted() {// 实例化播放器this.player = new WasmPlayer(null, 'Player', this.callbackfun)// 调用播放this.player.play(this.url, 0);this.player.setSnap("https://img.tuguaishou.com/ips_templ_preview/f0/f9/5a/lg_3599867_1607869606_5fd624a673379.jpg!w1024_w?auth_key=2300366484-0-0-322cbbf653e2e67b5b049a4c3c78070d");},methods: {callbackfun(e) {console.log('callbackfun', e);}}
}
</script>
<style>
.box {width: 600px;height: 400px;
}
</style>