callbackFn() {
RtcModule.setCallBack((res) => {
switch (res.engineEvent) {
case "onWarning":
this.promptFn("warn", res.warningCode);
break;
case "onError":
res.errorCode != 18 ? this.promptFn("error", res.errorCode) : '';
break;
case "onJoinChannelSuccess":
uni.hideLoading();
this.role == 1 ? this.PeerVideoUser.push(res.uid) : "";
this.videoShow = true;
setTimeout(() => {
this.promptText = ""
RtcModule.setEnableSpeakerphone({
"enabled": true
}, (res) => {})
setTimeout(() => {
this.role == 1 ? this.setupLocalVideoFn() : RtcModule.enableVideo((res) => {});
}, 200)
}, 2000)
break;
case "onLeaveChannel":
setTimeout(() => {
this.closeAll()
}, 500)
break;
case "onUserJoined":
this.PeerVideoUser.push(res.uid);
break;
case "onUserOffline":
this.PeerVideoUser = this.PeerVideoUser.filter((x) => x !== res.uid);
break;
case "onFirstLocalAudioFrame":
break;
case "onFirstLocalVideoFrame":
break;
case "onFirstRemoteVideoDecoded":
this.promptText = "请稍等。。。"
let uid = []
uid.push(res.uid)
setTimeout(() => {
this.promptText = "";
setTimeout(() => {
uid.map(item => {
this.$refs[`popup${item}`][0].setupRemoteVideo({
"renderMode": 1,
"channelId": this.chanel,
"uid": item,
"mirrorMode": 0
}, (res) => {})
RtcModule.startPreview((res) => {});
})
}, 500)
}, 2000)
break;
}
})
},
评论