<template>
<view>
<live-pusher
id='livePusher'
ref="livePusher"
style="width: 100vw;height: 600upx;"
:url="rtmpUrl"
mode="SD"
:muted="false"
:enable-camera="true"
:auto-focus="true"
:beauty="1"
whiteness="2"
aspect="9:16"
@statechange="statechange"
@netstatus="netstatus"
@error = "error"
></live-pusher>
<view class="btn-box">
<button style="background: #FCD1D1; color: #E45762;" class="btn" @click="pauseOrResume">{{pauseText}}</button>
<button style="background: #E43D33; color: #fff;" class="btn" @click="meetingOver">结束会议</button>
<!-- <button type="default" class="btn" @click="switchCamera"><uni-icons type="camera-filled" size="35"/></button> -->
</view>
<view style="text-align: center; margin-bottom: 24px;">
会议已进行 {{ dateText }}
</view>
</view>
</template>
onReady() {
this.context = uni.createLivePusherContext("livePusher", this);
},
methods:{
statechange(e) {
console.log("状态改变:" + JSON.stringify(e));
},
netstatus(e) {
console.log("网络状态:" + JSON.stringify(e));
},
error(e) {
console.log("错误提示:" + JSON.stringify(e));
},
start: function() {
console.log("开始推流");
this.isClose = false;//直播未停止不能退出
this.context.start({
success: (a) => {
console.log("开始推流:" + JSON.stringify(a));
}
});
}
}