本文整理了Java中com.google.android.exoplayer2.Timeline.getPreviousWindowIndex()
方法的一些代码示例,展示了Timeline.getPreviousWindowIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timeline.getPreviousWindowIndex()
方法的具体详情如下:
包路径:com.google.android.exoplayer2.Timeline
类名称:Timeline
方法名:getPreviousWindowIndex
[英]Returns the index of the window before the window at index windowIndex depending on the repeatMode and whether shuffling is enabled.
[中]根据repeatMode和是否启用混洗,在index windowIndex处返回窗口之前的窗口索引。
代码示例来源:origin: google/ExoPlayer
@Override
public int getPreviousWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode,
boolean shuffleModeEnabled) {
return timeline.getPreviousWindowIndex(windowIndex, repeatMode, shuffleModeEnabled);
}
代码示例来源:origin: google/ExoPlayer
@Override
public int getPreviousWindowIndex(int windowIndex, @Player.RepeatMode int repeatMode,
boolean shuffleModeEnabled) {
int childPreviousWindowIndex = timeline.getPreviousWindowIndex(windowIndex, repeatMode,
shuffleModeEnabled);
return childPreviousWindowIndex == C.INDEX_UNSET ? getLastWindowIndex(shuffleModeEnabled)
: childPreviousWindowIndex;
}
代码示例来源:origin: google/ExoPlayer
/**
* Asserts that previous window indices for each window depending on the repeat mode and the
* shuffle mode are equal to the given sequence.
*/
public static void assertPreviousWindowIndices(
Timeline timeline,
@Player.RepeatMode int repeatMode,
boolean shuffleModeEnabled,
int... expectedPreviousWindowIndices) {
for (int i = 0; i < timeline.getWindowCount(); i++) {
assertThat(timeline.getPreviousWindowIndex(i, repeatMode, shuffleModeEnabled))
.isEqualTo(expectedPreviousWindowIndices[i]);
}
}
代码示例来源:origin: google/ExoPlayer
/**
* Asserts that previous window indices for each window depending on the repeat mode and the
* shuffle mode are equal to the given sequence.
*/
public static void assertPreviousWindowIndices(
Timeline timeline,
@Player.RepeatMode int repeatMode,
boolean shuffleModeEnabled,
int... expectedPreviousWindowIndices) {
for (int i = 0; i < timeline.getWindowCount(); i++) {
assertThat(timeline.getPreviousWindowIndex(i, repeatMode, shuffleModeEnabled))
.isEqualTo(expectedPreviousWindowIndices[i]);
}
}
代码示例来源:origin: google/ExoPlayer
@Override
public final int getPreviousWindowIndex() {
Timeline timeline = getCurrentTimeline();
return timeline.isEmpty()
? C.INDEX_UNSET
: timeline.getPreviousWindowIndex(
getCurrentWindowIndex(), getRepeatModeForNavigation(), getShuffleModeEnabled());
}
代码示例来源:origin: google/ExoPlayer
int previousWindowIndexInChild = getTimelineByChildIndex(childIndex).getPreviousWindowIndex(
windowIndex - firstWindowIndexInChild,
repeatMode == Player.REPEAT_MODE_ALL ? Player.REPEAT_MODE_OFF : repeatMode,
代码示例来源:origin: ChangWeiBa/AesExoPlayer
/**
* 上一首
*/
private void previous() {
Timeline timeline = player.getCurrentTimeline();
if (timeline.isEmpty()) {
return;
}
int windowIndex = player.getCurrentWindowIndex();
timeline.getWindow(windowIndex, window);
int previousWindowIndex = timeline.getPreviousWindowIndex(windowIndex, player.getRepeatMode());
Timber.e("previousWindowIndex:" + previousWindowIndex);
Timber.e("getCurrentPosition:" + player.getCurrentPosition());
Timber.e("isDynamic:" + window.isDynamic);
Timber.e("isSeekable:" + window.isSeekable);
Timber.e("TIME_UNSET:" + C.TIME_UNSET);
Timber.e("TIME_UNSET:" + C.TIME_UNSET);
if (previousWindowIndex != C.INDEX_UNSET) {
player.seekTo(previousWindowIndex, C.TIME_UNSET);
} else {
Timber.e("seekTo(0):");
Timber.e("已经是第一首");
// player.seekTo(0);
}
}
内容来源于网络,如有侵权,请联系作者删除!