-
-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Music notification not working properly #924
Comments
I was not able to reproduce it on my Google Pixel 3a (Android 12). Your bug report seems to be missing the section on which device you tested it on (Oh, wait, it's a formatting issue. You didn't put the closing 3 ticks on a separate line.) Is it just the |
I fixed the formatting. When using the multiple_handlers on the audio player setting, it behaves as described above; when using TTS, the audio restart to the beginning even when paused mid-speech, and the icon initially changes back to the pause icon, logs the same error as before, and the icon is stuck on pause. |
Do you know if this behaviour is specific to Android 13? |
From what I can tell, yes, it only occurs on Android 13. I tried to reproduce the error on my Galaxy S 21 Ultra running Android 12 OneUI 4.1, but it behaves appropriately. Re-attempted using a fresh emulator running Android 13, the error occurs just like on my physical phone. |
Regarding your reproduction steps, you say "leave the app running in the background". To clarify, the app isn't presently in the background, so a step must exist to put the app into the background. Do you move the app into the background before or after hitting the pause button, and are you pausing from the notification or in the app? Also, after the 10 to 30 second period you refer to, do you notice any visual changes to the notification, such as the next/previous buttons disappearing and only the play button remaining? Or do you see the full set of buttons still after the 30 seconds? |
What I meant by in the background is swiping out of the app and returning to your phone's home screen. As for pausing, you can use the pause button within the app before swiping out or immediately pausing the audio from the notification after returning to the phone's home screen. The complete set of media controls is still visible after 30 seconds. |
If I understand correctly, you mean that you get the same behaviour regardless of whether you pause before or after moving the app into the background. I've just done some Googling and found a StackOverflow post that has a few helpful answers: One suggestion you may be able to try without hacking the audio_service code itself is the one about adding something to your manifest (although people have reported that not actually helping...) As for hacking the code, I won't be able to do this in the immediate term since I have a hospital visit on Monday but hopefully next week. It is puzzling that this error occurs, since clicking a notification is supposed to be one of the permitted cases for starting a foreground service. I can only guess that after 30 seconds the OS has purged the process from memory and has to restart it, but the FlutterEngine startup latency is too long and the OS therefore considers that it hasn't invoked |
Ok, I'll give this a try later on today. Thanks for taking the time to explore this. I hope all goes well during your hospital visit. |
Edit: Strike that, I see I already asked that question. |
I found this platform issue which may be related to yours: https://issuetracker.google.com/issues/225936221 It suggests it's a bug in the platform that has been fixed in the update. |
I found the same problem on Harmony OS 3.0 , And it is normal in Harmony OS 2.0 When I use audio_service to play music normally, I switch to another video player, and the music stops at this time (it is normal at this time). Then I switch to the background, and the video player pauses playback at this time (it did not switch to the application of audio_service), at this time audio_service plays music normally, but the icon in the background of audio_service stops at the play icon, and it does not work properly. Version: |
我也遇到同样的问题,andoud版本12 |
I'm sorry, I don't speak Chinese. If you have some important information to contribute, please use Google Translate to translate it into English. |
It appears this issue is the same as #996 and a workaround is suggested there, so I'll close this and refer you to the other one. |
Duplicate of #996 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service. |
Documented behaviour
A button to appear in the Android notification, lock screen, Android smart watch, or Android Auto device. The set of buttons you would like to display at any given moment should be streamed via AudioHandler.playbackState.
Actual behaviour
After being pressed, the play button remains, and the audio resumes playing instead of switching over to the pause button.
Runtime error
Minimal reproduction project
Official example: main.dart
Reproduction steps
Output of flutter doctor
Devices exhibiting the bug
Pixel 6 pro - Android 13 DP2
The text was updated successfully, but these errors were encountered: