From 0edc10c3e0e00f38cc6a72d76dea84b620b7af3d Mon Sep 17 00:00:00 2001 From: Yesterday17 Date: Mon, 16 Sep 2024 20:41:37 +0800 Subject: [PATCH] fix(playback): set progress after open --- anni-playback/src/decoder/decoder.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/anni-playback/src/decoder/decoder.rs b/anni-playback/src/decoder/decoder.rs index f915e7e..a622952 100644 --- a/anni-playback/src/decoder/decoder.rs +++ b/anni-playback/src/decoder/decoder.rs @@ -161,8 +161,13 @@ impl Decoder { None => (), Some(message) => match message { InternalPlayerEvent::Open(source, buffer_signal) => { + let playback = Self::open(source, buffer_signal)?; + self.controls.set_progress(ProgressState { + position: 0, + duration: playback.duration, + }); self.cpal_output = None; - self.playback = Some(Self::open(source, buffer_signal)?); + self.playback = Some(playback); } InternalPlayerEvent::Play => { self.state = DecoderState::Playing;