mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Added metadata to lockscreen. Closes #1470.
This commit is contained in:
parent
441087d871
commit
886835f128
@ -8,6 +8,7 @@ import android.content.Intent
|
|||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.support.v4.media.MediaDescriptionCompat
|
||||||
import android.support.v4.media.session.MediaSessionCompat
|
import android.support.v4.media.session.MediaSessionCompat
|
||||||
import coil.request.ImageRequest
|
import coil.request.ImageRequest
|
||||||
import com.github.libretube.api.obj.Streams
|
import com.github.libretube.api.obj.Streams
|
||||||
@ -18,6 +19,7 @@ import com.github.libretube.ui.activities.MainActivity
|
|||||||
import com.google.android.exoplayer2.ExoPlayer
|
import com.google.android.exoplayer2.ExoPlayer
|
||||||
import com.google.android.exoplayer2.Player
|
import com.google.android.exoplayer2.Player
|
||||||
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector
|
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector
|
||||||
|
import com.google.android.exoplayer2.ext.mediasession.TimelineQueueNavigator
|
||||||
import com.google.android.exoplayer2.ui.PlayerNotificationManager
|
import com.google.android.exoplayer2.ui.PlayerNotificationManager
|
||||||
|
|
||||||
class NowPlayingNotification(
|
class NowPlayingNotification(
|
||||||
@ -169,6 +171,19 @@ class NowPlayingNotification(
|
|||||||
setUseFastForwardActionInCompactView(true)
|
setUseFastForwardActionInCompactView(true)
|
||||||
setUseRewindActionInCompactView(true)
|
setUseRewindActionInCompactView(true)
|
||||||
}
|
}
|
||||||
|
mediaSessionConnector = MediaSessionConnector(mediaSession)
|
||||||
|
mediaSessionConnector.setQueueNavigator(object : TimelineQueueNavigator(mediaSession) {
|
||||||
|
override fun getMediaDescription(
|
||||||
|
player: Player,
|
||||||
|
windowIndex: Int
|
||||||
|
): MediaDescriptionCompat {
|
||||||
|
return MediaDescriptionCompat.Builder().apply {
|
||||||
|
setTitle(streams?.title!!)
|
||||||
|
setSubtitle(streams?.uploader)
|
||||||
|
}.build()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
mediaSessionConnector.setPlayer(player)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user