Closed AssassinAguilar closed 2 years ago
Hi @AssassinAguilar, I have the same problem. How did you fix it ?
I found the problem, change this functions like that.
Hi @erayhaydar, I have switched to the official tutorial of audio_service in https://github.com/ryanheise/audio_service/blob/minor/audio_service/example/lib/example_playlist.dart and if you want to add duration later rather than in mediaItem change the current song function with
Rx.combineLatest5<int?, List<MediaItem>, bool, List<int>?, Duration?,
MediaItem?>(
_player.currentIndexStream,
queue,
_player.shuffleModeEnabledStream,
_player.shuffleIndicesStream,
_player.durationStream,
(index, queue, shuffleModeEnabled, shuffleIndices, duration) {
final queueIndex =
getQueueIndex(index, shuffleModeEnabled, shuffleIndices);
return (queueIndex != null && queueIndex < queue.length)
? queue[queueIndex].copyWith(duration: duration)
: null;
})
.debounceTime(const Duration(milliseconds: 750))
.whereType<MediaItem>()
.distinct()
.listen(mediaItem.add);
@AssassinAguilar Thank you!
Hello Sir, I have completely followed your tutorial and I am still having problem in syncing MediaItem and IndexedAudioSource like some song is playing and my app shows details of some other song in shuffle mode.