Add method to clear all audioSource inside AudioPlayer
Is your feature request related to a problem? Please describe. I don't see any clear() method to clear all audioSources in the AudioPlayer! Even in the documentation it is not clear how to delete everything, so I think is necessary to add a method to remove all audioSource.
Describe the solution you'd like Add a method to clear all
Describe alternatives you've considered There isn't an alternative
Additional context Nobody
The next major release will offer a playlist API on the player instance itself, including a clear method. Until then, if you set a ConcatenatingAudioSource as the main audio source of the player, you can just call the clear method on that to achieve the same effect. (The new playlist will be implemented internally by just doing that.)
Hi @ryanheise Thank you for your answer! I have two more questions.
-
After calling the clear on ConcatenatingAudioSource, do I have to call the setAudioSource again?
-
So, it’s possible to delete the elements of a playlist, but not on the single audio? Because if instead I load the single audio, I noticed that before loading the new audio, it makes me hear the previous audio for a few seconds, I wonder if it's a bug or if it's possible to solve this problem in some way.
I hope I was clear.
@bianca8 , please consult the examples in this repo if you would like to see how to use ConcatenatingAudioSource. I would like to keep this issue focused on the given feature request, so if you would like to report a bug, please open a new issue for that. If you have questions, the place reserved for that is StackOverflow.
Ok clear, thanks @ryanheise When do you plan to release this major release?
As soon as I get it working.
I have a PR available at #1423 .
To test, it is necessary to comment/uncomment as indicated in the pubspec.yaml files to use the new platform interface with the new features.