mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-05 15:49:22 +00:00
Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay
This commit is contained in:
commit
be5920cfae
1 changed files with 12 additions and 1 deletions
|
@ -183,10 +183,12 @@ class MediaPlaybackService : Service() {
|
||||||
Logger.v(TAG, "updateMediaSession");
|
Logger.v(TAG, "updateMediaSession");
|
||||||
var isUpdating = false;
|
var isUpdating = false;
|
||||||
val video: IPlatformVideo;
|
val video: IPlatformVideo;
|
||||||
|
var lastBitmap: Bitmap? = null
|
||||||
if(videoUpdated == null) {
|
if(videoUpdated == null) {
|
||||||
val notifLastVideo = _notif_last_video ?: return;
|
val notifLastVideo = _notif_last_video ?: return;
|
||||||
video = notifLastVideo;
|
video = notifLastVideo;
|
||||||
isUpdating = true;
|
isUpdating = true;
|
||||||
|
lastBitmap = _notif_last_bitmap;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
video = videoUpdated;
|
video = videoUpdated;
|
||||||
|
@ -199,6 +201,7 @@ class MediaPlaybackService : Service() {
|
||||||
.putString(MediaMetadata.METADATA_KEY_ARTIST, video.author.name)
|
.putString(MediaMetadata.METADATA_KEY_ARTIST, video.author.name)
|
||||||
.putString(MediaMetadata.METADATA_KEY_TITLE, video.name)
|
.putString(MediaMetadata.METADATA_KEY_TITLE, video.name)
|
||||||
.putLong(MediaMetadata.METADATA_KEY_DURATION, video.duration * 1000)
|
.putLong(MediaMetadata.METADATA_KEY_DURATION, video.duration * 1000)
|
||||||
|
.putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, lastBitmap)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
val thumbnail = video.thumbnails.getHQThumbnail();
|
val thumbnail = video.thumbnails.getHQThumbnail();
|
||||||
|
@ -214,8 +217,16 @@ class MediaPlaybackService : Service() {
|
||||||
.load(thumbnail)
|
.load(thumbnail)
|
||||||
.into(object: CustomTarget<Bitmap>() {
|
.into(object: CustomTarget<Bitmap>() {
|
||||||
override fun onResourceReady(resource: Bitmap,transition: Transition<in Bitmap>?) {
|
override fun onResourceReady(resource: Bitmap,transition: Transition<in Bitmap>?) {
|
||||||
if(tag == _notif_last_video)
|
if(tag == _notif_last_video) {
|
||||||
notifyMediaSession(video, resource)
|
notifyMediaSession(video, resource)
|
||||||
|
_mediaSession?.setMetadata(
|
||||||
|
MediaMetadataCompat.Builder()
|
||||||
|
.putString(MediaMetadata.METADATA_KEY_ARTIST, video.author.name)
|
||||||
|
.putString(MediaMetadata.METADATA_KEY_TITLE, video.name)
|
||||||
|
.putLong(MediaMetadata.METADATA_KEY_DURATION, video.duration * 1000)
|
||||||
|
.putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, resource)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
override fun onLoadCleared(placeholder: Drawable?) {
|
override fun onLoadCleared(placeholder: Drawable?) {
|
||||||
if(tag == _notif_last_video)
|
if(tag == _notif_last_video)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue