Skip to content

Commit

Permalink
fix: get correct track position even when output is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Nov 8, 2024
1 parent cf97e9e commit b20fca8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,17 @@ loop:
cmd.resp <- nil
}
case playerCmdPosition:
pos := source.PositionMs()
if out != nil {
delay, err := out.DelayMs()
if err != nil {
log.WithError(err).Warnf("failed getting output device delay")
delay = 0
}

cmd.resp <- source.PositionMs() - delay
cmd.resp <- pos - delay
} else {
cmd.resp <- int64(0)
cmd.resp <- pos
}
case playerCmdVolume:
volume = cmd.data.(float32)
Expand Down

0 comments on commit b20fca8

Please sign in to comment.