需求:微信小程序中长按按钮,手动推流到rtmp服务器,点击过程没有报错,也没有成功。
<live-pusher
mode="RTC"
:enable-camera="false"
:autopush="false"
ref="livePusher"
id="livePusher"
url="rtmp://xxx:1935/xxx/xx"
@error = "error"
></live-pusher>
onReady() {
setTimeout(() => {
this.playerCtx = uni.createLivePlayerContext('livePlayer');
this.pusherCtx = uni.createLivePusherContext('livePusher', this);
}, 300);
},
touchdown() {
console.log('测试');
let that = this;
console.log(that.pusherCtx);
uni.vibrateLong({
success: function() {
that.tips = '松开结束';
}
});
that.pusherCtx.start({
success: ret => {
console.log(ret, 'start push success!');
},
fail: ret => {
console.log(ret, 'start push failed!');
},
complete: ret => {
console.log(ret, 'start push complete!');
}
});
},