优化音视频通话
This commit is contained in:
@@ -56,26 +56,6 @@
|
||||
{{ isEnableSpeaker ? '关闭' : '开启' }}扬声器
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="control-row" :style="{ width: windowWidth + 'px' }">
|
||||
<view class="icon-item" @click="changeMediaType">
|
||||
<view class="control-icon">
|
||||
<uni-icons
|
||||
:type="mediaTypeCur === 'video' ? 'phone' : 'videocam'"
|
||||
size="24"
|
||||
color="#fff"
|
||||
></uni-icons>
|
||||
</view>
|
||||
<text class="btn-text">
|
||||
{{ mediaTypeCur === 'video' ? '切换语音' : '切换视频' }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="hangup-btn icon-item" @click="hangup">
|
||||
<view class="hangup-icon control-icon">
|
||||
<uni-icons type="phone" size="28" color="#fff"></uni-icons>
|
||||
</view>
|
||||
<text class="hangup-text">挂断</text>
|
||||
</view>
|
||||
<view class="icon-item" @click="switchCamera">
|
||||
<view class="control-icon">
|
||||
<uni-icons type="refresh" size="24" color="#fff"></uni-icons>
|
||||
@@ -83,6 +63,14 @@
|
||||
<text class="btn-text">翻转</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="control-row" :style="{ width: windowWidth + 'px' }">
|
||||
<view class="hangup-btn icon-item" @click="hangup">
|
||||
<view class="hangup-icon control-icon">
|
||||
<uni-icons type="phone" size="28" color="#fff"></uni-icons>
|
||||
</view>
|
||||
<text class="hangup-text">挂断</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -131,6 +119,7 @@
|
||||
uni.getStorage({
|
||||
key: 'room-parameters',
|
||||
success: res => {
|
||||
console.log('room-parameters: ',res);
|
||||
this.mediaType = res.data.mediaType
|
||||
this.callType = res.data.callType ? res.data.callType : 'in'
|
||||
this.groupId = res.data.groupId ? res.data.groupId : ''
|
||||
@@ -151,24 +140,34 @@
|
||||
_this.windowHeight = res.windowHeight
|
||||
}
|
||||
})
|
||||
|
||||
uni.$on('OnCallConnected', this.onCallConnected)
|
||||
uni.$on('OnCallDisconnected', this.onCallDisconnected)
|
||||
this.initBeautyOpton()
|
||||
},
|
||||
beforeDestroy() {
|
||||
uni.$off('OnCallDisconnected')
|
||||
uni.$off('OnCallConnected')
|
||||
},
|
||||
},
|
||||
onUnload() {
|
||||
call.hangup()
|
||||
// this.removeAllListeners()
|
||||
},
|
||||
onHide() {
|
||||
const session = call.getCurrentCallSession()
|
||||
if (session) {
|
||||
call.hangup()
|
||||
}
|
||||
// this.removeAllListeners()
|
||||
},
|
||||
methods: {
|
||||
removeAllListeners(){
|
||||
//移除监听-接收到通话呼入
|
||||
call.removeRemoteUserJoinedListener();
|
||||
// 移除监听-通话已结束
|
||||
call.removeCallDisconnectedListener();
|
||||
// 移除监听-通话出现错误的回调
|
||||
call.removeErrorListener();
|
||||
},
|
||||
changeMediaType() {
|
||||
if (this.mediaTypeCur == 'video') {
|
||||
this.mediaTypeCur = 'audio'
|
||||
@@ -312,6 +311,7 @@
|
||||
? this.currentCallSession.users
|
||||
: []
|
||||
}
|
||||
console.log('this.users: ',this.users);
|
||||
let _this = this
|
||||
// im.getCurrentUserId(function(result){
|
||||
// _this.systemInfoSync(result.userId,_this.$refs.bigVideoView.ref,false);
|
||||
@@ -488,7 +488,7 @@
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
margin: 10rpx;
|
||||
margin: 10rpx 20rpx;
|
||||
}
|
||||
|
||||
.control-icon {
|
||||
|
||||
Reference in New Issue
Block a user