2

So I am trying to display an audio artwork in the notification panel on Android, but I don't seem to know how to get it to work out right.

In the example on the pub.dev site, it used an image URL for the notification artwork, and this was the code it used:

AudioSource.uri(
  Uri.parse('https://example.com/song1.mp3'),
  tag: MediaItem(
    // Specify a unique ID for each media item:
    id: '1',
    // Metadata to display in the notification:
    album: "Album name",
    title: "Song name",
    artUri: Uri.parse('https://example.com/albumart.jpg'),
  ),
),

The artUti is getting the image from an online site, but in my case, I am trying to get it from a local audio file, for which the image link is similar to this content://data/...

I have really tried to debug it, but it is not working out fine for me.

Thanks.

  • Would you mind editing your question title to mention the `content://` URI? That's the key thing that differentiates your question, but your question title actually reads as more generic so people who search for this question might be surprised that your question doesn't actually match your title. – Ryan Heise Mar 29 '23 at 14:33
  • @RyanHeise i have done that, can you asset me with the answer to the question – Michael Stephen Mar 31 '23 at 10:02
  • 3
    First, can you try the songs example in audio_service? https://github.com/ryanheise/audio_service/blob/minor/audio_service/example/lib/example_android_songs.dart – Ryan Heise Mar 31 '23 at 14:17
  • @MichaelStephen kindly check this . I was also facing the same issues and resolves in this way https://stackoverflow.com/questions/75456939/how-to-show-artmusic-on-media-control-notification-from-assets-file-in-flutter – Rahul Kushwaha May 03 '23 at 06:06
  • 1
    Hi @RahulKushwaha, am sorry for the late reply, I will check it out and see if it works out, I kinda dished the project cus of this issue and I am currently learning Kotlin, guessed it could have been easier with Kotlin. – Michael Stephen May 12 '23 at 10:22
  • 1
    @MichaelStephen it will surely works . – Rahul Kushwaha May 15 '23 at 07:42
  • **First, can you try the songs example in audio_service?** Thanks this work just fine – Michael Stephen Jun 17 '23 at 21:13

0 Answers0