mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-24 19:28:11 +00:00
perf: 优化会议聊天
This commit is contained in:
parent
eacc3cc6ef
commit
b0cf3ef560
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "DooTask",
|
"name": "DooTask",
|
||||||
"version": "0.20.62",
|
"version": "0.20.63",
|
||||||
"description": "DooTask is task management system.",
|
"description": "DooTask is task management system.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "./cmd dev",
|
"start": "./cmd dev",
|
||||||
|
|||||||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
c247bcc6ba47c5af
|
d87ef1f64cc18b40
|
||||||
|
|||||||
@ -806,8 +806,8 @@
|
|||||||
"/js/build/904.js": "/js/build/904.js",
|
"/js/build/904.js": "/js/build/904.js",
|
||||||
"/js/build/920.js": "/js/build/920.js",
|
"/js/build/920.js": "/js/build/920.js",
|
||||||
"/js/build/920.js.LICENSE.txt": "/js/build/920.js.LICENSE.txt",
|
"/js/build/920.js.LICENSE.txt": "/js/build/920.js.LICENSE.txt",
|
||||||
"/js/build/939.js": "/js/build/939.js",
|
"/js/build/937.js": "/js/build/937.js",
|
||||||
"/js/build/939.js.LICENSE.txt": "/js/build/939.js.LICENSE.txt",
|
"/js/build/937.js.LICENSE.txt": "/js/build/937.js.LICENSE.txt",
|
||||||
"/js/build/947.js": "/js/build/947.js",
|
"/js/build/947.js": "/js/build/947.js",
|
||||||
"/js/emoji.all.js": "/js/emoji.all.js",
|
"/js/emoji.all.js": "/js/emoji.all.js",
|
||||||
"/js/emoticon.all.js": "/js/emoticon.all.js",
|
"/js/emoticon.all.js": "/js/emoticon.all.js",
|
||||||
|
|||||||
@ -54,10 +54,10 @@
|
|||||||
fullscreen>
|
fullscreen>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-if="localUser.uid">
|
<li v-if="localUser.uid">
|
||||||
<MeetingPlayer :ref="`meeting_${localUser.uid}`" :player="localUser"/>
|
<MeetingPlayer :player="localUser" :mediaType="localUser.mediaType"/>
|
||||||
</li>
|
</li>
|
||||||
<li v-for="user in remoteUsers">
|
<li v-for="user in remoteUsers">
|
||||||
<MeetingPlayer :ref="`meeting_${user.uid}`" :player="user"/>
|
<MeetingPlayer :player="user" :mediaType="user.mediaType"/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div slot="footer" class="adaption meeting-button-group">
|
<div slot="footer" class="adaption meeting-button-group">
|
||||||
@ -118,7 +118,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import UserInput from "../../../components/UserInput";
|
import UserInput from "../../../components/UserInput";
|
||||||
import {Store} from "le5le-store";
|
import {Store} from "le5le-store";
|
||||||
import {mapState} from "vuex";
|
|
||||||
import MeetingPlayer from "./MeetingPlayer";
|
import MeetingPlayer from "./MeetingPlayer";
|
||||||
import DragBallComponent from "../../../components/DragBallComponent";
|
import DragBallComponent from "../../../components/DragBallComponent";
|
||||||
|
|
||||||
@ -149,11 +148,11 @@ export default {
|
|||||||
|
|
||||||
agoraClient: null,
|
agoraClient: null,
|
||||||
remoteUsers: [],
|
remoteUsers: [],
|
||||||
readyPlay: [],
|
|
||||||
localUser: {
|
localUser: {
|
||||||
uid: null,
|
uid: null,
|
||||||
audioTrack: null,
|
audioTrack: null,
|
||||||
videoTrack: null,
|
videoTrack: null,
|
||||||
|
mediaType: null
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -344,23 +343,16 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.addData.tracks.includes("video")) {
|
if (this.addData.tracks.includes("video")) {
|
||||||
localTracks.push(this.localUser.videoTrack = await AgoraRTC.createCameraVideoTrack())
|
localTracks.push(this.localUser.videoTrack = await AgoraRTC.createCameraVideoTrack())
|
||||||
|
this.$set(this.localUser, 'mediaType', 'video')
|
||||||
}
|
}
|
||||||
// 将本地视频曲目播放到本地浏览器、将本地音频和视频发布到频道。
|
// 将本地视频曲目播放到本地浏览器、将本地音频和视频发布到频道。
|
||||||
if (localTracks.length > 0) {
|
if (localTracks.length > 0) {
|
||||||
await this.agoraClient.publish(localTracks);
|
await this.agoraClient.publish(localTracks);
|
||||||
}
|
}
|
||||||
// 显示会议窗口后再调用播放
|
//
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
this.addShow = false;
|
this.addShow = false;
|
||||||
this.meetingShow = true;
|
this.meetingShow = true;
|
||||||
this.$nextTick(_ => {
|
|
||||||
if (this.addData.tracks.includes("video")) {
|
|
||||||
this.$refs[`meeting_${this.localUser.uid}`].play('video')
|
|
||||||
}
|
|
||||||
this.readyPlay.forEach(item => {
|
|
||||||
this.$refs[`meeting_${item.uid}`][0].play(item.mediaType)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async leave() {
|
async leave() {
|
||||||
@ -406,7 +398,7 @@ export default {
|
|||||||
if (this.videoLoad || this.localUser.videoTrack) return;
|
if (this.videoLoad || this.localUser.videoTrack) return;
|
||||||
this.videoLoad = true;
|
this.videoLoad = true;
|
||||||
this.localUser.videoTrack = await AgoraRTC.createCameraVideoTrack()
|
this.localUser.videoTrack = await AgoraRTC.createCameraVideoTrack()
|
||||||
this.$refs[`meeting_${this.localUser.uid}`].play('video');
|
this.$set(this.localUser, 'mediaType', 'video')
|
||||||
await this.agoraClient.publish([this.localUser.videoTrack]);
|
await this.agoraClient.publish([this.localUser.videoTrack]);
|
||||||
this.videoLoad = false;
|
this.videoLoad = false;
|
||||||
},
|
},
|
||||||
@ -418,10 +410,12 @@ export default {
|
|||||||
this.localUser.videoTrack.stop();
|
this.localUser.videoTrack.stop();
|
||||||
this.localUser.videoTrack.close();
|
this.localUser.videoTrack.close();
|
||||||
this.localUser.videoTrack = null;
|
this.localUser.videoTrack = null;
|
||||||
|
this.$set(this.localUser, 'mediaType', null)
|
||||||
this.videoLoad = false;
|
this.videoLoad = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
async handleUserJoined(user) {
|
async handleUserJoined(user) {
|
||||||
|
this.$set(user, 'mediaType', null)
|
||||||
const index = this.remoteUsers.findIndex(item => item.uid == user.uid)
|
const index = this.remoteUsers.findIndex(item => item.uid == user.uid)
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.remoteUsers.splice(index, 1, user)
|
this.remoteUsers.splice(index, 1, user)
|
||||||
@ -438,21 +432,18 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async handleUserPublished(user, mediaType) {
|
async handleUserPublished(user, mediaType) {
|
||||||
const index = this.remoteUsers.findIndex(item => item.uid == user.uid)
|
const item = this.remoteUsers.find(item => item.uid == user.uid)
|
||||||
if (index > -1) {
|
if (item) {
|
||||||
await this.agoraClient.subscribe(user, mediaType);
|
await this.agoraClient.subscribe(user, mediaType);
|
||||||
if (this.$refs[`meeting_${user.uid}`]) {
|
this.$set(item, 'mediaType', mediaType)
|
||||||
this.$refs[`meeting_${user.uid}`][0].play(mediaType)
|
|
||||||
} else {
|
|
||||||
this.readyPlay.push({uid: user.uid, mediaType})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async handleUserUnpublished(user, mediaType) {
|
async handleUserUnpublished(user, mediaType) {
|
||||||
const index = this.remoteUsers.findIndex(item => item.uid == user.uid)
|
const item = this.remoteUsers.find(item => item.uid == user.uid)
|
||||||
if (index > -1) {
|
if (item) {
|
||||||
await this.agoraClient.unsubscribe(user, mediaType);
|
await this.agoraClient.unsubscribe(user, mediaType);
|
||||||
|
item.mediaType = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="userid" class="meeting-player">
|
<div v-if="userid" class="meeting-player">
|
||||||
<div :id="id" class="player" :style="playerStyle"></div>
|
<div :id="id" class="player" :style="playerStyle"></div>
|
||||||
|
AA{{mediaType}}BB
|
||||||
<UserAvatar :userid="userid" :size="36" :borderWitdh="2"/>
|
<UserAvatar :userid="userid" :size="36" :borderWitdh="2"/>
|
||||||
<div class="player-state">
|
<div class="player-state">
|
||||||
<i v-if="!audio" class="taskfont"></i>
|
<i v-if="!audio" class="taskfont"></i>
|
||||||
@ -24,6 +25,11 @@ export default {
|
|||||||
},
|
},
|
||||||
player: {
|
player: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
mediaType: {
|
||||||
|
type: String,
|
||||||
|
default: ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -55,12 +61,26 @@ export default {
|
|||||||
return !!this.player.videoTrack
|
return !!this.player.videoTrack
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
mediaType: {
|
||||||
|
handler(type) {
|
||||||
|
this.$nextTick(_ => {
|
||||||
|
this.play(type)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
play(type) {
|
play(type) {
|
||||||
if (type === 'audio') {
|
try {
|
||||||
this.player.audioTrack?.play();
|
if (type === 'audio') {
|
||||||
} else if (type === 'video') {
|
this.player.audioTrack.play();
|
||||||
this.player.videoTrack?.play(this.id);
|
} else if (type === 'video') {
|
||||||
|
this.player.videoTrack.play(this.id);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Meeting Player Error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit c05b24649b887df0480dfeeba70a489f210bbb07
|
Subproject commit 1d124313757d838f25fa306c626af49283badf49
|
||||||
Loading…
x
Reference in New Issue
Block a user