perf: 客户端会议优化

This commit is contained in:
Pang 2024-04-08 07:24:41 +08:00
parent 9390965a0c
commit c61815db3a
4 changed files with 39 additions and 17 deletions

View File

@ -55,7 +55,7 @@
"stylus-loader": "^7.1.0", "stylus-loader": "^7.1.0",
"tinymce": "^5.10.3", "tinymce": "^5.10.3",
"tui-calendar-hi": "^1.15.1-5", "tui-calendar-hi": "^1.15.1-5",
"view-design-hi": "^4.7.0-50", "view-design-hi": "^4.7.0-53",
"vite": "^2.9.15", "vite": "^2.9.15",
"vite-plugin-file-copy": "^1.0.0", "vite-plugin-file-copy": "^1.0.0",
"vite-plugin-require": "^1.1.10", "vite-plugin-require": "^1.1.10",

View File

@ -56,6 +56,7 @@
:transition-names="['', '']" :transition-names="['', '']"
:beforeClose="onClose" :beforeClose="onClose"
:class-name="`meeting-manager${meetingMini ? ' meeting-hidden' : ''}`" :class-name="`meeting-manager${meetingMini ? ' meeting-hidden' : ''}`"
:ignore-remove-last="meetingMini"
fullscreen> fullscreen>
<ul> <ul>
<li v-if="localUser.uid"> <li v-if="localUser.uid">
@ -398,28 +399,30 @@ export default {
AgoraRTC.onMicrophoneChanged = async (changedDevice) => { AgoraRTC.onMicrophoneChanged = async (changedDevice) => {
// When plugging in a device, switch to a device that is newly plugged in. // When plugging in a device, switch to a device that is newly plugged in.
if (changedDevice.state === "ACTIVE") { if (changedDevice.state === "ACTIVE") {
this.localUser.audioTrack.setDevice(changedDevice.device.deviceId); this.localUser.audioTrack?.setDevice(changedDevice.device.deviceId);
// Switch to an existing device when the current device is unplugged. // Switch to an existing device when the current device is unplugged.
} else if (changedDevice.device.label === this.localUser.audioTrack.getTrackLabel()) { } else if (changedDevice.device.label === this.localUser.audioTrack.getTrackLabel()) {
const oldMicrophones = await AgoraRTC.getMicrophones(); const oldMicrophones = await AgoraRTC.getMicrophones();
oldMicrophones[0] && this.localUser.audioTrack.setDevice(oldMicrophones[0].deviceId); oldMicrophones[0] && this.localUser.audioTrack?.setDevice(oldMicrophones[0].deviceId);
} }
} }
// //
AgoraRTC.onCameraChanged = async (changedDevice) => { AgoraRTC.onCameraChanged = async (changedDevice) => {
// When plugging in a device, switch to a device that is newly plugged in. // When plugging in a device, switch to a device that is newly plugged in.
if (changedDevice.state === "ACTIVE") { if (changedDevice.state === "ACTIVE") {
this.localUser.videoTrack.setDevice(changedDevice.device.deviceId); this.localUser.videoTrack?.setDevice(changedDevice.device.deviceId);
// Switch to an existing device when the current device is unplugged. // Switch to an existing device when the current device is unplugged.
} else if (changedDevice.device.label === this.localUser.videoTrack.getTrackLabel()) { } else if (changedDevice.device.label === this.localUser.videoTrack.getTrackLabel()) {
const oldCameras = await AgoraRTC.getCameras(); const oldCameras = await AgoraRTC.getCameras();
oldCameras[0] && this.localUser.videoTrack.setDevice(oldCameras[0].deviceId); oldCameras[0] && this.localUser.videoTrack?.setDevice(oldCameras[0].deviceId);
} }
} }
// //
AgoraRTC.onAutoplayFailed = () => { AgoraRTC.onAutoplayFailed = () => {
$A.messageWarning("点击屏幕开始会议"); $A.messageWarning("点击屏幕开始会议");
} }
//
AgoraRTC.setLogLevel(window.systemInfo.debug === "yes" ? 0 : 3);
// //
this.agoraClient = AgoraRTC.createClient({mode: "rtc", codec: "vp8"}); this.agoraClient = AgoraRTC.createClient({mode: "rtc", codec: "vp8"});

View File

@ -1,6 +1,11 @@
<template> <template>
<div class="meeting-player"> <div class="meeting-player">
<div :id="id" class="player" :style="playerStyle"></div> <div :id="id" class="player" :style="playerStyle"></div>
<ETooltip :disabled="$isEEUiApp || windowTouch || !username">
<div slot="content">
{{username}}
</div>
<div class="meeting-avatar">
<UserAvatar v-if="userid" :userid="userid" :size="36" :borderWitdh="2"/> <UserAvatar v-if="userid" :userid="userid" :size="36" :borderWitdh="2"/>
<div v-else-if="tourist.userimg" class="common-avatar avatar-wrapper"> <div v-else-if="tourist.userimg" class="common-avatar avatar-wrapper">
<div class="avatar-box online"> <div class="avatar-box online">
@ -8,6 +13,8 @@
<EAvatar :size="36" :src="tourist.userimg"></EAvatar> <EAvatar :size="36" :src="tourist.userimg"></EAvatar>
</div> </div>
</div> </div>
</div>
</ETooltip>
<div class="player-state"> <div class="player-state">
<i v-if="!audio" class="taskfont">&#xe7c7;</i> <i v-if="!audio" class="taskfont">&#xe7c7;</i>
<i v-if="!video" class="taskfont">&#xe7c8;</i> <i v-if="!video" class="taskfont">&#xe7c8;</i>
@ -71,6 +78,16 @@ export default {
} }
return 0 return 0
}, },
username() {
if (this.userid) {
const user = this.cacheUserBasic.find(({userid}) => userid == this.userid);
if (user) {
return user.nickname
}
return ''
}
return this.tourist.nickname || ''
},
playerStyle() { playerStyle() {
const user = this.cacheUserBasic.find(({userid}) => userid == this.userid); const user = this.cacheUserBasic.find(({userid}) => userid == this.userid);
if (user) { if (user) {

View File

@ -41,18 +41,20 @@ body {
margin-left: 8px; margin-left: 8px;
} }
} }
.common-avatar { .meeting-avatar {
position: absolute; position: absolute;
bottom: -8px; bottom: -8px;
right: -8px; right: -8px;
z-index: 2; z-index: 2;
} }
.avatar-box { .avatar-box {
em { em {
transform: scale(1.0625); transform: scale(1.0625);
} }
.el-avatar--circle { .el-avatar--circle {
border: 2px solid #FFFFFF; border: 1px solid #FFFFFF;
} }
} }
} }
@ -104,7 +106,7 @@ body.window-portrait {
padding: 6px 12px; padding: 6px 12px;
white-space: nowrap; white-space: nowrap;
border-radius: 4px; border-radius: 4px;
box-shadow: 0 0 50px rgba(0, 0, 0, 0.3); box-shadow: 0 0 3px rgba(45, 45, 45, 0.3);
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;