diff --git a/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/ExoPlayerSlim.java b/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/ExoPlayerSlim.java index 21e1b1c..29a4577 100644 --- a/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/ExoPlayerSlim.java +++ b/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/ExoPlayerSlim.java @@ -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); diff --git a/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/ExoPlayerSlimImpl.java b/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/ExoPlayerSlimImpl.java index 3877e33..35e2bbb 100644 --- a/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/ExoPlayerSlimImpl.java +++ b/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/ExoPlayerSlimImpl.java @@ -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) { diff --git a/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/RepeatModes.java b/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/RepeatModes.java new file mode 100644 index 0000000..edbdf36 --- /dev/null +++ b/java/ExoPlayerSlim/exoplayerslim/src/main/java/com/tonestro/exoplayerslim/RepeatModes.java @@ -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; +}