现有需求,点击全屏,再点退出全屏。
手机端 正常,电脑端无效。
在外层绑定,内层监听。
<view bindtap="onChangeScreen">
<live-player id="livePlayer" bindfullscreenchange="fullscreenchange"></live-player>
</view>
//js
data:{
isScreen:false
}
fullscreenchange(e){
let { fullScreen } = e.detail
this.setData({isScreen:fullScreen })
}
onChangeScreen(){
wx.createSelectorQuery().select("#livePlayer").context((res)=>{
let context = res.context
if(isScreen){ context.exitFullScreen() }else{ context.requestFullScreen({direction: 90 }) }
})
}