We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi I'm trying to put the stop button in the player screen and remove all other buttons:
mMediaSession = MediaSessionCompat( this, "MediaSessionCompat_TAG" ).apply { val sessionActivityPendingIntent = packageManager?.getLaunchIntentForPackage(packageName)?.let { sessionIntent -> PendingIntent.getActivity(this@AudioService, 0, sessionIntent, 0) } setSessionActivity(sessionActivityPendingIntent) isActive = true setCallback(mediaSessionCallback) setPlaybackState( playbackStateBuilder.apply { setState(PlaybackStateCompat.STATE_STOPPED, C.TIME_UNSET, 1f) setActions(PlaybackStateCompat.ACTION_STOP) }.build() ) setSessionToken(sessionToken)
... In addition I put in the MediaControllerCallback the value of stop
@Suppress("PropertyName") val EMPTY_PLAYBACK_STATE: PlaybackStateCompat = PlaybackStateCompat.Builder() .setState(PlaybackStateCompat.STATE_STOPPED, C.TIME_UNSET, 0f) .build() private inner class MediaControllerCallback : MediaControllerCompat.Callback() { override fun onPlaybackStateChanged(state: PlaybackStateCompat?) { playbackState.postValue(EMPTY_PLAYBACK_STATE) } override fun onMetadataChanged(metadata: MediaMetadataCompat?) { playbackState.postValue(EMPTY_PLAYBACK_STATE) nowPlaying.postValue( if (metadata?.id == null) { NOTHING_PLAYING } else { metadata } ) } override fun onQueueChanged(queue: MutableList<MediaSessionCompat.QueueItem>?) { playbackState.postValue(EMPTY_PLAYBACK_STATE) } override fun onSessionEvent(event: String?, extras: Bundle?) { playbackState.postValue(EMPTY_PLAYBACK_STATE) super.onSessionEvent(event, extras) when (event) { NETWORK_FAILURE -> networkFailure.postValue(true) } }
I only get the PLAY button and periodically a blink show and hide the previous and next buttons
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi I'm trying to put the stop button in the player screen and remove all other buttons:
I only get the PLAY button and periodically a blink show and hide the previous and next buttons
The text was updated successfully, but these errors were encountered: