first commit
Build / Build for Android (push) Has been cancelled
Build / Build for iOS (push) Has been cancelled

This commit is contained in:
Zakaria
2026-05-18 14:15:38 -04:00
commit 1563409cb1
382 changed files with 45347 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import 'package:audio_service/audio_service.dart';
import 'package:get_it/get_it.dart';
import 'package:rxdart/rxdart.dart';
import 'music_player_background_task.dart';
class ProgressState {
final MediaItem? mediaItem;
final PlaybackState playbackState;
final Duration position;
ProgressState(this.mediaItem, this.playbackState, this.position);
}
/// Encapsulate all the different data we're interested in into a single
/// stream so we don't have to nest StreamBuilders.
Stream<ProgressState> get progressStateStream {
final audioHandler = GetIt.instance<MusicPlayerBackgroundTask>();
return Rx.combineLatest3<MediaItem?, PlaybackState, Duration, ProgressState>(
audioHandler.mediaItem,
audioHandler.playbackState,
AudioService.position.startWith(audioHandler.playbackState.value.position),
(mediaItem, playbackState, position) =>
ProgressState(mediaItem, playbackState, position));
}