From 781c757bc56b1192aad845ef79c1cc19a5db558c Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Sun, 10 Mar 2024 05:55:11 -0500 Subject: [PATCH] fix: Fix Chromecast poll rate after a video is stopped --- internal/device/watch.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/device/watch.go b/internal/device/watch.go index 124a80e..b02e08e 100644 --- a/internal/device/watch.go +++ b/internal/device/watch.go @@ -286,9 +286,13 @@ func (d *Device) onMessage(msg *api.CastMessage) { d.changeTickInterval(config.Default.PlayingInterval) } case "MEDIA_STATUS": - playerState, _ := jsonparser.GetString(payload, "status", "[0]", "playerState") - d.mu.Lock() - defer d.mu.Unlock() + var playerState string + customPlayerState, _ := jsonparser.GetInt(payload, "status", "[0]", "customData", "playerState") + if customPlayerState == 5 { + playerState = StateIdle + } else { + playerState, _ = jsonparser.GetString(payload, "status", "[0]", "playerState") + } d.state = playerState switch playerState { case StatePlaying, StateBuffering: