CRM_26-08-05#story#9126,车辆管理、服务商管理系统需求

This commit is contained in:
zlf
2026-08-05 09:44:28 +08:00
parent 68fc21992b
commit c9f5296e3c
+28 -3
View File
@@ -192,6 +192,8 @@ export default {
return return
} }
this.activeStream = stream this.activeStream = stream
console.log('[CameraGuide] stream acquired, 来源:', this.stream ? '父组件复用' : '组件自申请', 'active:', stream.active,
'tracks:', stream.getTracks().map(t => `${t.kind}/${t.readyState}/enabled:${t.enabled}`))
await this.$nextTick() await this.$nextTick()
const video = this.$refs.video const video = this.$refs.video
if (video) { if (video) {
@@ -200,14 +202,37 @@ export default {
video.setAttribute('playsinline', 'true') video.setAttribute('playsinline', 'true')
video.setAttribute('webkit-playsinline', 'true') video.setAttribute('webkit-playsinline', 'true')
video.srcObject = stream video.srcObject = stream
const logVideoState = (tag) => {
console.log(`[CameraGuide] ${tag}:`,
'paused:', video.paused,
'readyState:', video.readyState,
'currentTime:', video.currentTime,
'videoWidth:', video.videoWidth,
'videoHeight:', video.videoHeight,
'streamActive:', stream.active,
'muted:', video.muted)
}
const playVideo = () => { const playVideo = () => {
video.play().catch(e => console.warn('video play error:', e && (e.name || e.message || e))) video.play()
.then(() => logVideoState('play resolved'))
.catch(e => {
console.warn('[CameraGuide] video play error:', e && (e.name || e.message || e))
logVideoState('play rejected')
})
}
video.onloadedmetadata = () => {
logVideoState('loadedmetadata')
playVideo()
}
video.onplaying = () => logVideoState('playing')
video.onerror = () => {
console.warn('[CameraGuide] video element error:', video.error && `${video.error.code}/${video.error.message}`)
} }
if (video.readyState >= 1) { if (video.readyState >= 1) {
playVideo() playVideo()
} else {
video.onloadedmetadata = playVideo
} }
// 2 秒后再看一次:currentTime 是否增长(判断是真在播还是黑屏死流)
setTimeout(() => logVideoState('after 2s'), 2000)
} }
} catch (e) { } catch (e) {
// 权限拒绝或相机不可用 → 通知父组件降级为系统选择器 // 权限拒绝或相机不可用 → 通知父组件降级为系统选择器