Search in sources :

Example 1 with SimpleExoPlayerView

use of com.google.android.exoplayer2.ui.SimpleExoPlayerView in project ExoPlayer by google.

the class PlayerActivity method onCreate.

// Activity lifecycle
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    shouldAutoPlay = true;
    clearResumePosition();
    mediaDataSourceFactory = buildDataSourceFactory(true);
    mainHandler = new Handler();
    if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) {
        CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
    }
    setContentView(R.layout.player_activity);
    View rootView = findViewById(R.id.root);
    rootView.setOnClickListener(this);
    debugRootView = (LinearLayout) findViewById(R.id.controls_root);
    debugTextView = (TextView) findViewById(R.id.debug_text_view);
    retryButton = (Button) findViewById(R.id.retry_button);
    retryButton.setOnClickListener(this);
    simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
    simpleExoPlayerView.setControllerVisibilityListener(this);
    simpleExoPlayerView.requestFocus();
}
Also used : Handler(android.os.Handler) CookieHandler(java.net.CookieHandler) View(android.view.View) SimpleExoPlayerView(com.google.android.exoplayer2.ui.SimpleExoPlayerView) TextView(android.widget.TextView) PlaybackControlView(com.google.android.exoplayer2.ui.PlaybackControlView)

Example 2 with SimpleExoPlayerView

use of com.google.android.exoplayer2.ui.SimpleExoPlayerView in project PreviewSeekBar by rubensousa.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    SimpleExoPlayerView playerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
    SimpleExoPlayerView previewPlayerView = (SimpleExoPlayerView) findViewById(R.id.previewPlayerView);
    seekBar = (PreviewSeekBar) playerView.findViewById(R.id.exo_progress);
    seekBarLayout = (PreviewSeekBarLayout) findViewById(R.id.previewSeekBarLayout);
    seekBarLayout.setTintColorResource(R.color.colorPrimary);
    seekBar.addOnSeekBarChangeListener(this);
    exoPlayerManager = new ExoPlayerManager(playerView, previewPlayerView, seekBarLayout, getString(R.string.url_hls));
    requestFullScreenIfLandscape();
}
Also used : SimpleExoPlayerView(com.google.android.exoplayer2.ui.SimpleExoPlayerView) ExoPlayerManager(com.github.rubensousa.previewseekbar.sample.exoplayer.ExoPlayerManager)

Aggregations

SimpleExoPlayerView (com.google.android.exoplayer2.ui.SimpleExoPlayerView)2 Handler (android.os.Handler)1 View (android.view.View)1 TextView (android.widget.TextView)1 ExoPlayerManager (com.github.rubensousa.previewseekbar.sample.exoplayer.ExoPlayerManager)1 PlaybackControlView (com.google.android.exoplayer2.ui.PlaybackControlView)1 CookieHandler (java.net.CookieHandler)1