Search in sources :

Example 1 with PreviewBar

use of com.github.rubensousa.previewseekbar.PreviewBar in project PreviewSeekBar by rubensousa.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    PlayerView playerView = findViewById(R.id.player_view);
    previewTimeBar = playerView.findViewById(R.id.exo_progress);
    previewSeekBar = findViewById(R.id.previewSeekBar);
    previewTimeBar.addOnPreviewVisibilityListener((previewBar, isPreviewShowing) -> {
        Log.d("PreviewShowing", String.valueOf(isPreviewShowing));
    });
    previewTimeBar.addOnScrubListener(new PreviewBar.OnScrubListener() {

        @Override
        public void onScrubStart(PreviewBar previewBar) {
            Log.d("Scrub", "START");
        }

        @Override
        public void onScrubMove(PreviewBar previewBar, int progress, boolean fromUser) {
            Log.d("Scrub", "MOVE to " + progress / 1000 + " FROM USER: " + fromUser);
        }

        @Override
        public void onScrubStop(PreviewBar previewBar) {
            Log.d("Scrub", "STOP");
        }
    });
    exoPlayerManager = new ExoPlayerManager(playerView, previewTimeBar, findViewById(R.id.imageView), getString(R.string.url_thumbnails));
    exoPlayerManager.play(Uri.parse(getString(R.string.url_dash)));
    setupOptions();
    requestFullScreenIfLandscape();
}
Also used : PlayerView(com.google.android.exoplayer2.ui.PlayerView) PreviewBar(com.github.rubensousa.previewseekbar.PreviewBar) ExoPlayerManager(com.github.rubensousa.previewseekbar.sample.exoplayer.ExoPlayerManager)

Aggregations

PreviewBar (com.github.rubensousa.previewseekbar.PreviewBar)1 ExoPlayerManager (com.github.rubensousa.previewseekbar.sample.exoplayer.ExoPlayerManager)1 PlayerView (com.google.android.exoplayer2.ui.PlayerView)1