Search in sources :

Example 1 with MediaControllerAdapter

use of android.support.v17.leanback.media.MediaControllerAdapter in project butter-android by butterproject.

the class TVAbsPlayerFragment method setupControls.

@Override
public void setupControls(final String title) {
    mediaSession.setPlaybackState(stateBuilder.build());
    MediaControllerCompat mediaController = new MediaControllerCompat(getContext(), mediaSession);
    PlaybackTransportControlGlue<MediaControllerAdapter> mediaControllerGlue = new PlayerMediaControllerGlue<>(requireContext(), new MediaControllerAdapter(mediaController));
    mediaControllerGlue.setTitle(title);
    mediaControllerGlue.setControlsOverlayAutoHideEnabled(true);
    mediaControllerGlue.setSeekEnabled(true);
    VideoSupportFragmentGlueHost videoSupportFragmentGlueHost = new VideoSupportFragmentGlueHost(this);
    mediaControllerGlue.setHost(videoSupportFragmentGlueHost);
    MediaControllerCompat.setMediaController(requireActivity(), mediaController);
    metadataBuilder.putText(MediaMetadataCompat.METADATA_KEY_TITLE, title);
    mediaSession.setMetadata(metadataBuilder.build());
}
Also used : MediaControllerAdapter(android.support.v17.leanback.media.MediaControllerAdapter) VideoSupportFragmentGlueHost(android.support.v17.leanback.app.VideoSupportFragmentGlueHost) MediaControllerCompat(android.support.v4.media.session.MediaControllerCompat)

Aggregations

VideoSupportFragmentGlueHost (android.support.v17.leanback.app.VideoSupportFragmentGlueHost)1 MediaControllerAdapter (android.support.v17.leanback.media.MediaControllerAdapter)1 MediaControllerCompat (android.support.v4.media.session.MediaControllerCompat)1