From a12559e8c816633977358fd21c60c621e5b96645 Mon Sep 17 00:00:00 2001 From: odc.xiaohui <xiaohui@Q1> Date: 星期二, 13 六月 2023 15:20:16 +0800 Subject: [PATCH] 添加会议 --- src/views/meeting/list.vue | 136 +++++++++++++++++++++++++++++++------------- 1 files changed, 95 insertions(+), 41 deletions(-) diff --git a/src/views/meeting/list.vue b/src/views/meeting/list.vue index c5fc94c..9941261 100644 --- a/src/views/meeting/list.vue +++ b/src/views/meeting/list.vue @@ -1,67 +1,121 @@ <template> - <div ref="jitsiContainer" style="height: 100vh; width: 100%;"></div> +<!-- <div ref="jitsiContainer" style="height: 100vh; width: 100%;"></div>--> + <div> + <div id="meet"></div> +<!-- <el-button @click="Connect">鍔犲叆</el-button>--> + </div> + </template> <script> -import JitsiMeetJS from '@lyno/lib-jitsi-meet'; +import { JitsiMeet } from "@/utils/jitsi_meet"; import $ from 'jquery'; window.$ = $; export default { - props: { - domain: { - type: String, - default: '124.222.18.104:8443' - }, - options: { - type: Object, - default: () => ({}), - }, - }, + // props: { + // domain: { + // type: String, + // default: '124.222.18.104:8443' + // }, + // options: { + // type: Object, + // default: () => ({}), + // }, + // }, data () { return { jitsiApi: null, + userName:'寮犱笁', + roomName:'鎴块棿鍚�', + meet: { + clients: [], + }, }; }, mounted () { - JitsiMeetJS.init(); + // JitsiMeetJS.init(); + // const options = { + // serviceUrl:'https://124.222.18.104:8443/http-bind', + // hosts: { + // domain: 'https://124.222.18.104:8443/', + // muc: 'conference.meet.jit.si', + // }, + // bosh: 'https://124.222.18.104:8443/http-bind', + // useStunTurn: true + // } + const domain = '124.222.18.104:8443'; const options = { - serviceUrl:'https://124.222.18.104:8443/http-bind', - hosts: { - domain: 'https://124.222.18.104:8443/', - muc: 'conference.meet.jit.si', + roomName: this.roomName, + width: 1200, + height: 800, + parentNode: document.querySelector('#meet'), + configOverwrite: { + disableSsl: true }, - bosh: 'https://124.222.18.104:8443/http-bind', - useStunTurn: true - } - const connection = new JitsiMeetJS.JitsiConnection('123', null, options); + userInfo: {displayName: this.userName} + }; + // const connection = new JitsiMeetJS.JitsiConnection('123', null, options); + const api = new JitsiMeetExternalAPI(domain, options); - function onConnectionSuccess() { - console.log("onConnectionSuccess", arguments); - } - function onConnectionFailed() { - console.log("onConnectionFailed", arguments); - } - function disconnect() { - console.log("disconnect", arguments); - } - - connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess); - connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed); - connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, disconnect); - - connection.connect(undefined); - - - this.loadScript(`https://${this.domain}/external_api.js`, () => { - if (!window.JitsiMeetExternalAPI) throw new Error('Jitsi Meet External API not loaded'); - this.embedJitsiWidget(); + // this.meet = new JitsiMeet( + // //杩欓噷鏄湇鍔$鐨刋MPP鍦板潃 + // "https://124.222.18.104:8443/http-bind", + // this.name + // ); + api.addEventListeners({ + participantJoined: handleParticipantJoined, + participantLeft: handleParticipantLeft }); + + function handleParticipantJoined(event) { + console.log(`Participant joined: ${event.id}`); + console.log(event) + } + + function handleParticipantLeft(event) { + console.log(`Participant left: ${event.id}`); + console.log(event) + } + + // function onConnectionSuccess() { + // console.log("onConnectionSuccess", arguments); + // } + // function onConnectionFailed() { + // console.log("onConnectionFailed", arguments); + // } + // function disconnect() { + // console.log("disconnect", arguments); + // } + // + // connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess); + // connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed); + // connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, disconnect); + // + // connection.connect(undefined); + + + // this.loadScript(`https://${this.domain}/external_api.js`, () => { + // if (!window.JitsiMeetExternalAPI) throw new Error('Jitsi Meet External API not loaded'); + // this.embedJitsiWidget(); + // }); }, beforeDestroy () { + // this.Disconnect() this.removeJitsiWidget(); + }, methods: { + Connect() { + // 鍔犲叆鍚嶇О涓簒xx鐨勬埧闂达紙杩欎竴姝ヤ細鍒涘缓杩炴帴涓庢埧闂村璞★級 + this.meet.joinRoom("xxxx"); + // this.beInRoom = true; + }, + // Disconnect() { + // // 绂诲紑鎴块棿锛堣繖涓�姝ヤ細鏂紑杩炴帴锛� + // this.meet.leveRoom(); + // // this.beInRoom = false; + // }, loadScript (src, cb) { const scriptEl = document.createElement('script'); scriptEl.src = src; -- Gitblit v1.8.0