fixed notification bug with loaded queue

This commit is contained in:
Moritz Weber 2020-12-23 14:17:18 +01:00
parent f98154e019
commit 3afb25bdb1
2 changed files with 2 additions and 3 deletions

View file

@ -16,7 +16,7 @@ import 'stream_constants.dart';
class MyAudioHandler extends BaseAudioHandler {
MyAudioHandler(this._musicDataSource, this._audioPlayer, this._playerStateDataSource) {
_audioPlayer.queueStream.listen((event) {
_audioPlayer.queueStream.skip(1).listen((event) {
_handleSetQueue(event);
});

View file

@ -95,11 +95,10 @@ class AudioPlayerImpl implements AudioPlayer {
@override
Future<void> loadQueue({List<QueueItemModel> queue, int initialIndex = 0}) async {
// Not adding to the queue subject as this is meant to load an initial state from the persistent state data source.
// This means that the UI already knows the queue.
if (queue == null || initialIndex >= queue.length) {
return;
}
_queueSubject.add(queue);
// final smallQueue = queue.sublist(max(initialIndex - 10, 0), min(initialIndex + 140, queue.length));