视频会议

This commit is contained in:
duoaohui
2026-05-23 22:34:31 +08:00
parent c17cd836b2
commit 52c074e372

View File

@@ -90,6 +90,11 @@
<text class="control-label">麦克风{{ audioEnabled ? '已开' : '已关' }}</text> <text class="control-label">麦克风{{ audioEnabled ? '已开' : '已关' }}</text>
</view> </view>
</view> </view>
<!-- 屏幕可见的调试浮层小程序 WebView 看不到 console先用这个排查按钮无反应问题 -->
<view v-if="debugLines.length" class="debug-panel">
<view class="debug-line" v-for="(line, idx) in debugLines" :key="idx">{{ line }}</view>
</view>
</view> </view>
</view> </view>
</template> </template>
@@ -316,6 +321,16 @@ const startTimer = () => {
const localMediaError = ref('') const localMediaError = ref('')
// 屏幕可见的调试日志(小程序 WebView 没法看 console
const debugLines = ref([])
const pushDebug = (msg) => {
try {
const line = `[${new Date().toLocaleTimeString()}] ${msg}`
debugLines.value = [...debugLines.value.slice(-9), line]
console.log('[CloudLawVideoCall][DEBUG]', line)
} catch (e) { /* ignore */ }
}
const joinMeeting = async () => { const joinMeeting = async () => {
if (joining.value) return if (joining.value) return
const code = formattedCode.value const code = formattedCode.value
@@ -436,70 +451,52 @@ const swapPrimaryTile = () => {
} }
const onMicToggle = async () => { const onMicToggle = async () => {
console.log('[CloudLawVideoCall] onMicToggle clicked', { pushDebug(`mic点击 loading=${audioLoading.value} leaving=${leaving.value} on=${audioEnabled.value} producer=${meetingStore.localProducers?.audio || 'null'}`)
audioLoading: audioLoading.value,
leaving: leaving.value,
audioEnabled: audioEnabled.value,
localAudioEnabled: meetingStore.localAudioEnabled,
localProducerAudio: meetingStore.localProducers?.audio,
isInMeeting: meetingStore.isInMeeting
})
if (audioLoading.value || leaving.value) { if (audioLoading.value || leaving.value) {
console.warn('[CloudLawVideoCall] onMicToggle short-circuited by loading/leaving flag') pushDebug('mic 被 loading/leaving 拦住')
return return
} }
audioLoading.value = true audioLoading.value = true
try { try {
if (audioEnabled.value) { if (audioEnabled.value) {
console.log('[CloudLawVideoCall] -> stopLocalAudio') pushDebug('mic -> stopLocalAudio')
await meetingStore.stopLocalAudio() await meetingStore.stopLocalAudio()
console.log('[CloudLawVideoCall] stopLocalAudio done') pushDebug('mic stop 完成')
} else { } else {
console.log('[CloudLawVideoCall] -> startLocalAudio') pushDebug('mic -> startLocalAudio')
await meetingStore.startLocalAudio() await meetingStore.startLocalAudio()
console.log('[CloudLawVideoCall] startLocalAudio done, localAudioEnabled =', meetingStore.localAudioEnabled) pushDebug(`mic start 完成 enabled=${meetingStore.localAudioEnabled}`)
localMediaError.value = '' localMediaError.value = ''
} }
} catch (err) { } catch (err) {
console.error('[CloudLawVideoCall] mic toggle failed', err) pushDebug(`mic 报错: ${err?.name || ''} ${err?.message || err}`)
const msg = err?.message || '麦克风操作失败' localMediaError.value = `麦克风:${err?.message || err}`
localMediaError.value = `麦克风:${msg}`
uni.showModal({ title: '麦克风操作失败', content: msg, showCancel: false })
} finally { } finally {
audioLoading.value = false audioLoading.value = false
} }
} }
const onCamToggle = async () => { const onCamToggle = async () => {
console.log('[CloudLawVideoCall] onCamToggle clicked', { pushDebug(`cam点击 loading=${videoLoading.value} leaving=${leaving.value} on=${videoEnabled.value} producer=${meetingStore.localProducers?.video || 'null'}`)
videoLoading: videoLoading.value,
leaving: leaving.value,
videoEnabled: videoEnabled.value,
localVideoEnabled: meetingStore.localVideoEnabled,
localProducerVideo: meetingStore.localProducers?.video,
isInMeeting: meetingStore.isInMeeting
})
if (videoLoading.value || leaving.value) { if (videoLoading.value || leaving.value) {
console.warn('[CloudLawVideoCall] onCamToggle short-circuited by loading/leaving flag') pushDebug('cam 被 loading/leaving 拦住')
return return
} }
videoLoading.value = true videoLoading.value = true
try { try {
if (videoEnabled.value) { if (videoEnabled.value) {
console.log('[CloudLawVideoCall] -> stopLocalVideo') pushDebug('cam -> stopLocalVideo')
await meetingStore.stopLocalVideo() await meetingStore.stopLocalVideo()
console.log('[CloudLawVideoCall] stopLocalVideo done') pushDebug('cam stop 完成')
} else { } else {
console.log('[CloudLawVideoCall] -> startLocalVideo') pushDebug('cam -> startLocalVideo')
await meetingStore.startLocalVideo() await meetingStore.startLocalVideo()
console.log('[CloudLawVideoCall] startLocalVideo done, localVideoEnabled =', meetingStore.localVideoEnabled) pushDebug(`cam start 完成 enabled=${meetingStore.localVideoEnabled}`)
localMediaError.value = '' localMediaError.value = ''
} }
} catch (err) { } catch (err) {
console.error('[CloudLawVideoCall] cam toggle failed', err) pushDebug(`cam 报错: ${err?.name || ''} ${err?.message || err}`)
const msg = err?.message || '摄像头操作失败' localMediaError.value = `摄像头:${err?.message || err}`
localMediaError.value = `摄像头:${msg}`
uni.showModal({ title: '摄像头操作失败', content: msg, showCancel: false })
} finally { } finally {
videoLoading.value = false videoLoading.value = false
} }
@@ -889,4 +886,24 @@ onUnload(() => {
.clean-video-tile :deep(.tag-host) { .clean-video-tile :deep(.tag-host) {
display: none; display: none;
} }
/* 屏幕调试浮层 */
.debug-panel {
position: absolute;
left: 12rpx;
right: 12rpx;
bottom: calc(560rpx + env(safe-area-inset-bottom));
z-index: 99;
max-height: 360rpx;
overflow: auto;
background: rgba(0, 0, 0, 0.72);
color: #b6f8ff;
font-size: 22rpx;
line-height: 1.45;
padding: 12rpx 16rpx;
border-radius: 12rpx;
pointer-events: none;
}
.debug-line {
word-break: break-all;
}
</style> </style>