视频会议
This commit is contained in:
@@ -90,6 +90,11 @@
|
||||
<text class="control-label">麦克风{{ audioEnabled ? '已开' : '已关' }}</text>
|
||||
</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>
|
||||
</template>
|
||||
@@ -316,6 +321,16 @@ const startTimer = () => {
|
||||
|
||||
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 () => {
|
||||
if (joining.value) return
|
||||
const code = formattedCode.value
|
||||
@@ -436,70 +451,52 @@ const swapPrimaryTile = () => {
|
||||
}
|
||||
|
||||
const onMicToggle = async () => {
|
||||
console.log('[CloudLawVideoCall] onMicToggle clicked', {
|
||||
audioLoading: audioLoading.value,
|
||||
leaving: leaving.value,
|
||||
audioEnabled: audioEnabled.value,
|
||||
localAudioEnabled: meetingStore.localAudioEnabled,
|
||||
localProducerAudio: meetingStore.localProducers?.audio,
|
||||
isInMeeting: meetingStore.isInMeeting
|
||||
})
|
||||
pushDebug(`mic点击 loading=${audioLoading.value} leaving=${leaving.value} on=${audioEnabled.value} producer=${meetingStore.localProducers?.audio || 'null'}`)
|
||||
if (audioLoading.value || leaving.value) {
|
||||
console.warn('[CloudLawVideoCall] onMicToggle short-circuited by loading/leaving flag')
|
||||
pushDebug('mic 被 loading/leaving 拦住')
|
||||
return
|
||||
}
|
||||
audioLoading.value = true
|
||||
try {
|
||||
if (audioEnabled.value) {
|
||||
console.log('[CloudLawVideoCall] -> stopLocalAudio')
|
||||
pushDebug('mic -> stopLocalAudio')
|
||||
await meetingStore.stopLocalAudio()
|
||||
console.log('[CloudLawVideoCall] stopLocalAudio done')
|
||||
pushDebug('mic stop 完成')
|
||||
} else {
|
||||
console.log('[CloudLawVideoCall] -> startLocalAudio')
|
||||
pushDebug('mic -> startLocalAudio')
|
||||
await meetingStore.startLocalAudio()
|
||||
console.log('[CloudLawVideoCall] startLocalAudio done, localAudioEnabled =', meetingStore.localAudioEnabled)
|
||||
pushDebug(`mic start 完成 enabled=${meetingStore.localAudioEnabled}`)
|
||||
localMediaError.value = ''
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('[CloudLawVideoCall] mic toggle failed', err)
|
||||
const msg = err?.message || '麦克风操作失败'
|
||||
localMediaError.value = `麦克风:${msg}`
|
||||
uni.showModal({ title: '麦克风操作失败', content: msg, showCancel: false })
|
||||
pushDebug(`mic 报错: ${err?.name || ''} ${err?.message || err}`)
|
||||
localMediaError.value = `麦克风:${err?.message || err}`
|
||||
} finally {
|
||||
audioLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const onCamToggle = async () => {
|
||||
console.log('[CloudLawVideoCall] onCamToggle clicked', {
|
||||
videoLoading: videoLoading.value,
|
||||
leaving: leaving.value,
|
||||
videoEnabled: videoEnabled.value,
|
||||
localVideoEnabled: meetingStore.localVideoEnabled,
|
||||
localProducerVideo: meetingStore.localProducers?.video,
|
||||
isInMeeting: meetingStore.isInMeeting
|
||||
})
|
||||
pushDebug(`cam点击 loading=${videoLoading.value} leaving=${leaving.value} on=${videoEnabled.value} producer=${meetingStore.localProducers?.video || 'null'}`)
|
||||
if (videoLoading.value || leaving.value) {
|
||||
console.warn('[CloudLawVideoCall] onCamToggle short-circuited by loading/leaving flag')
|
||||
pushDebug('cam 被 loading/leaving 拦住')
|
||||
return
|
||||
}
|
||||
videoLoading.value = true
|
||||
try {
|
||||
if (videoEnabled.value) {
|
||||
console.log('[CloudLawVideoCall] -> stopLocalVideo')
|
||||
pushDebug('cam -> stopLocalVideo')
|
||||
await meetingStore.stopLocalVideo()
|
||||
console.log('[CloudLawVideoCall] stopLocalVideo done')
|
||||
pushDebug('cam stop 完成')
|
||||
} else {
|
||||
console.log('[CloudLawVideoCall] -> startLocalVideo')
|
||||
pushDebug('cam -> startLocalVideo')
|
||||
await meetingStore.startLocalVideo()
|
||||
console.log('[CloudLawVideoCall] startLocalVideo done, localVideoEnabled =', meetingStore.localVideoEnabled)
|
||||
pushDebug(`cam start 完成 enabled=${meetingStore.localVideoEnabled}`)
|
||||
localMediaError.value = ''
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('[CloudLawVideoCall] cam toggle failed', err)
|
||||
const msg = err?.message || '摄像头操作失败'
|
||||
localMediaError.value = `摄像头:${msg}`
|
||||
uni.showModal({ title: '摄像头操作失败', content: msg, showCancel: false })
|
||||
pushDebug(`cam 报错: ${err?.name || ''} ${err?.message || err}`)
|
||||
localMediaError.value = `摄像头:${err?.message || err}`
|
||||
} finally {
|
||||
videoLoading.value = false
|
||||
}
|
||||
@@ -889,4 +886,24 @@ onUnload(() => {
|
||||
.clean-video-tile :deep(.tag-host) {
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user