/** * Set different seek time depending on the video length * @param player source of the video params */ public void initTimeBar(final SimpleExoPlayer player) { if (player == null) { return; } int incrementMS; final long durationMS = player.getDuration(); if (durationMS < 10*60*1000) { // 0 - 10 min incrementMS = SEEK_INCREMENT_10MIN_MS; } else if (durationMS < 60*60*1000) { // 10 - 60 min incrementMS = SEEK_INCREMENT_60MIN_MS; } else if (durationMS < 120*60*1000) { // 60 - 120 min incrementMS = SEEK_INCREMENT_120MIN_MS; } else if (durationMS < 180*60*1000) { // 120 - 180 min incrementMS = SEEK_INCREMENT_180MIN_MS; } else { // 180 - ... min incrementMS = SEEK_INCREMENT_MORE_180MIN_MS; } // time bar: rewind and fast forward to 15 secs final TimeBar timeBar = mExoPlayerView.findViewById(R.id.exo_progress); timeBar.setKeyTimeIncrement(incrementMS); // Playback control view. mExoPlayerView.setRewindIncrementMs(incrementMS); mExoPlayerView.setFastForwardIncrementMs(incrementMS); }