1 line
7.5 KiB
JSON
1 line
7.5 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\nimport { getUsersig } from '@/api/home';\nimport { getWidth, getHeight } from \"@/utils/utils\";\nimport roomFooter from './components/roomFooter.vue';\nimport TRTC from 'trtc-sdk-v5';\nconst trtc = TRTC.create();\nexport default {\n name: 'App',\n components: {\n roomFooter\n },\n data() {\n return {\n userClass: \"userVideo5\",\n userList: [],\n userHeight: '100%',\n userSign: \"\",\n roomId: \"\"\n };\n },\n methods: {\n async exitRoom() {\n await trtc.exitRoom();\n await trtc.updateLocalVideo({\n publish: false\n });\n await trtc.updateLocalAudio({\n publish: false\n });\n await trtc.destroy();\n this.$router.push({\n name: \"Home\"\n });\n // this.$router.go(-1)\n }\n },\n\n async mounted() {\n this.userClass = getWidth(this.userList);\n this.userHeight = getHeight(this.userList);\n // let roomId = this.$route.query.roomId;\n // this.roomId = this.$route.query.roomId;\n // let userId = this.$route.query.userId;\n // const sdkAppId = 1600011167;\n // // 获取usersign\n // await getUsersig(userId).then(res => {\n // this.userSign = res.msg;\n // })\n // trtc.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, event => {\n // const userId = event.userId;\n // const streamType = event.streamType;\n // this.userList.push(userId);\n // this.userClass = getWidth(this.userList);\n // // this.userHeight = getHeight(this.userList);\n // setTimeout(() => {\n // trtc.startRemoteVideo({ userId, streamType, view: `${userId}` })\n // })\n // })\n // try {\n // await trtc.enterRoom({ roomId: Number(roomId), scene: 'rtc', sdkAppId, userId, userSig: this.userSign });\n // await trtc.startLocalVideo({\n // view: document.getElementById('localStream'), // 在 DOM 中的 elementId 为 localStream 的标签上预览视频。\n // });\n // await trtc.startLocalAudio();\n // console.log('进房成功');\n // this.$message({\n // message:\"进房成功\",\n // type:'success'\n // })\n // } catch (error) {\n // console.error('进房失败 ' + error);\n // this.$message({\n // message:\"进房失败\",\n // type:'error'\n // });\n // this.$router.push({\n // name:'Home'\n // })\n // }\n },\n\n created() {}\n};","map":{"version":3,"names":["getUsersig","getWidth","getHeight","roomFooter","TRTC","trtc","create","name","components","data","userClass","userList","userHeight","userSign","roomId","methods","exitRoom","updateLocalVideo","publish","updateLocalAudio","destroy","$router","push","mounted","created"],"sources":["src/views/room.vue"],"sourcesContent":["<template>\n <div class=\"roompage\">\n <div :class=\"userClass\" :style=\"{ height: userHeight }\" id=\"localStream\"></div>\n <div :class=\"userClass\" :style=\"{ height: userHeight }\" v-for=\"(item, index) in userList\" :key=\"index\" :id=\"item\">\n </div>\n <div class=\"footer\">\n <roomFooter @exitRoom=\"exitRoom\" :roomId=\"roomId\"></roomFooter>\n </div>\n </div>\n</template>\n \n<script>\nimport { getUsersig } from '@/api/home';\nimport { getWidth, getHeight } from \"@/utils/utils\";\nimport roomFooter from './components/roomFooter.vue';\nimport TRTC from 'trtc-sdk-v5';\nconst trtc = TRTC.create();\nexport default {\n name: 'App',\n components: {\n roomFooter\n },\n data() {\n return {\n userClass: \"userVideo5\",\n userList: [],\n userHeight: '100%',\n userSign: \"\",\n roomId:\"\"\n };\n },\n methods: {\n async exitRoom(){\n await trtc.exitRoom();\n await trtc.updateLocalVideo({publish:false});\n await trtc.updateLocalAudio({publish:false});\n await trtc.destroy()
|