Skip to content

Commit

Permalink
Merge pull request #6 from thisisthekap/br_5_video_looping_support
Browse files Browse the repository at this point in the history
added repeat mode support
  • Loading branch information
thisisthekap authored Jun 14, 2021
2 parents 3f49107 + 0cfcbf4 commit 81c2aab
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ public interface ExoPlayerSlim extends Closeable {

void setPlayWhenReady(boolean playWhenReady);

/**
* Use this method to set the repeat mode after the player was initialized
* @param repeatMode Repeat mode given in @{@link RepeatModes}
*/
void setRepeatMode(int repeatMode);

int getRepeatMode();

void attachPlayerView(View playerView, boolean useNativeControls, int aspectRatio);

void detachPlayerView(View playerView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ public void setPlayWhenReady(boolean playWhenReady) {
player.setPlayWhenReady(playWhenReady);
}

@Override
public void setRepeatMode(int repeatMode) {
player.setRepeatMode(repeatMode);
}

@Override
public int getRepeatMode() {
return player.getRepeatMode();
}

@Override
public void attachPlayerView(View playerView, boolean useNativeControls, int aspectRatio) {
if (playerView == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.tonestro.exoplayerslim;

public class RepeatModes {

private RepeatModes() {
}

/**
* Normal playback without repetition. "Previous" and "Next" actions move to the previous and next
* windows respectively, and do nothing when there is no previous or next window to move to.
*/
public static final int REPEAT_MODE_OFF = 0;
/**
* Repeats the currently playing window infinitely during ongoing playback. "Previous" and "Next"
* actions behave as they do in {@link #REPEAT_MODE_OFF}, moving to the previous and next windows
* respectively, and doing nothing when there is no previous or next window to move to.
*/
public static final int REPEAT_MODE_ONE = 1;
/**
* Repeats the entire timeline infinitely. "Previous" and "Next" actions behave as they do in
* {@link #REPEAT_MODE_OFF}, but with looping at the ends so that "Previous" when playing the
* first window will move to the last window, and "Next" when playing the last window will move to
* the first window.
*/
public static final int REPEAT_MODE_ALL = 2;
}

0 comments on commit 81c2aab

Please sign in to comment.