From 7eaf448740b8516b102ccf1f118de3bf0e2989d1 Mon Sep 17 00:00:00 2001 From: duoaohui <928970622@qq.com> Date: Sat, 23 May 2026 23:37:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BC=9A=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/cloud-law/video-call.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/cloud-law/video-call.vue b/frontend/src/pages/cloud-law/video-call.vue index 6b0e314..568e6c5 100644 --- a/frontend/src/pages/cloud-law/video-call.vue +++ b/frontend/src/pages/cloud-law/video-call.vue @@ -326,7 +326,7 @@ const debugLines = ref([]) const pushDebug = (msg) => { try { const line = `[${new Date().toLocaleTimeString()}] ${msg}` - debugLines.value = [...debugLines.value.slice(-9), line] + debugLines.value = [...debugLines.value.slice(-29), line] console.log('[CloudLawVideoCall][DEBUG]', line) } catch (e) { /* ignore */ } } @@ -392,9 +392,10 @@ const prepareLocalMediaTracks = async (startWithVideo) => { } // #ifdef H5 if (typeof navigator === 'undefined' || !navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) { - console.warn('[CloudLawVideoCall] navigator.mediaDevices 不可用,跳过预申请') + pushDebug('prepare: navigator.mediaDevices 不可用') return prefs } + pushDebug(`prepare -> getUserMedia(audio:true, video:${startWithVideo})`) try { const constraints = { audio: true, @@ -405,6 +406,7 @@ const prepareLocalMediaTracks = async (startWithVideo) => { const stream = await navigator.mediaDevices.getUserMedia(constraints) prefs.audioTrack = stream.getAudioTracks()[0] || null prefs.videoTrack = stream.getVideoTracks()[0] || null + pushDebug(`prepare 成功 audio=${!!prefs.audioTrack} video=${!!prefs.videoTrack}`) // 如果用户拒了视频,stream 里不会有 video track,自动降级为不开摄像头 if (startWithVideo && !prefs.videoTrack) { prefs.startVideo = false @@ -413,7 +415,7 @@ const prepareLocalMediaTracks = async (startWithVideo) => { prefs.startAudio = false } } catch (err) { - console.error('[CloudLawVideoCall] prepare media failed', err) + pushDebug(`prepare 失败: ${err?.name || ''} ${err?.message || err}`) localMediaError.value = `预申请音视频失败:${err?.name || ''} ${err?.message || err}` // 拿不到也继续走 joinAndEnter,让后端协议建好;用户可以在入会后手动点麦/摄像头按钮重试 prefs.startAudio = false