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

Apr 20, 2023 in Flutter by Ashwini
• 5,430 points
965 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 Apr 20, 2023 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, 2023 in Flutter by vishalini
2,282 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 Apr 18, 2023 in Flutter by vinayak
965 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, 2023 in Flutter by Tej
8,912 views
0 votes
1 answer

I am creating mobile application on flutter but facing error of tflite library

The error you're encountering means that there ...READ MORE

answered Mar 18, 2023 in Android by pooja
961 views
0 votes
1 answer

How to change flutter project name and id?

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

answered Mar 20, 2023 in Flutter by pooja
4,878 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, 2023 in Flutter by Anitha
360 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, 2023 in Flutter by venky
2,601 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