mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-17 20:20:50 +01:00
Add skip functions to lockscreen
This commit is contained in:
parent
85e2e473e5
commit
a910818b70
@ -502,10 +502,9 @@ class MediaPlayerService : Service() {
|
||||
val state: Int
|
||||
val isPlaying = (playerState === PlayerState.STARTED)
|
||||
|
||||
var actions: Long = PlaybackStateCompat.ACTION_PLAY_PAUSE
|
||||
// or
|
||||
// PlaybackStateCompat.ACTION_SKIP_TO_NEXT or
|
||||
// PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS
|
||||
var actions: Long = PlaybackStateCompat.ACTION_PLAY_PAUSE or
|
||||
PlaybackStateCompat.ACTION_SKIP_TO_NEXT or
|
||||
PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS
|
||||
|
||||
// Map our playerState to native PlaybackState
|
||||
// TODO: Synchronize these APIs
|
||||
@ -829,6 +828,26 @@ class MediaPlayerService : Service() {
|
||||
Timber.v("Media Session Callback: onStop")
|
||||
}
|
||||
|
||||
override fun onSkipToNext() {
|
||||
super.onSkipToNext()
|
||||
getPendingIntentForMediaAction(
|
||||
applicationContext,
|
||||
KeyEvent.KEYCODE_MEDIA_NEXT,
|
||||
keycode
|
||||
).send()
|
||||
Timber.v("Media Session Callback: onSkipToNext")
|
||||
}
|
||||
|
||||
override fun onSkipToPrevious() {
|
||||
super.onSkipToPrevious()
|
||||
getPendingIntentForMediaAction(
|
||||
applicationContext,
|
||||
KeyEvent.KEYCODE_MEDIA_PREVIOUS,
|
||||
keycode
|
||||
).send()
|
||||
Timber.v("Media Session Callback: onSkipToPrevious")
|
||||
}
|
||||
|
||||
override fun onMediaButtonEvent(mediaButtonEvent: Intent): Boolean {
|
||||
// This probably won't be necessary once we implement more
|
||||
// of the modern media APIs, like the MediaController etc.
|
||||
|
Loading…
x
Reference in New Issue
Block a user