1

My Android app has a large volume of remotely hosted media files (via AWS) and some contain embedded artwork. When playing any of these audio media, I would like my default artwork - which is used when there is no embedded artwork - to be used instead. I have tried

app:use_artwork="false"
app:default_artwork="@drawable/backgroundimage"

But contrary to what the Javadocs seem to suggest would be the result, I of course just get a black background. (use_artwork="false" really seems to mean 'use no artwork' - while the Javadocs hint more that it means 'don't use embedded ID3 artwork')

Short of downloading gigabytes of media files and doing a batch operation on them all (a problem, because files are often added dynamically), is there a solution where I can suppress the embedded artwork and use my background?

Poking around a bit, I found https://github.com/mpatric/mp3agic, but the problem here is that the files are being streamed via Exoplayer, not downloaded for me to manipulate programatically.

drawk
  • 309
  • 4
  • 10

1 Answers1

1

After poking through the Exoplayer source a bit, here is what I came up with. It is not absolutely ideal, because there is a quick flash of an embedded image before being replaced, but I think that is just a matter of moving the logic around to find the best place.

I removed the app:use_artwork="false" from my activity_main.xml

In my BroadcastReceiver, upon the "trackChanged" event, I added this (similar to what is done internally in the Exoplayer library itself):

Bitmap artWork = BitmapFactory.decodeResource(getResources(), R.drawable.backgroundimage);
ImageView aw = (ImageView) findViewById(R.id.exo_artwork);
aw.setImageBitmap(artWork);
aw.setVisibility(View.VISIBLE);
drawk
  • 309
  • 4
  • 10
  • 1
    Hey @drawk I wanted to know if how the playerview can be hidden when streaming audio with no artwork...I want to hide the black screen or have it wrap around the controls – Pemba Tamang Nov 04 '19 at 11:01