From e122f2e05e8a0b65511d846a94e18e9158d77492 Mon Sep 17 00:00:00 2001 From: devgianlu Date: Wed, 17 Apr 2024 16:24:42 +0200 Subject: [PATCH] fix: typo in seek bounds --- player/player.go | 2 +- player/stream.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/player/player.go b/player/player.go index 21fbd74..7caf3fb 100644 --- a/player/player.go +++ b/player/player.go @@ -343,7 +343,7 @@ func (p *Player) NewStream(spotId librespot.SpotifyId, bitrate int, mediaPositio return nil, fmt.Errorf("unsupported channels: %d", stream.Channels) } - if err := stream.SetPositionMs(min(0, max(mediaPosition, int64(media.Duration())))); err != nil { + if err := stream.SetPositionMs(max(0, min(mediaPosition, int64(media.Duration())))); err != nil { return nil, fmt.Errorf("failed seeking stream: %w", err) } diff --git a/player/stream.go b/player/stream.go index 753f2dc..c1f1e44 100644 --- a/player/stream.go +++ b/player/stream.go @@ -31,7 +31,7 @@ func (s *Stream) Stop() { } func (s *Stream) SeekMs(pos int64) error { - pos = min(0, max(pos, int64(s.Media.Duration()))) + pos = max(0, min(pos, int64(s.Media.Duration()))) resp := make(chan any, 1) s.p.cmd <- playerCmd{typ: playerCmdSeek, data: pos, resp: resp}