Search in sources :

Example 36 with TrackSelector

use of com.google.android.exoplayer2.trackselection.TrackSelector in project zype-android by zype.

the class PlayerFragment method initPlayer.

// Player
private void initPlayer() {
    Logger.d("initPlayer()");
    if (currentPlayer == null) {
        trackSelector = new DefaultTrackSelector();
        PlayerEventListener playerEventListener = new PlayerEventListener();
        PlayerEventListener castPlayerEventListener = new PlayerEventListener();
        player = ExoPlayerFactory.newSimpleInstance(getActivity(), trackSelector);
        player.addListener(playerEventListener);
        playerView.setPlayer(player);
        playerView.setControlDispatcher(new PlayerControlDispatcher());
        castPlayer = new CastPlayer(castContext);
        castPlayer.addListener(playerEventListener);
        castPlayer.setSessionAvailabilityListener(new CastSessionAvailabilityListener());
        castControlView.setPlayer(castPlayer);
    }
    if (isPlayerControlsEnabled()) {
        play();
    } else {
        pause();
    }
}
Also used : CastPlayer(com.google.android.exoplayer2.ext.cast.CastPlayer) DefaultTrackSelector(com.google.android.exoplayer2.trackselection.DefaultTrackSelector)

Aggregations

DefaultTrackSelector (com.google.android.exoplayer2.trackselection.DefaultTrackSelector)16 DefaultLoadControl (com.google.android.exoplayer2.DefaultLoadControl)11 Test (org.junit.Test)10 MediaSource (com.google.android.exoplayer2.source.MediaSource)8 ExoPlayerFactory (com.google.android.exoplayer2.ExoPlayerFactory)7 TrackGroupArray (com.google.android.exoplayer2.source.TrackGroupArray)7 AdaptiveTrackSelection (com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection)7 TrackSelection (com.google.android.exoplayer2.trackselection.TrackSelection)7 DefaultRenderersFactory (com.google.android.exoplayer2.DefaultRenderersFactory)6 ExoPlayer (com.google.android.exoplayer2.ExoPlayer)6 RendererCapabilities (com.google.android.exoplayer2.RendererCapabilities)5 ConcatenatingMediaSource (com.google.android.exoplayer2.source.ConcatenatingMediaSource)5 TrackGroup (com.google.android.exoplayer2.source.TrackGroup)5 TrackSelector (com.google.android.exoplayer2.trackselection.TrackSelector)5 LoadControl (com.google.android.exoplayer2.LoadControl)4 SimpleExoPlayer (com.google.android.exoplayer2.SimpleExoPlayer)4 ClippingMediaSource (com.google.android.exoplayer2.source.ClippingMediaSource)4 CompositeMediaSource (com.google.android.exoplayer2.source.CompositeMediaSource)4 MaskingMediaSource (com.google.android.exoplayer2.source.MaskingMediaSource)4 ServerSideAdInsertionMediaSource (com.google.android.exoplayer2.source.ads.ServerSideAdInsertionMediaSource)4