用vue2.x开发的单页,然后用hbuilderx在线打包的app,iphone6s ios12测试的,当跳转到别的页面时,播放器还浮在页面上,挡住别的页面内容了,求大神指点
methods:{
// 获取视频播放信息
getUrl(){
let _this = this;
this.$api.post('api/portal/Video/url',{},res=>{
this.link = res.data.video_url;
this.postImg = res.data.video_pic_url;
if(this.player){
this.player.close();
}
if(window.plus){
this.player = new plus.video.VideoPlayer('myvideo', {
src:_this.link,
poster: _this.postImg , //视频封面地址
autoplay: res.data.video_auto_play == '1'?true:false
});
}else{
document.addEventListener("plusready", function(){
_this.player = new plus.video.VideoPlayer('myvideo', {
src:_this.link,
poster: _this.postImg , //视频封面地址
autoplay: res.data.video_auto_play == '1'?true:false
});
},false)
}
},res=>{
})
},
},
beforeDestroy () {
if(this.player){
this.player.close();
}
},
1 个回复
1***@163.com
同 ios端beforeDestroy方法不调用