为什么调用requestPictureInPicture无效并报错?
页面上放了一个按钮,调用startPicInPic,进入小窗模式失败,报错如下:
requestLivePlayerPictureInPicture:fail function cannot run on service
相关代码如下:
<live-player
id="player"
src="{{pullUrl}}"
mode="live"
autoplay
object-fit="fillCrop"
bindstatechange="statechange"
picture-in-picture-mode="{{['push']}}"
bindenterpictureinpicture="enterPictureInPicture"
bindleavepictureinpicture="leavePictureInPicture"
catchtouchmove="{{true}}"
bindtap="togglePureModel"
style="width: 100%; height: 100%;">
</live-player>
this.setData({
player: wx.createLivePlayerContext('player')
})
/**
* 进入小窗模式
*/
startPicInPic () {
this.data.player.requestPictureInPicture({
success: res => {
console.log('======================进入小窗成功======================')
console.log(res)
},
fail: err => {
console.log('======================进入小窗失败======================')
console.log(err)
}
})
wx.navigateBack()
},
1 回复
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)