Released or Beta version ? Released
Version number ? 6.4.8
FULL or LITE flavor ? Both (recently switched to lite)
Result of the command "flutter pub deps | grep flutter_sound"
|-- flutter_sound_lite 6.4.8+2
| |-- flutter_sound_platform_interface 6.4.8+2
| |-- flutter_sound_web 6.4.8+2
| | |-- flutter_sound_platform_interface...
Crash ? No
Result is not what expected ? Yes
Cannot build my App ? No
Minor issue ? I'd rate it medium or minor.
iOS ? Yes
Android ? Yes
Both ? Yes
Emulator ? (not tested)
Real device ? Yes
When starting the second song:
flutter: FS:---> openAudioSession
flutter: FS:---> channelMethodCallHandler : openAudioSessionCompleted
flutter: FS:<--- channelMethodCallHandler : openAudioSessionCompleted
flutter: FS:<--- openAudioSession
flutter: FS:---> setSubscriptionDuration
flutter: FS:<---- setSubscriptionDuration
flutter: FS:---> startPlayer
flutter: FS:---> stop
flutter: FS:<--- stop
flutter: FS:---> _convert
flutter: FS:---> needToConvert
flutter: FS:<--- needToConvert
flutter: FS:<--- _convert
flutter: FS:---> channelMethodCallHandler : startPlayerCompleted
flutter: FS:<--- channelMethodCallHandler : startPlayerCompleted
flutter: FS:<--- startPlayer
flutter: FS:---> openAudioSession
flutter: FS:---> channelMethodCallHandler : openAudioSessionCompleted
flutter: FS:<--- channelMethodCallHandler : openAudioSessionCompleted
flutter: FS:<--- openAudioSession
flutter: FS:---> setSubscriptionDuration
flutter: FS:<---- setSubscriptionDuration
flutter: FS:---> startPlayer
flutter: FS:---> stop
flutter: FS:<--- stop
flutter: FS:---> _convert
flutter: FS:---> needToConvert
flutter: FS:<--- needToConvert
flutter: FS:<--- _convert
flutter: FS:---> channelMethodCallHandler : startPlayerCompleted
flutter: FS:<--- channelMethodCallHandler : startPlayerCompleted
flutter: FS:<--- startPlayer
flutter: FS:---> pausePlayer
flutter: FS:<--- pausePlayer
flutter: FS:---> pausePlayer
flutter: FS:<--- pausePlayer
Describe the bug
Using 2 SoundPlayers in the same application causes one of them to misbehave, when they are playing simultaneously. The first player starts to play the song of the second player and the durations of the song seems to not match anymore.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I'm not sure, what the best behaviour is. Not all platforms support multiple sound outputs at the same time. I'd probably prefer to stop the first player implicitly in this case. Playing both songs at the same time is fine too.
flutter_sound already keeps track of the different audio sessions, so it should be somewhat easy to stop them automatically, although an event would need to be emitted, that the song is now paused. From my testing I don't see any mixup there happening too, so the issues seem to be in TauEngine or lower at the OS level. This could also be handled at the application level, but since flutter_sound already keeps track of it, that sounds more appropriate. Tell me your thoughts and if it is not something, that can be done soon, I may look into how to implement that, but I'm not really well versed in flutter sound stuff yet. This may also actually be a feature request instead of a bug report, so feel free to reassign.
Hi @deepbluev7 .
Thank you for your very detailed PR (Problem Report).
Yes, Flutter Sound was supposed to be able to play several sound at the same time.
This has not been tested very well, and I was thinking to create a new simple example doing that.
I am going to study your PR more carefully when I will have finished working on the fucking documentation (in a few days).
Thank you again. It would be really great if everybody fill PRs like your. Detailed, clear and positive.
Registered in the Flutter Sound Project
Hi @deepbluev7 ,
I wrote a simple example doing three playbacks at the same time here.
I did not see any problems. Could you check on your side that everything OK ?
I have to do some more investigation to compare it with our codebase (and make sure I test the latest updates, etc), but one difference, that I see and which may make a difference, is that I only initialize the player before playing the media (i.e. call openAudioSession). We can't call all the opens in the beginning, as the players are in a dynamic and scrollable list. Maybe openAudioSession resets something, that leads to my issues? Anyway, I'll investigate in the near future.
I am currently working on cleaning the API.
openAudioSession() has a lot of problems. please have a look to the first draft.
It is really needed to clean that. This is now on the top of the TODO list.
Most helpful comment
Hi @deepbluev7 .
Thank you for your very detailed PR (Problem Report).
Yes, Flutter Sound was supposed to be able to play several sound at the same time.
This has not been tested very well, and I was thinking to create a new simple example doing that.
I am going to study your PR more carefully when I will have finished working on the fucking documentation (in a few days).
Thank you again. It would be really great if everybody fill PRs like your. Detailed, clear and positive.