3***@qq.com
3***@qq.com
  • 发布:2021-01-23 11:46
  • 更新:2021-09-12 11:10
  • 阅读:1226

安卓 app 视频闪退问题

分类:uni-app

第一个问题: 视频图片列表页分页加载,只要有一个视频预加载报错,安卓端app就会闪退,ios正常
第二个问题:onPageScroll 用户滚动时播放当前的视频,视频过多安卓端app就会闪退,ios正常
onLoad(options) {
//创建视频上下文
this.videoContent = uni.createVideoContext
},
onPageScroll(e){
const that = this
if(that.tabId=="dynamic" && app.globalData.platformObj.platform=='ios'){
if(that.playId){
that.videoContent(that.playId).pause(); //暂停上一次播放的视频
that.playId = ''
}
clearTimeout(that.debounce)
that.debounce = setTimeout(()=>{
that.dynListData.forEach(item=>{
if(item.type==2){
let scrTop = parseInt(e.scrollTop),top = parseInt(item.top) + parseInt(item.height);
if(scrTop<top && scrTop+300>top){
console.log('播放用户当前滑动的视频')
let currentId = 'video' + item.id;// 获取当前视频id
that.playId = currentId
that.videoContent(currentId).play(); //播放当前视频
// return
}
}
})
}, 500)
}
}

0 关注 分享

要回复文章请先登录注册

3***@qq.com

3***@qq.com (作者)

回复 大前端小王子 :
已解决,当前页面只有一个video,就不会闪退了。
2021-09-12 11:10
大前端小王子

大前端小王子

你好,请问解决了吗?
2021-05-27 21:03