From 2c2c61b2fcf12f48389029cc77c610e1fab96ec3 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 31 Jan 2019 12:09:22 +0100 Subject: [PATCH] Add Artist and Duration to MediaDescription --- .../newpipe/player/playback/BasePlayerMediaSession.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/player/playback/BasePlayerMediaSession.java b/app/src/main/java/org/schabi/newpipe/player/playback/BasePlayerMediaSession.java index 00604b236..657fe1327 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playback/BasePlayerMediaSession.java +++ b/app/src/main/java/org/schabi/newpipe/player/playback/BasePlayerMediaSession.java @@ -1,7 +1,9 @@ package org.schabi.newpipe.player.playback; import android.net.Uri; +import android.os.Bundle; import android.support.v4.media.MediaDescriptionCompat; +import android.support.v4.media.MediaMetadataCompat; import org.schabi.newpipe.player.BasePlayer; import org.schabi.newpipe.player.mediasession.MediaSessionCallback; @@ -54,6 +56,12 @@ public class BasePlayerMediaSession implements MediaSessionCallback { .setTitle(item.getTitle()) .setSubtitle(item.getUploader()); + // set additional metadata for A2DP/AVRCP + Bundle additionalMetadata = new Bundle(); + additionalMetadata.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, item.getUploader()); + additionalMetadata.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, item.getDuration()); + descriptionBuilder.setExtras(additionalMetadata); + final Uri thumbnailUri = Uri.parse(item.getThumbnailUrl()); if (thumbnailUri != null) descriptionBuilder.setIconUri(thumbnailUri);