fix: restore Windows webcam stream support by conditionally delegating to frontend events
All checks were successful
Deploy on Master Change / deploy (push) Successful in 38s

This commit is contained in:
2026-07-01 13:29:47 +07:00
parent d94c1733be
commit 604ce9ea16
3 changed files with 21 additions and 2 deletions

View File

@@ -1267,6 +1267,12 @@ func (a *App) startWebcamStream() {
a.streamCamStop = make(chan struct{})
a.mu.Unlock()
if !camera.IsNative {
log.Println("[WS] Platform is non-darwin, delegating webcam stream to frontend events")
runtime.EventsEmit(a.ctx, "start_webcam_stream")
return
}
if err := camera.StartCapture(); err != nil {
log.Printf("[WS] Failed to start native camera: %v", err)
a.mu.Lock()
@@ -1328,7 +1334,16 @@ func (a *App) stopWebcamStream() {
return
}
a.isStreamingCam = false
close(a.streamCamStop)
if a.streamCamStop != nil {
close(a.streamCamStop)
}
if !camera.IsNative {
log.Println("[WS] Platform is non-darwin, stopping frontend webcam stream via event")
runtime.EventsEmit(a.ctx, "stop_webcam_stream")
return
}
camera.StopCapture()
log.Println("[WS] Webcam native streaming stopped.")
}