live-player设置src后直接调用play方法,微信小程序多次审核被拒。在真机下无法播放,bindstatechange也没有被触发,
demo代码:
src="{{liveSrc}}"
mode="live"
id="live"
bindstatechange="statechange"
/>
Page({
data: {
liveSrc: ''
},
onReady() {
const that = this;
this.player = wx.createLivePlayerContext('live');
this.setData({
liveSrc: 'rtmp://pull102.lizhi.fm/home/1591c13309c866a963ede100cb0321a4'
}, () => {
that.player.play();
});
}
})
以上代码不会播放,但是如果延迟play的调用,就可以正常播放:
Page({
data: {
liveSrc: ''
},
onReady() {
const that = this;
this.player = wx.createLivePlayerContext('live');
this.setData({
liveSrc: 'rtmp://pull102.lizhi.fm/home/1591c13309c866a963ede100cb0321a4'
}, () => {
setTimeout(() => {
that.player.play();
}, 1000);
});
}
})
本文网址:http://www.91bianli.com/kaifazhinan/71301.html