最近在做项目的时候,有在前端播放hls协议 h265监控视频的需求,就用到EasyWasmPlayer.js
发现一个问题:当页面关闭时 发现浏览器网络请求依然在执行(很多分片的ts文件)
解决:
在页面即将销毁时beforeUnmount生命周期处理
<div id="Player" v-if="show"></div>
beforeUnmount() {
this.player.pause()
this.player.destroy() //停止播放
this.show = true //销毁dom
console.log('beforeUnmount')
},