Skip to content

Commit

Permalink
fix: Fix Chromecast poll rate after a video is stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Mar 10, 2024
1 parent 032383f commit 781c757
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/device/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 781c757

Please sign in to comment.