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
All checks were successful
Deploy on Master Change / deploy (push) Successful in 38s
This commit is contained in:
@@ -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.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user