Files
ZhHealth/pages/im/private/call.vue
2022-01-26 17:43:21 +08:00

61 lines
1.6 KiB
Vue

<template>
<view>
<view class="video">
<RongCloud-Call-RCUniCallView style="width: 100%;height: 100%" ref="bigVideoView">
</RongCloud-Call-RCUniCallView>
</view>
<button type="default" @click="accept">接听</button>
<button type="default" @click="hangup">挂断</button>
<button type="default" @click="toHome">回主页</button>
</view>
</template>
<script>
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
export default {
data() {
return {
targetId: '',
users: []
}
},
onLoad(e) {
this.targetId = e.targetId
},
methods: {
accept() {
CallLib.accept()
CallLib.enableCamera(true, 0)
const currentCallSession = CallLib.getCurrentCallSession()
console.log(currentCallSession);
this.users = currentCallSession.users
setTimeout(() => {
CallLib.setVideoView(currentCallSession.mine.userId, 'bigVideoView', 0, true)
}, 500);
},
hangup() {
CallLib.hangup()
setTimeout(() => {
uni.navigateBack()
}, 200);
},
toHome() {
uni.switchTab({
url: '/pages/im/index'
})
}
}
}
</script>
<style lang="scss" scoped>
.video {
width: 100vw;
height: 100vw;
}
</style>