<template>
<view>
<text @click="startPush" class="btn">start</text>
<text @click="stopPush" class="btn">stop</text>
</view>
</template>
<script>
export default {
data() {
return {
pusher: null
}
},
onLoad() {
this.plusReady()
},
methods: {
plusReady() {
const currentWebview = this.$mp.page.$getAppWebview(); //注意相关操作写在APP-PLUS条件编译下
this.pusher = plus.video.createLivePusher("", {
url: '地址已隐藏',
top: '100px',
left: '0px',
width: '100%',
height: '300px',
position: 'static'
});
currentWebview.append(this.pusher);
this.pusher.setOptions({
url: '地址已隐藏'
});
this.pusher.addEventListener('statechange', function(e) {
console.log(JSON.stringify(e));
})
this.pusher.addEventListener('netstatus', function(e) {
console.log(JSON.stringify(e));
})
this.pusher.addEventListener('error', function(e) {
console.log(JSON.stringify(e));
})
},
startPush() {
console.log('start');
this.pusher.start();
},
stopPush() {
this.pusher.stop();
}
}
}
</script>
<style>
.btn {
padding: 20rpx;
margin: 20rpx;
border: 1rpx solid #09BB07;
}
</style>
使用的阿里云直播,在nvue中使用live-pusher推流是成功的。但是在vue中,虽然netstatus有变化,但是推流不成功
以下是状态信息
{"type":"statechange","target":{"IDENTITY":"LivePusher","id":"","__uuid__":"LivePusher101605081165580","options":{"url":"地址已隐藏","top":"100px","left":"0px","width":"100%","height":"300px","position":"static"},"onCapture":null},"detail":{"code":"3004","message":"disconnected"}}
1 个回复
8***@qq.com
我uniapp中推流为啥没成功?