0

I have been in trouble for two days. I have a flutter project in which i am using audio services package (version 0.18.9) Now my requirement is to get audio processing complete state against a single media item but in the updated version it just allows me to get about the whole queue means when the last queue item will reach to end then show me the completed state.

/// Remove all previous queue items
await audioHandler.stop();

/// Register the new queue of media items
await audioHandler.updateQueue(mediaItems);
await audioHandler.skipToQueueItem(quran_page);

///Here i want get changes for single MediaItem current it works for whole queue
audioHandler.playbackState.listen((PlaybackState state) async {
  if (state.playing == false &&
      state.processingState == AudioProcessingState.completed) {
    await onAudioComplete(quran_page);
  }
});
  • `playbackState.listen` will only report exactly the events that YOU emitted yourself, and you didn't share that part of your code. If I am supposed to guess what you're doing, I would guess that you might be using just_audio under the hood, and relaying just_audio's `completed` processing state to your audio handler. Is that guess correct? If so, what you really want to know is how to use just_audio since just_audio's `completed` state does not do what you want, and you want to know how to use just_audio to do what you want. – Ryan Heise May 01 '23 at 13:19
  • If that second guess is correct, then what you want to do is ask a question about just_audio. "How can you listen to when a single item in a playlist has completed in just_audio"? But before you ask that question, search existing questions because I'm sure I have answered that question before. – Ryan Heise May 01 '23 at 13:21

0 Answers0