0

I'm playing a video in ExoPlayer. Now I want to distribute a specific time for that video to the user so that the user chooses. For example, I only want to display 30 seconds to 50 seconds. In AndroidStudio and JAVA language.

Thanks for helping me

Milad Yarmohammadi
  • 1,253
  • 2
  • 22
  • 37

1 Answers1

0

It's not related to ExoPlayer! You can handle it on your own.

So use this snippet to solve this problem:

At the same time with starting video:

videoview.seekTo(SPECIFIED_START_TIME);

Then run this handler:

handler = new Handler();
runnable = new Runnable() {
  @Override
  public void run() {
       if(videoview.getCurrentPosition() >= DESTINATION_TIME){ // After reaching destination time
           videoview.seekTo(SPECIFIED_START_TIME);
           videoview.pause(); // or stop();
       }
  }
};
handler.postDelayed(runnable, 0);
Milad Yarmohammadi
  • 1,253
  • 2
  • 22
  • 37