[Android] Fetch playback cover from media art mrl
Geoffrey Métais
git at videolan.org
Fri Mar 31 15:37:05 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 31 15:23:19 2017 +0200| [ecb88a9b719460e355ba7ce02ce123ee8a597943] | committer: Geoffrey Métais
Fetch playback cover from media art mrl
> https://code.videolan.org/videolan/vlc-android/commit/ecb88a9b719460e355ba7ce02ce123ee8a597943
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 15 ++++++---------
.../src/org/videolan/vlc/gui/view/AudioMediaSwitcher.java | 9 ++++++++-
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 858ef0a..56b94b0 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1698,25 +1698,22 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
}
@MainThread
- public Bitmap getCover() {
- if (hasCurrentMedia()) {
- return AudioUtil.getCover(PlaybackService.this, getCurrentMedia(), 512);
- }
- return null;
+ public String getCoverArt() {
+ return getCurrentMedia().getArtworkMrl();
}
@MainThread
- public Bitmap getCoverPrev() {
+ public String getPrevCoverArt() {
if (mPrevIndex != -1)
- return AudioUtil.getCover(PlaybackService.this, mMediaList.getMedia(mPrevIndex), 512);
+ return mMediaList.getMedia(mPrevIndex).getArtworkMrl();
else
return null;
}
@MainThread
- public Bitmap getCoverNext() {
+ public String getNextCoverArt() {
if (mNextIndex != -1)
- return AudioUtil.getCover(PlaybackService.this, mMediaList.getMedia(mNextIndex), 512);
+ return mMediaList.getMedia(mNextIndex).getArtworkMrl();
else
return null;
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/view/AudioMediaSwitcher.java b/vlc-android/src/org/videolan/vlc/gui/view/AudioMediaSwitcher.java
index cd06875..471cc68 100644
--- a/vlc-android/src/org/videolan/vlc/gui/view/AudioMediaSwitcher.java
+++ b/vlc-android/src/org/videolan/vlc/gui/view/AudioMediaSwitcher.java
@@ -22,11 +22,13 @@ package org.videolan.vlc.gui.view;
import android.content.Context;
import android.graphics.Bitmap;
+import android.net.Uri;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import org.videolan.vlc.PlaybackService;
import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.gui.helpers.AudioUtil;
public abstract class AudioMediaSwitcher extends FlingViewGroup {
@@ -43,10 +45,15 @@ public abstract class AudioMediaSwitcher extends FlingViewGroup {
}
public void updateMedia(final PlaybackService service) {
+ final String artMrl = service.getCoverArt();
+ final String prevArtMrl = service.getPrevCoverArt();
+ final String nextArtMrl = service.getNextCoverArt();
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
- final Bitmap coverPrev = service.getCoverPrev(), coverCurrent = service.getCover(), coverNext = service.getCoverNext();
+ final Bitmap coverCurrent = AudioUtil.readCoverBitmap(Uri.decode(artMrl), 512);
+ final Bitmap coverPrev = AudioUtil.readCoverBitmap(Uri.decode(prevArtMrl), 512);
+ final Bitmap coverNext = AudioUtil.readCoverBitmap(Uri.decode(nextArtMrl), 512);
VLCApplication.runOnMainThread(new Runnable() {
@Override
public void run() {
More information about the Android
mailing list