|
|
@@ -56,6 +56,8 @@ import { ref, reactive, toRefs, onMounted, watch, nextTick } from 'vue' |
|
|
|
import { CameraReverseOutline, VideocamOutline, VideocamOffOutline } from '@vicons/ionicons5' |
|
|
|
import { AudioOutlined, AudioMutedOutlined } from '@vicons/antd' |
|
|
|
import { isUndef } from '@/utils/is.js' |
|
|
|
import { formatDateTime } from '@/utils/index.js' |
|
|
|
import axios from 'axios' |
|
|
|
// import { Screen, ScreenOff } from '@vicons/carbon' |
|
|
|
export default { |
|
|
|
name: 'HomePage', |
|
|
@@ -75,10 +77,11 @@ export default { |
|
|
|
client: null, |
|
|
|
sdkAppId: 1400752641, |
|
|
|
sdkSecret: '9b5fc557f286d7e4d6eafd8023026da59f0674000f319754aa1ec4beefddcdd6', |
|
|
|
userId: '', |
|
|
|
userId: null, |
|
|
|
userSig: null, |
|
|
|
roomId: null, |
|
|
|
secret: { |
|
|
|
'whr': 'eJyrVgrxCdZLrSjILEpVsrIwMzEw0AELlaUWKVkpGekZKEH4xSnZiQUFmSlKVoZANeamRmYmhhCZzJTUvJLMtEywhvKMIpiGzHQg38nfzcg4KtPAJaKkIDerLK84pCqw0NPNssjCtMIzqTTQtyIj1T-NKDXYINkWqrEkMxfoFEMzM6BjzC0MLGoBdUIwhw__', |
|
|
|
'whr': 'eJwtzE0LgkAUheH-MtvCrs5HILQK0WiSQttEG2GudpNqGCWF6L9n6vI8B94Py3XmvdGxkAUesOW4yeCzpZJG7m5u5sbUhbVkWOgLgLUMlPCnB3tLDgeXUgYAMGlLj78ppQTnINRcoWqo6vj0wm6-rc95TL1KE55kgM7cdbSLrissL3mjq3SB-fGwYd8f4U8w8w__', |
|
|
|
'wanghao': 'eJw1zF0LgjAYhuH-suOQ1*lmCB0kGBSF9AWdrm3pm-ixOUqI-numdfhcNzwvctoevYe2JCbUAzIbNypdO7zhyE9R54VofqlTpWhbVCT2Q4CIUR76U9F9i1YPzhijADCpw*prnPMgDOhfO8yH5*hus*u8Fyw1O*5MDcVqIx2k-WUpG24OQu4zhucyqdYL8v4As-8yew__', |
|
|
|
'wangran': 'eJyrVgrxCdYrSy1SslIy0jNQ0gHzM1NS80oy0zLBwuWJeelFiXlQqeKU7MSCgswUJStDEwMDc1MjMxNDiExqRUFmUSpQ3NTU1MjAwAAiWpKZCxIzMzMzNjE2MjGBmpKZDjQ5xd0z0N0zyiPbzck1scw-paLcMTQlOT8izC3LxcLF1STA09DAybi80jEl2VapFgCtiDHe', |
|
|
|
'haoran': 'eJwtzEELgjAYxvHvsqsh29ymCB28hIIElZR1G2y1ty2VJSVE3z1Tj8-vgf8HVeUhfGmPUkRDjFbTBqWbHq4wsZGtl83yPJWVXQcKpYRhHHMqGJkfPXTg9eicc4oxnrWHx9*EEFHECGVLBW5jWMn6HCRBW7njJd*WNgNrNrnbFXcZG356V94Vg7W12ydr9P0BbGAyOQ__', |
|
|
@@ -109,7 +112,8 @@ export default { |
|
|
|
data.client = TRTC.createClient({ |
|
|
|
sdkAppId: data.sdkAppId, // 填写您申请的 sdkAppId |
|
|
|
userId: data.userId, // 填写您业务对应的 userId |
|
|
|
userSig: data.secret[data.userId], // 填写服务器或本地计算的 userSig |
|
|
|
// userSig: data.secret[data.userId], // 填写服务器或本地计算的 userSig |
|
|
|
userSig: data.userSig, // 填写服务器或本地计算的 userSig |
|
|
|
mode: 'rtc' |
|
|
|
}) |
|
|
|
handleClientEvents() |
|
|
@@ -460,16 +464,57 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 用户签名 |
|
|
|
* @return {*} |
|
|
|
*/ |
|
|
|
const handleSig = async() => { |
|
|
|
const res = await axios.get(`https://hhz.test.t-aaron.com/api/tencentCloudRtc/genUserSig/${data.userId}`) |
|
|
|
if (res.data.code === 0) { |
|
|
|
data.userSig = res.data.data.userSig |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const updateUsers = async(status) => { |
|
|
|
const params = { |
|
|
|
userId: data.userId, |
|
|
|
roomId: data.roomId, |
|
|
|
status |
|
|
|
} |
|
|
|
await axios.put(`https://hhz.test.t-aaron.com/api/meeting/updatePeopleStatus`, params) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 心跳,定时调用 |
|
|
|
* @param {*} status |
|
|
|
* @return {*} |
|
|
|
*/ |
|
|
|
const heartbeat = async() => { |
|
|
|
const time = new Date().getTime() |
|
|
|
const params = { |
|
|
|
userId: data.userId, |
|
|
|
roomId: data.roomId, |
|
|
|
heartbeatTime: formatDateTime(time) |
|
|
|
} |
|
|
|
await axios.put(`https://hhz.test.t-aaron.com/api/meeting/heartbeatTime`, params) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 翻转摄像头 |
|
|
|
* @return {*} |
|
|
|
*/ |
|
|
|
const handelCameraReverse = () => { |
|
|
|
if (!status.isMutedVideo) { |
|
|
|
cameraRef.value.handleReverse() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(async() => { |
|
|
|
const { userId, roomId } = route.query |
|
|
|
data.userId = userId |
|
|
|
data.roomId = Number(roomId) |
|
|
|
await handleSig() |
|
|
|
// await heartbeat() |
|
|
|
}) |
|
|
|
watch(() => [settings.cameraId, settings.microphoneId], async([cameraId, microphoneId]) => { |
|
|
|
if (cameraId && microphoneId) { |
|
|
@@ -477,8 +522,8 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
watch(() => data.hasInit, async(val) => { |
|
|
|
if (val) { |
|
|
|
watch(() => [data.hasInit, data.userSig], async([init, sig]) => { |
|
|
|
if (init && sig) { |
|
|
|
await createMeetingRoom() |
|
|
|
await joinMeetingRoom() |
|
|
|
await initLocalStream() |