How I can get audio processing state of a single mediaItem from a queue

0 votes

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);
  }
});

9 hours ago in Flutter by Ashwini
• 4,890 points
10 views

1 answer to this question.

0 votes

To get the audio processing state of a specific media item from a queue:

  1. Register the media items in the queue with a unique identifier, such as the media item's ID or index.
  2. Use the unique identifier to skip to the desired media item.
  3. Access the PlaybackState object returned by the playbackState stream.
  4. Check the processingState property of the PlaybackState object to get the processing state of the current media item.
  5. If the processing state is AudioProcessingState.completed and the unique identifier matches the desired media item, perform the desired action.
answered 9 hours ago by vinayak

Related Questions In Flutter

0 votes
1 answer

How to Deserialize a list of objects from json in flutter Ask Question?

To deserialize a list of objects from ...READ MORE

answered Mar 28 in Flutter by vishalini
67 views
0 votes
1 answer

How can I change enableDrag or isDismissible on a showModalBottonSheet after is already constructed?

Unfortunately, you cannot change the enableDrag or ...READ MORE

answered 2 days ago in Flutter by vinayak
24 views
0 votes
1 answer

How do you change the value inside of a textfield flutter?

To change the value inside a TextField ...READ MORE

answered Mar 26 in Flutter by Tej
70 views
0 votes
1 answer
0 votes
1 answer

How to change flutter project name and id?

Yes, it is possible to change the ...READ MORE

answered Mar 20 in Flutter by pooja
72 views
0 votes
1 answer
0 votes
1 answer

How can I create this kind of widget.Is There any packages available?

Based on the image you provided, it ...READ MORE

answered Apr 13 in Flutter by Anitha
52 views
0 votes
1 answer

How can I change the app display name build with Flutter?

Yes, you can change the app display ...READ MORE

answered Mar 21 in Flutter by venky
92 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP