|
@@ -13,15 +13,14 @@ const live_url = computed(() => localStorage.getItem('live_url'))
|
|
|
const live_token = computed(() => localStorage.getItem('live_token'))
|
|
const live_token = computed(() => localStorage.getItem('live_token'))
|
|
|
const live_yhid = computed(() => localStorage.getItem('live_yhid'))
|
|
const live_yhid = computed(() => localStorage.getItem('live_yhid'))
|
|
|
const live_hyid = computed(() => localStorage.getItem('live_hyid'))
|
|
const live_hyid = computed(() => localStorage.getItem('live_hyid'))
|
|
|
-const isClient = window.electron
|
|
|
|
|
const inviteShow = ref(false)
|
|
const inviteShow = ref(false)
|
|
|
const expanded = ref([1])
|
|
const expanded = ref([1])
|
|
|
const chatShow = ref(false)
|
|
const chatShow = ref(false)
|
|
|
const localVideoDom = ref()
|
|
const localVideoDom = ref()
|
|
|
-const VideoDomList = ref([] as Any)
|
|
|
|
|
|
|
+const VideoDomList = ref([] as any)
|
|
|
const encoder = new TextEncoder()
|
|
const encoder = new TextEncoder()
|
|
|
const decoder = new TextDecoder()
|
|
const decoder = new TextDecoder()
|
|
|
-const msgData = ref([])
|
|
|
|
|
|
|
+const msgData = ref([] as any)
|
|
|
const currentClick = ref(0)
|
|
const currentClick = ref(0)
|
|
|
|
|
|
|
|
apiService.getMettingPep({ yhid: live_yhid.value, hyid: live_hyid.value }).then(({ data }) => {
|
|
apiService.getMettingPep({ yhid: live_yhid.value, hyid: live_hyid.value }).then(({ data }) => {
|
|
@@ -41,11 +40,11 @@ const videoCallRoom: Room | null = new Room()
|
|
|
.on(RoomEvent.ParticipantConnected, onRemoteJoin)
|
|
.on(RoomEvent.ParticipantConnected, onRemoteJoin)
|
|
|
.on(RoomEvent.ParticipantDisconnected, onRemoteLeave)
|
|
.on(RoomEvent.ParticipantDisconnected, onRemoteLeave)
|
|
|
.on(RoomEvent.LocalTrackPublished, onLocalTrack)
|
|
.on(RoomEvent.LocalTrackPublished, onLocalTrack)
|
|
|
- .on(RoomEvent.DataReceived, onDataReceived)
|
|
|
|
|
|
|
+ .on(RoomEvent.DataReceived, onDataReceived as any)
|
|
|
|
|
|
|
|
function onConnect() {
|
|
function onConnect() {
|
|
|
- console.log('房间已连接', videoCallRoom.participants);
|
|
|
|
|
- videoCallRoom.participants.forEach(el => {
|
|
|
|
|
|
|
+ console.log('房间已连接', videoCallRoom?.participants);
|
|
|
|
|
+ videoCallRoom?.participants.forEach(el => {
|
|
|
const _index = VideoDomList.value.findIndex(es => es.id == el.identity)
|
|
const _index = VideoDomList.value.findIndex(es => es.id == el.identity)
|
|
|
if (_index >= 0) {
|
|
if (_index >= 0) {
|
|
|
VideoDomList.value[_index].isJoin = true
|
|
VideoDomList.value[_index].isJoin = true
|
|
@@ -61,7 +60,7 @@ function onLocalTrack(localTrackPublication: LocalTrackPublication, localPartici
|
|
|
VideoDomList.value[0].audio = true
|
|
VideoDomList.value[0].audio = true
|
|
|
VideoDomList.value[0].tracks.push(localTrackPublication.track)
|
|
VideoDomList.value[0].tracks.push(localTrackPublication.track)
|
|
|
const dom = document.getElementById('remote_' + VideoDomList.value[0].id) as HTMLVideoElement
|
|
const dom = document.getElementById('remote_' + VideoDomList.value[0].id) as HTMLVideoElement
|
|
|
- if (localTrackPublication.kind === 'video') localTrackPublication.track.attach(dom)
|
|
|
|
|
|
|
+ if (localTrackPublication.kind === 'video') localTrackPublication.track?.attach(dom)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 监听远程流
|
|
// 监听远程流
|
|
@@ -141,7 +140,7 @@ async function roomConnect(url: string, token: string) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 切换
|
|
// 切换
|
|
|
-function fnEvent(type: number, item?: Any) {
|
|
|
|
|
|
|
+function fnEvent(type: number, item?: any) {
|
|
|
if (type === 3) {
|
|
if (type === 3) {
|
|
|
inviteShow.value = true
|
|
inviteShow.value = true
|
|
|
} else if (type === 4 || type === 5) {
|
|
} else if (type === 4 || type === 5) {
|
|
@@ -164,7 +163,7 @@ function fnEvent(type: number, item?: Any) {
|
|
|
item.audio = !item.audio
|
|
item.audio = !item.audio
|
|
|
} else if (type === 2) {
|
|
} else if (type === 2) {
|
|
|
const data = encoder.encode(item)
|
|
const data = encoder.encode(item)
|
|
|
- if (videoCallRoom.state === 'connected') {
|
|
|
|
|
|
|
+ if (videoCallRoom?.state === 'connected') {
|
|
|
videoCallRoom.localParticipant.publishData(data, DataPacket_Kind.RELIABLE)
|
|
videoCallRoom.localParticipant.publishData(data, DataPacket_Kind.RELIABLE)
|
|
|
const { yhtx } = VideoDomList.value.find(el => el.yhid == live_yhid.value) || { yhtx: '' }
|
|
const { yhtx } = VideoDomList.value.find(el => el.yhid == live_yhid.value) || { yhtx: '' }
|
|
|
const obj = {
|
|
const obj = {
|
|
@@ -184,13 +183,13 @@ function close() {
|
|
|
videoCallRoom!.localParticipant.setMicrophoneEnabled(false)
|
|
videoCallRoom!.localParticipant.setMicrophoneEnabled(false)
|
|
|
videoCallRoom!.disconnect()
|
|
videoCallRoom!.disconnect()
|
|
|
localVideoDom.value = null
|
|
localVideoDom.value = null
|
|
|
- window.electron?.send('closeMetting')
|
|
|
|
|
console.log('断开连接')
|
|
console.log('断开连接')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 最小化
|
|
// 最小化
|
|
|
function minus() {
|
|
function minus() {
|
|
|
- window.electron?.send('minusMetting')
|
|
|
|
|
|
|
+ console.log('最小化');
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// init
|
|
// init
|