Use better builtin ControlDispatcher methods in media2 extension

parent 9df2e42d
...@@ -233,21 +233,13 @@ import java.util.List; ...@@ -233,21 +233,13 @@ import java.util.List;
public boolean skipToPreviousPlaylistItem() { public boolean skipToPreviousPlaylistItem() {
Timeline timeline = player.getCurrentTimeline(); Timeline timeline = player.getCurrentTimeline();
Assertions.checkState(!timeline.isEmpty()); Assertions.checkState(!timeline.isEmpty());
int previousWindowIndex = player.getPreviousWindowIndex(); return controlDispatcher.dispatchPrevious(player);
if (previousWindowIndex != C.INDEX_UNSET) {
return controlDispatcher.dispatchSeekTo(player, previousWindowIndex, C.TIME_UNSET);
}
return false;
} }
public boolean skipToNextPlaylistItem() { public boolean skipToNextPlaylistItem() {
Timeline timeline = player.getCurrentTimeline(); Timeline timeline = player.getCurrentTimeline();
Assertions.checkState(!timeline.isEmpty()); Assertions.checkState(!timeline.isEmpty());
int nextWindowIndex = player.getNextWindowIndex(); return controlDispatcher.dispatchNext(player);
if (nextWindowIndex != C.INDEX_UNSET) {
return controlDispatcher.dispatchSeekTo(player, nextWindowIndex, C.TIME_UNSET);
}
return false;
} }
public boolean skipToPlaylistItem(@IntRange(from = 0) int index) { public boolean skipToPlaylistItem(@IntRange(from = 0) int index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment