From 3cc43e9fb9eb32063deebcfaf29531aa4588fc3d Mon Sep 17 00:00:00 2001 From: Stypox Date: Thu, 21 Jul 2022 22:44:59 +0200 Subject: [PATCH] Fix thumbnail sometimes not set to media session metadata The thumbnail was not being updated in the media session metadata after it was loaded, since there was no metadata update in that case, only a notification update. --- .../newpipe/player/mediasession/MediaSessionPlayerUi.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/player/mediasession/MediaSessionPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/mediasession/MediaSessionPlayerUi.java index a2eca575f..e0343820e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediasession/MediaSessionPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/mediasession/MediaSessionPlayerUi.java @@ -1,9 +1,11 @@ package org.schabi.newpipe.player.mediasession; import android.content.Intent; +import android.graphics.Bitmap; import android.support.v4.media.session.MediaSessionCompat; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.schabi.newpipe.R; import org.schabi.newpipe.extractor.stream.StreamInfo; @@ -60,6 +62,12 @@ public class MediaSessionPlayerUi extends PlayerUi { ); } + @Override + public void onThumbnailLoaded(@Nullable final Bitmap bitmap) { + super.onThumbnailLoaded(bitmap); + player.getCurrentStreamInfo().ifPresent(this::onMetadataChanged); + } + public void handleMediaButtonIntent(final Intent intent) { if (mediaSessionManager != null) { mediaSessionManager.handleMediaButtonIntent(intent);