视频会议
This commit is contained in:
@@ -326,7 +326,7 @@ const debugLines = ref([])
|
|||||||
const pushDebug = (msg) => {
|
const pushDebug = (msg) => {
|
||||||
try {
|
try {
|
||||||
const line = `[${new Date().toLocaleTimeString()}] ${msg}`
|
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)
|
console.log('[CloudLawVideoCall][DEBUG]', line)
|
||||||
} catch (e) { /* ignore */ }
|
} catch (e) { /* ignore */ }
|
||||||
}
|
}
|
||||||
@@ -392,9 +392,10 @@ const prepareLocalMediaTracks = async (startWithVideo) => {
|
|||||||
}
|
}
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if (typeof navigator === 'undefined' || !navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
|
if (typeof navigator === 'undefined' || !navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
|
||||||
console.warn('[CloudLawVideoCall] navigator.mediaDevices 不可用,跳过预申请')
|
pushDebug('prepare: navigator.mediaDevices 不可用')
|
||||||
return prefs
|
return prefs
|
||||||
}
|
}
|
||||||
|
pushDebug(`prepare -> getUserMedia(audio:true, video:${startWithVideo})`)
|
||||||
try {
|
try {
|
||||||
const constraints = {
|
const constraints = {
|
||||||
audio: true,
|
audio: true,
|
||||||
@@ -405,6 +406,7 @@ const prepareLocalMediaTracks = async (startWithVideo) => {
|
|||||||
const stream = await navigator.mediaDevices.getUserMedia(constraints)
|
const stream = await navigator.mediaDevices.getUserMedia(constraints)
|
||||||
prefs.audioTrack = stream.getAudioTracks()[0] || null
|
prefs.audioTrack = stream.getAudioTracks()[0] || null
|
||||||
prefs.videoTrack = stream.getVideoTracks()[0] || null
|
prefs.videoTrack = stream.getVideoTracks()[0] || null
|
||||||
|
pushDebug(`prepare 成功 audio=${!!prefs.audioTrack} video=${!!prefs.videoTrack}`)
|
||||||
// 如果用户拒了视频,stream 里不会有 video track,自动降级为不开摄像头
|
// 如果用户拒了视频,stream 里不会有 video track,自动降级为不开摄像头
|
||||||
if (startWithVideo && !prefs.videoTrack) {
|
if (startWithVideo && !prefs.videoTrack) {
|
||||||
prefs.startVideo = false
|
prefs.startVideo = false
|
||||||
@@ -413,7 +415,7 @@ const prepareLocalMediaTracks = async (startWithVideo) => {
|
|||||||
prefs.startAudio = false
|
prefs.startAudio = false
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[CloudLawVideoCall] prepare media failed', err)
|
pushDebug(`prepare 失败: ${err?.name || ''} ${err?.message || err}`)
|
||||||
localMediaError.value = `预申请音视频失败:${err?.name || ''} ${err?.message || err}`
|
localMediaError.value = `预申请音视频失败:${err?.name || ''} ${err?.message || err}`
|
||||||
// 拿不到也继续走 joinAndEnter,让后端协议建好;用户可以在入会后手动点麦/摄像头按钮重试
|
// 拿不到也继续走 joinAndEnter,让后端协议建好;用户可以在入会后手动点麦/摄像头按钮重试
|
||||||
prefs.startAudio = false
|
prefs.startAudio = false
|
||||||
|
|||||||
Reference in New Issue
Block a user