视频会议

This commit is contained in:
duoaohui
2026-05-23 21:26:52 +08:00
parent ea7cd1edbd
commit a8db973411
2 changed files with 14 additions and 3 deletions

View File

@@ -37,7 +37,7 @@
</template> </template>
<script setup> <script setup>
import { ref, computed, watch, onBeforeUnmount, nextTick } from 'vue' import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue'
const props = defineProps({ const props = defineProps({
userId: { type: [Number, String], required: true }, userId: { type: [Number, String], required: true },
@@ -156,6 +156,17 @@ const applyAudio = () => {
watch(() => [props.videoTrack, props.videoEnabled], () => nextTick(applyVideo), { immediate: true }) watch(() => [props.videoTrack, props.videoEnabled], () => nextTick(applyVideo), { immediate: true })
watch(() => [props.audioTrack, props.audioEnabled, props.isLocal], () => nextTick(applyAudio), { immediate: true }) watch(() => [props.audioTrack, props.audioEnabled, props.isLocal], () => nextTick(applyAudio), { immediate: true })
// 修复刚进入会议时画面不显示问题:
// watch 的 immediate:true 在 setup 阶段就触发 applyVideo此时 mediaBox ref 尚未绑定真实 DOM
// 即便包了 nextTick在 uni-h5 偶发条件下仍可能命中 ref 未就绪,导致 srcObject 没贴上。
// 这里在 onMounted 里再补一次绑定,确保 DOM ready 后必然挂上 track。
onMounted(() => {
nextTick(() => {
applyVideo()
applyAudio()
})
})
onBeforeUnmount(() => { onBeforeUnmount(() => {
removeMediaEl('video') removeMediaEl('video')
removeMediaEl('audio') removeMediaEl('audio')

View File

@@ -816,8 +816,8 @@ onUnload(() => {
box-shadow: 0 14rpx 36rpx rgba(255, 47, 63, 0.38); box-shadow: 0 14rpx 36rpx rgba(255, 47, 63, 0.38);
} }
.control-image { .control-image {
width: 170rpx; width: 150rpx;
height: 170rpx; height: 150rpx;
} }
.dark-btn .control-image { .dark-btn .control-image {
width: 108rpx; width: 108rpx;