mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-03-29 22:56:45 +08:00
fix(web): 修复 WebRTC 首帧状态与视频状态判定
This commit is contained in:
@@ -71,14 +71,14 @@ fn rebuild_event_tasks(
|
||||
let mut device_info_task_added = false;
|
||||
for topic in topics {
|
||||
if is_device_info_topic(&topic) && !device_info_task_added {
|
||||
let state = state.clone();
|
||||
let mut rx = state.subscribe_device_info();
|
||||
let event_tx = event_tx.clone();
|
||||
event_tasks.push(tokio::spawn(async move {
|
||||
if let Some(snapshot) = rx.borrow().clone() {
|
||||
let snapshot = state.get_device_info().await;
|
||||
if event_tx.send(BusMessage::Event(snapshot)).is_err() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
loop {
|
||||
if rx.changed().await.is_err() {
|
||||
|
||||
@@ -174,6 +174,10 @@ const videoStatus = computed<'connected' | 'connecting' | 'disconnected' | 'erro
|
||||
|
||||
if (videoError.value) return 'error'
|
||||
if (videoLoading.value) return 'connecting'
|
||||
if (videoMode.value !== 'mjpeg') {
|
||||
if (webrtc.isConnecting.value) return 'connecting'
|
||||
if (webrtc.isConnected.value) return 'connected'
|
||||
}
|
||||
if (systemStore.stream?.online) return 'connected'
|
||||
return 'disconnected'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user