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.
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.