userSig
This commit is contained in:
parent
51af040686
commit
26ccf348e5
|
|
@ -52,7 +52,7 @@
|
|||
import TRTC from 'trtc-js-sdk'
|
||||
import { useRoute } from 'vue-router'
|
||||
import DeviceSelect from './components/Device.vue'
|
||||
import { ref, reactive, toRefs, onMounted, watch, nextTick } from 'vue'
|
||||
import { ref, reactive, toRefs, onMounted, onBeforeUnmount, watch, nextTick } from 'vue'
|
||||
import { CameraReverseOutline, VideocamOutline, VideocamOffOutline } from '@vicons/ionicons5'
|
||||
import { AudioOutlined, AudioMutedOutlined } from '@vicons/antd'
|
||||
import { isUndef } from '@/utils/is.js'
|
||||
|
|
@ -75,6 +75,7 @@ export default {
|
|||
const data = reactive({
|
||||
hasInit: false,
|
||||
client: null,
|
||||
timer: null,
|
||||
sdkAppId: 1400752641,
|
||||
sdkSecret: '9b5fc557f286d7e4d6eafd8023026da59f0674000f319754aa1ec4beefddcdd6',
|
||||
userId: null,
|
||||
|
|
@ -130,6 +131,10 @@ export default {
|
|||
status.isJoining = false
|
||||
status.isJoined = true
|
||||
startGetAudioLevel()
|
||||
updateUsers(2)
|
||||
data.timer = setInterval(async() => {
|
||||
await heartbeat()
|
||||
}, 5000)
|
||||
} catch (error) {
|
||||
status.isJoining = false
|
||||
console.error('join room failed', error)
|
||||
|
|
@ -514,8 +519,14 @@ export default {
|
|||
data.userId = userId
|
||||
data.roomId = Number(roomId)
|
||||
await handleSig()
|
||||
// await heartbeat()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
updateUsers(3)
|
||||
clearInterval(data.timer)
|
||||
data.timer = null
|
||||
})
|
||||
|
||||
watch(() => [settings.cameraId, settings.microphoneId], async([cameraId, microphoneId]) => {
|
||||
if (cameraId && microphoneId) {
|
||||
data.hasInit = true
|
||||
|
|
|
|||
Loading…
Reference in New Issue