组件名:<live-player></live-player>
基础库版本号:2.26.2
微信版本:8.0.34
//页面
<view bindtap="showFull">
<view class="live-video" bindtap="showFull">
<live-player id="livePlayer" src="{{liveUrl}}" mode="live" autoplay bindstatechange="statechange" binderror="error">
<view class='full_img_idv' catchtap="hideFull" wx:if="{{showControls}}">
<view class="col-box" bindtap="unFullScreen" wx:if="{{fullScreenFlag}}">
退出全屏
</view>
<view class="col-box" wx:else bindtap="onFullScreen">
全屏
</view>
</view>
</live-player>
</view>
</view>
//js
Page({
data: {
liveUrl:"",
fullScreenFlag: false,
showControls: false,
LivePlayerContext: ''
},
onLoad() {
},
showFull() {
this.setData({
showControls: true
})
},
hideFull() {
this.setData({
showControls: false
})
},
onFullScreen() {
console.log("点击全屏喽");
let that = this
this.data.LivePlayerContext = wx.createLivePlayerContext('livePlayer')
debugger
this.data.LivePlayerContext.requestFullScreen({
direction: 90,
success(e) {
debugger
that.setData({
fullScreenFlag: true
})
},
fail(e) {
debugger
console.log(e)
},
complete(e) {
debugger
console.log(e)
}
})
},
unFullScreen() {
let that = this
this.data.LivePlayerContext.exitFullScreen({
success(e) {
that.setData({
fullScreenFlag: false
})
},
})
},
statechange(e) {
console.log('live-player code:', e.detail.code)
},
error(e) {
console.error('live-player error:', e.detail.errMsg)
}
})
你好,使用基础库2.30.4试试呢?若还有麻烦提供出现问题的具体机型、以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
安卓系统中直播组件live-player组件,可以拉取流的画面,正常播放,requestFullScreen全屏方法不可用,具体型号 MI 11,Android版本12 MIUI版本 13.0.9稳定版
123