类型:开发

描述:
This commit is contained in:
2026-01-14 00:58:18 +08:00
parent ed5876c55b
commit 3aea6f740b

View File

@@ -385,16 +385,27 @@ const handleItemVideo = (url, type, code,item) => {
videoLog.value = 2 videoLog.value = 2
cameraIndexCode.value = code cameraIndexCode.value = code
setTimeout(() => { setTimeout(() => {
hlsRef = new Hls({ if (url.startsWith('http://192.168.77.200:8050/')) {
maxBufferLength: 10, // 最大缓冲长度(秒) hlsRef = new WebRTCWhep({
maxMaxBufferLength: 15, // 缓冲区长度的上限 url: url, // WHEP 服务器地址
maxBufferSize: 30 * 1000 * 1000 // 最大缓冲大小(字节) container: videoRef.value, // 视频播放容器
}) onError: (error) => {
hlsRef.loadSource(url) console.error('播放错误:', error)
hlsRef.attachMedia(videoRef.value) }
hlsRef.on(Hls.Events.MANIFEST_PARSED, () => { })
videoRef.value.play() } else {
}) hlsRef = new Hls({
maxBufferLength: 10, // 最大缓冲长度(秒)
maxMaxBufferLength: 15, // 缓冲区长度的上限
maxBufferSize: 30 * 1000 * 1000 // 最大缓冲大小(字节)
})
hlsRef.loadSource(url)
hlsRef.attachMedia(videoRef.value)
hlsRef.on(Hls.Events.MANIFEST_PARSED, () => {
videoRef.value.play()
})
}
if (type == 100) initVideo() if (type == 100) initVideo()
}, 1000) }, 1000)
} }