CRM_26-08-05#story#9126,车辆管理、服务商管理系统需求
This commit is contained in:
@@ -192,6 +192,8 @@ export default {
|
||||
return
|
||||
}
|
||||
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()
|
||||
const video = this.$refs.video
|
||||
if (video) {
|
||||
@@ -200,14 +202,37 @@ export default {
|
||||
video.setAttribute('playsinline', 'true')
|
||||
video.setAttribute('webkit-playsinline', 'true')
|
||||
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 = () => {
|
||||
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) {
|
||||
playVideo()
|
||||
} else {
|
||||
video.onloadedmetadata = playVideo
|
||||
}
|
||||
// 2 秒后再看一次:currentTime 是否增长(判断是真在播还是黑屏死流)
|
||||
setTimeout(() => logVideoState('after 2s'), 2000)
|
||||
}
|
||||
} catch (e) {
|
||||
// 权限拒绝或相机不可用 → 通知父组件降级为系统选择器
|
||||
|
||||
Reference in New Issue
Block a user