display video worker status

This commit is contained in:
Dmitry Sergeev
2026-08-27 23:33:04 +03:00
parent 9df21828e9
commit 743e1680c1
4 changed files with 107 additions and 6 deletions
+30 -3
View File
@@ -397,6 +397,7 @@ func main() {
// Reconnect requests from GUI or automatic retry
control := make(chan reconnectParams, 1)
videoBridge := playback.NewVideoBridge()
statusStore := playback.NewStatusStore()
videoWorker, err := playback.NewVideoWorker(
mxladapter.VideoFactory{},
@@ -404,6 +405,7 @@ func main() {
retryPolicy,
mxladapter.ShouldRetry,
func(status playback.Status) {
statusStore.Observe(status)
if status.Err != nil {
log.Printf(
"video: state=%v attempt=%d failed=%d: %v",
@@ -891,11 +893,36 @@ func main() {
}
if useVideoSlot {
if videoActive {
cimgui.Text("Video state: active")
cimgui.Text("Video desired: active")
} else if videoStr != "" {
cimgui.Text("Video state: stopped")
cimgui.Text("Video desired: stopped")
} else {
cimgui.Text("Video state: not configured")
cimgui.Text("Video desired: not configured")
}
if status, ok := statusStore.Snapshot(playback.UnitVideo); ok {
cimgui.Text(fmt.Sprintf(
"Video actual: %s",
status.State,
))
cimgui.Text(fmt.Sprintf(
"Attempt: %d, failed: %d",
status.Attempt,
status.FailedAttempts,
))
if status.RetryIn > 0 {
cimgui.Text(fmt.Sprintf(
"Retry in: %s",
status.RetryIn.Round(time.Millisecond),
))
}
if status.Err != nil {
cimgui.TextWrapped(status.Err.Error())
}
} else {
cimgui.Text("Video actual: not started")
}
}
cimgui.End()