龚焕茏
2024-08-12 11cd308d591510acef27d103389aa25d10601830
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<template>
  <div class="meet-container w-screen h-screen">
    <div id="meet" ref="meet"></div>
  </div>
</template>
 
<script setup>
import { ref, watch, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import useWebScoket from "@/hooks/useWebScoket.js";
import { storeToRefs } from 'pinia';
import { useUserStore } from '@/store/index.js';
const route = useRoute();
const meet = ref(null);
 
const userStore = useUserStore();
const { userInfo } = storeToRefs(userStore);
const { meetName, id, userName, userCode } = route.query;
let jitsiApi = null;
onMounted(() => {
  const width = window.innerWidth;
  const height = window.innerHeight;
  const domain = 'ycl.easyblog.vip:8443/' + id;
  const options = {
    roomName: meetName,
    width: width,
    height: height,
    parentNode: meet.value,
    lang: 'zh_CN',
    configOverwrite: {
      prejoinConfig: {
        enabled: false
      },
      //禁用邮箱
      gravatar: {
        disabled: true
      },
      //禁用改名
      readOnlyName: true,
      //参会者名单
      remoteVideoMenu: {
        disabled: false,
        disableKick: true,
        disableGrantModerator: true,
        disabledDemote: false
      },
      // 自定义按钮
      // 自定义按钮
      toolbarButtons: [
        // 摄像头
        'camera',
        // 聊天
        'chat',
        // 'closedcaptions',
        // 共享
        'desktop',
        'download',
        // 'embedmeeting',
        // 'etherpad',
        // 'feedback',
        // 'filmstrip',
        'fullscreen',
        'hangup',
        // 'help',
        'highlight',
        // 'invite',
        'linktosalesforce',
        'livestreaming',
        'microphone',
        'noisesuppression',
        // 'participants-pane',
        // 'profile',
        // 'raisehand',
        'recording',
        // 'security',
        'select-background',
        'settings',
        'shareaudio',
        'sharedvideo',
        'shortcuts',
        'stats',
        'tileview',
        'toggle-camera',
        // 'videoquality',
        'whiteboard'
      ],
      // 禁用邀请
      disableInviteFunctions: true,
      //禁用全部静音
      disableRemoteMute: true,
      //主持人选项
      participantsPane: {
        enabled: false,
        hideMoreActionsButton: true,
        hideModeratorSettingsTab: true,
        hideMuteAllButton: true,
      },
      //取消退出页面
      enableClosePage: false,
      whiteboard: {
        enabled: true
      }
    },
 
    userInfo: {
      displayName: userName
    }
  };
  jitsiApi = new JitsiMeetExternalAPI(domain, options);
  jitsiInit();
 
  // 连接webscoket
  connect();
});
 
const jitsiInit = () => {
  jitsiApi.addListener('readyToClose', () => {
    window.close()
  });
}
 
const { status, message, error, connect, disconnect, sendMessage } = useWebScoket({
  url: 'ws://127.0.0.1:8000/websocket/' + userInfo._rawValue.id,
  heartBeatData: 'ping'
});
 
watch(
  () => message.value,
  (msg) => {
    console.log('msg', msg.commend);
    if (msg.commend === 'kickOut') {
      jitsiApi.executeCommand('hangup');
    }
    if (msg.commend === 'mute') {
      jitsiApi.executeCommand('toggleAudio');
    }
    if (msg.commend === 'openCamera') {
      jitsiApi.executeCommand('toggleVideo');
    }
  }
);
 
 
</script>
 
<style lang="scss" scoped></style>