florent37 / Flutter-AssetsAudioPlayer

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications
https://pub.dartlang.org/packages/assets_audio_player
Apache License 2.0
757 stars 370 forks source link

PlayInBackground.disabledRestoreOnForeground does not work in first use #636

Open l-giza opened 3 years ago

l-giza commented 3 years ago

Flutter Version

My version : 2.5.3

Lib Version

My version : 3.0.3+6

Platform (Android / iOS / web) + version

Platform : Android - Pixel 3 (emulator) API 31, iPhone 13 (emulator)

Describe the bug

When I start a music, I want it to be played only when user is in my app. When he switches to another one (or in general - when my app is not the topmost one) I want it to be paused. And then when app goes back to foreground I need it to be resumed.

To achieve that I use PlayInBackground.disabledRestoreOnForeground setting in player.Open method. It works generally fine EXCEPT the first try after starting the music. When I use "Overview" button on android device and switch to another one, the music is still playing. Then i go back to my app and switch to another one once again - and since then pausing works correctly. The same behavior is on IOS.

Svaly commented 3 years ago

I have the same problem, using Pixel 4 API 30

AndrzejKoziel commented 3 years ago

The same issue iPhone12 :/

kowann commented 3 years ago

same on iPhone11 iOS 15, any chances this could be fixed soon? thanks!

tomeksabramowicz commented 3 years ago

The same for me on Pixel 4 API 30 :(