List of usage examples for android.media.session MediaController MediaController
public MediaController(@NonNull Context context, @NonNull MediaSession.Token token)
From source file:org.opensilk.video.tv.ui.playback.PlaybackActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mComponent.inject(this); mPlayback.onCreate();//from ww w. j a v a2s.c om setMediaController(new MediaController(this, mPlayback.getMediaSession().getSessionToken())); mBinding = DataBindingUtil.setContentView(this, R.layout.activity_playback); mBinding.subtitlesSurface.setZOrderMediaOverlay(true); mBinding.subtitlesSurface.getHolder().setFormat(PixelFormat.TRANSLUCENT); setupSurfaces(); loadMediaItem(); }
From source file:de.kraenksoft.c3tv.ui.PlaybackOverlayFragment.java
private void createMediaSession() { if (mSession == null) { mSession = new MediaSession(getActivity(), "LeanbackSampleApp"); mSession.setCallback(new MediaSessionCallback()); mSession.setFlags(FLAG_HANDLES_MEDIA_BUTTONS | FLAG_HANDLES_TRANSPORT_CONTROLS); mSession.setActive(true);/*from ww w. ja v a 2s . c o m*/ // Set the Activity's MediaController used to invoke transport controls / adjust volume. getActivity().setMediaController(new MediaController(getActivity(), mSession.getSessionToken())); setPlaybackState(PlaybackState.STATE_NONE); } }
From source file:org.mythtv.android.presentation.view.fragment.TvPlaybackOverlayFragment.java
private void createMediaSession() { Log.d(TAG, "createMediaSession"); if (mSession == null) { mSession = new MediaSession(getActivity(), getResources().getString(R.string.app_name)); mSession.setCallback(new MediaSessionCallback()); mSession.setFlags(FLAG_HANDLES_MEDIA_BUTTONS | FLAG_HANDLES_TRANSPORT_CONTROLS); mSession.setActive(true);/*ww w .ja va 2 s.c o m*/ // Set the Activity's MediaController used to invoke transport controls / adjust volume. getActivity().setMediaController(new MediaController(getActivity(), mSession.getSessionToken())); setPlaybackState(PlaybackState.STATE_NONE); } }