ryanheise / just_audio

Audio Player
1.03k stars 652 forks source link

Android: Empty playback notification using just_audio_background #1249

Closed fedpinx closed 3 months ago

fedpinx commented 3 months ago

Which API doesn't behave as documented, and how does it misbehave? Whatever I put in the MediaItem object inside the tag attribute of the AudioSource.uri, is not being taken into account when using just_audio_background and the Android OS audio notification. Looks like the data that is shown in the notification is taken from the metadata of the Uri, so if this is the case, what is the purpose of the MediaItem?

Minimal reproduction project Provide a link here using one of two options:

  1. Using "The Example", replace one of the AudioSource.uri items with "http://icecast.radiofrance.fr/franceinfo-midfi.mp3" (France radio station)

To Reproduce (i.e. user steps, not code) Steps to reproduce the behavior:

  1. Replace one of the AudioSource.uri items with "http://icecast.radiofrance.fr/franceinfo-midfi.mp3" (France radio station)
  2. Play the audio
  3. Send the application to background and check the OS system notification for playback, is completely empty.

Error messages

No visible error messages.

Expected behavior I would expect that it takes the MediaItem information to show in the notification as well.

Screenshots

Smartphone (please complete the following information):

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.5, on Microsoft Windows [Versi¢n 10.0.22631.3593], locale es-UY)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4)
[!] Android Studio (version 2022.1)
    ✗ Unable to determine bundled Java version.
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.89.1)
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 1 category.

Additional context In case this is the expected behavior for some reason, how can I change the data shown in the system notification?

Thank you for all your effort.

fedpinx commented 3 months ago

I'm closing this since the issue is I'm passing objects as extras and it only accepts integers and strings, would be great to clarify this in the docs! Thanks again and sorry for publishing this.

github-actions[bot] commented 3 months ago

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