From b20fca8c883a54ed28cdf7f9136003a3088a0df2 Mon Sep 17 00:00:00 2001 From: devgianlu Date: Fri, 8 Nov 2024 13:53:58 +0100 Subject: [PATCH] fix: get correct track position even when output is missing --- player/player.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/player/player.go b/player/player.go index 515a0b8..80cfb7d 100644 --- a/player/player.go +++ b/player/player.go @@ -203,6 +203,7 @@ loop: cmd.resp <- nil } case playerCmdPosition: + pos := source.PositionMs() if out != nil { delay, err := out.DelayMs() if err != nil { @@ -210,9 +211,9 @@ loop: 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)