| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref, onMounted} from 'vue'; |
| | | import {useRoute} from 'vue-router'; |
| | | |
| | | import { ref, watch, onMounted } from 'vue'; |
| | | import { useRoute } from 'vue-router'; |
| | | import useWebScoket from "@/hooks/useWebScoket.js"; |
| | | const route = useRoute(); |
| | | const meet = ref(null); |
| | | |
| | | const {meetName, id, userName, userCode} = route.query; |
| | | const { meetName, id, userName, userCode } = route.query; |
| | | let jitsiApi = null; |
| | | onMounted(() => { |
| | | const width = window.innerWidth; |
| | |
| | | jitsiApi = new JitsiMeetExternalAPI(domain, options); |
| | | jitsiInit(); |
| | | |
| | | // 连接webscoket |
| | | connect(); |
| | | }); |
| | | |
| | | const jitsiInit = () => { |
| | |
| | | }); |
| | | } |
| | | |
| | | const mute = () => { |
| | | jitsiApi.executeCommand('toggleAudio'); |
| | | } |
| | | const kickOut = () => { |
| | | jitsiApi.executeCommand('hangup'); |
| | | } |
| | | |
| | | const { status, message, error, connect, disconnect, sendMessage } = useWebScoket({ |
| | | url: 'ws://127.0.0.1:8000/websocket/' + 1, |
| | | heartBeatData: 'ping' |
| | | }); |
| | | |
| | | watch( |
| | | () => message.value, |
| | | (msg) => { |
| | | console.log('msg', msg.commend); |
| | | if (msg.commend === 'kickOut') { |
| | | kickOut(); |
| | | } |
| | | if (msg.commend === 'mute') { |
| | | mute(); |
| | | } |
| | | if (msg.commend === 'openCamera') { |
| | | alert("切换摄像头") |
| | | } |
| | | } |
| | | ); |
| | | |
| | | |
| | | </script> |
| | | |