| | |
| | | toName: '', |
| | | Otype: '', |
| | | |
| | | formName: '' |
| | | formName: '', |
| | | |
| | | faqiid: '', |
| | | jieshouid:'' |
| | | |
| | | } |
| | | }, |
| | | // 页面初始加载(仅执行一次) |
| | |
| | | console.log(option.state); |
| | | if (option.state == "Mains") { |
| | | |
| | | that.jieshouid = option.toname; |
| | | that.faqiid = that.$store.state.puserID; |
| | | |
| | | that.isMain = true; |
| | | var call = false; |
| | | this.userName = that.$store.state.puserID + '-faqiren'; |
| | |
| | | url: that.$store.state.api + '/pushMsg/inviteVideoCall', |
| | | data: { |
| | | userId: option.toname, |
| | | faaqiid: that.$store.state.puserID, |
| | | name: that.$store.state.puserName, |
| | | type: 'video' |
| | | }, |
| | |
| | | uni.navigateBack(); |
| | | // console.log(111) |
| | | }, 2000) |
| | | |
| | | |
| | | } else if (d.res == 1) { |
| | | that.channel = d.roomId; |
| | | console.log('对方在线-- 等待对方接受',d); |
| | | console.log('对方在线-- 等待对方接受', d); |
| | | // call = true; |
| | | setTimeout(res => { |
| | | // uni.navigateBack(); |
| | | // console.log(111) |
| | | that.join(); |
| | | console.log('成功进入') |
| | | that.join(); |
| | | console.log('成功进入') |
| | | }, 2000) |
| | | } |
| | | } |
| | |
| | | // if (call && ) { |
| | | |
| | | // } |
| | | if (data.type = 'close') { |
| | | if (data.type == 'close') { |
| | | console.log('对方已挂断'); |
| | | that.closeAll(); |
| | | } |
| | |
| | | |
| | | // }, 5000) |
| | | } else if (option.state == "Receiver") { |
| | | that.userName = that.$store.state.puserID + '-jieshouren'; |
| | | that.userName = that.$store.state.puserID + '-jieshouren'; |
| | | // that.formName = 'wo'; |
| | | that.channel = option.room; |
| | | that.faqiid = option.faqiid; |
| | | that.jieshouid = that.$store.state.puserID; |
| | | that.init(); |
| | | that.isMain = false; |
| | | } |
| | |
| | | async init() { |
| | | // 查看权限 |
| | | console.log('开始初始化') |
| | | // if (uni.getSystemInfoSync().platform == 'ios') { |
| | | // //查看相机权限 |
| | | // await this.requestAndroidPermission("camera", 'ios'); |
| | | // //查看录音权限 |
| | | // await this.requestAndroidPermission("record", 'ios'); |
| | | this.uid = this.userName; |
| | | console.log('初始化完成’', this.uid, '当前id码'); |
| | | uni.showToast({ |
| | | title: this.uid, |
| | | duration: 2000, |
| | | // icon: 'none' |
| | | }); |
| | | if (uni.getSystemInfoSync().platform == 'ios') { |
| | | //查看相机权限 |
| | | await this.requestAndroidPermission("camera", 'ios'); |
| | | //查看录音权限 |
| | | await this.requestAndroidPermission("record", 'ios'); |
| | | |
| | | // } else if (uni.getSystemInfoSync().platform === 'android') { |
| | | } else if (uni.getSystemInfoSync().platform === 'android') { |
| | | //查看相机权限 |
| | | await this.requestAndroidPermission("android.permission.CAMERA", 'android'); |
| | | //查看录音权限 |
| | | await this.requestAndroidPermission("android.permission.RECORD_AUDIO", 'android'); |
| | | // } |
| | | } |
| | | // 初始化 setCallBack |
| | | await this.callbackFn(); |
| | | // 初始化 create |
| | |
| | | await RtcModule.create({ |
| | | "appId": this.appid |
| | | }, (res) => { |
| | | console.log(res,11111111111111111111111111111111); |
| | | console.log(res, 11111111111111111111111111111111); |
| | | }); |
| | | this.uid = this.randomFn(6); |
| | | console.log('初始化完成’',this.uid, '当前id码'); |
| | | uni.showToast({ |
| | | title: this.uid, |
| | | duration: 2000, |
| | | // icon: 'none' |
| | | }); |
| | | // this.uid = this.randomFn(6); |
| | | |
| | | }, |
| | | //设置角色 |
| | | setClientRole(num) { |
| | |
| | | mask: true |
| | | }); |
| | | //加入房间 |
| | | console.log('room', this.channel,'useid',this.uid) |
| | | console.log('room', this.channel, 'useid', this.uid) |
| | | await RtcModule.joinChannel({ |
| | | "token": "", |
| | | "channelId": this.channel, |
| | |
| | | // 挂断 离开 |
| | | phoneFn() { |
| | | //离开频道 |
| | | RtcModule.leaveChannel((res) => {}); |
| | | this.closeAll(); |
| | | // RtcModule.leaveChannel((res) => {}); |
| | | // this.closeAll(); |
| | | // uni.navigateBack(); |
| | | uni.request({ |
| | | url: this.$store.state.api + 'pushMsg/closeVideoCall', |
| | | data:{ |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | //添加本地视频到页面 |