THEOplayer / react-native-theoplayer

A React Native THEOplayerView component
https://theoplayer.github.io/react-native-theoplayer/
MIT License
56 stars 21 forks source link

Android API 32+ media session artwork fit #224

Open KestasVenslauskas opened 8 months ago

KestasVenslauskas commented 8 months ago

Is there a way to change the "fit" style for the artwork on android so it would cover the space?

Screenshot_1699518783

tvanlaerhoven commented 8 months ago

Hi @KestasVenslauskas, here's the code that is responsible for downloading and setting the image or the notification:

downloading: https://github.com/THEOplayer/react-native-theoplayer/blob/develop/android/src/main/java/com/theoplayer/media/MediaNotificationBuilder.kt#L180

setting: https://github.com/THEOplayer/react-native-theoplayer/blob/develop/android/src/main/java/com/theoplayer/media/MediaNotificationBuilder.kt#L123

The resizing has to happen before setting the image:

int desiredWidth = 100;
int desiredHeight = 100;
Bitmap resizedBitmap = Bitmap.createScaledBitmap(originalBitmap, desiredWidth, desiredHeight, false);

We'll try to plan such a feature in a future release.