mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
fix: Incorrect playback reporting (#221)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
f259151336
commit
3b4b8a9101
5 changed files with 13 additions and 27 deletions
|
|
@ -204,6 +204,8 @@ class MediaControlsWrapper extends BaseAudioHandler {
|
|||
processingState: AudioProcessingState.ready,
|
||||
));
|
||||
|
||||
ref.read(playBackModel)?.playbackStarted(currentPosition ?? Duration.zero, ref);
|
||||
|
||||
return super.play();
|
||||
}
|
||||
|
||||
|
|
@ -232,16 +234,22 @@ class MediaControlsWrapper extends BaseAudioHandler {
|
|||
@override
|
||||
Future<void> stop() async {
|
||||
WakelockPlus.disable();
|
||||
final position = _player?.lastState.position;
|
||||
final totalDuration = _player?.lastState.duration;
|
||||
super.stop();
|
||||
_player?.stop();
|
||||
|
||||
final position = _player?.lastState.position;
|
||||
final totalDuration = _player?.lastState.duration;
|
||||
|
||||
//Small delay so we don't post right after playback/progress update
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
ref.read(playBackModel)?.playbackStopped(position ?? Duration.zero, totalDuration, ref);
|
||||
ref.read(mediaPlaybackProvider.notifier).update((state) => state.copyWith(position: Duration.zero));
|
||||
|
||||
smtc?.setPlaybackStatus(PlaybackStatus.stopped);
|
||||
smtc?.clearMetadata();
|
||||
smtc?.disableSmtc();
|
||||
|
||||
playbackState.add(
|
||||
playbackState.value.copyWith(
|
||||
playing: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue