Last active
March 14, 2023 16:51
-
-
Save ademirqueiroga/295a3496b44a7a61c2e7d83268829b4d to your computer and use it in GitHub Desktop.
SimplePlaybackTransportControlGlue media session creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimplePlaybackTransportControlGlue( | |
context: Context, | |
playerAdapter: MediaPlayerAdapter, | |
) : PlaybackTransportControlGlue<MediaPlayerAdapter>(context, playerAdapter) { | |
private val mediaSession = MediaSessionCompat(context, "VideoPlayback") | |
init { | |
mediaSession.setCallback(SimpleMediaSessionCallback()) | |
} | |
override fun onHostStart() { | |
super.onHostStart() | |
mediaSession.isActive = true | |
} | |
override fun onHostPause() { | |
super.onHostPause() | |
mediaSession.isActive = false | |
} | |
override fun onDetachedFromHost() { | |
super.onDetachedFromHost() | |
mediaSession.release() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment