本文整理了Java中com.google.android.exoplayer2.util.Util.resolveSeekPositionUs()
方法的一些代码示例,展示了Util.resolveSeekPositionUs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.resolveSeekPositionUs()
方法的具体详情如下:
包路径:com.google.android.exoplayer2.util.Util
类名称:Util
方法名:resolveSeekPositionUs
[英]Resolves a seek given the requested seek position, a SeekParameters and two candidate sync points.
[中]根据请求的寻道位置、一个寻道参数和两个候选同步点解析寻道。
代码示例来源:origin: google/ExoPlayer
@Override
public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
SeekMap seekMap = getPreparedState().seekMap;
if (!seekMap.isSeekable()) {
// Treat all seeks into non-seekable media as being to t=0.
return 0;
}
SeekPoints seekPoints = seekMap.getSeekPoints(positionUs);
return Util.resolveSeekPositionUs(
positionUs, seekParameters, seekPoints.first.timeUs, seekPoints.second.timeUs);
}
代码示例来源:origin: google/ExoPlayer
@Override
public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
StreamElement streamElement = manifest.streamElements[streamElementIndex];
int chunkIndex = streamElement.getChunkIndex(positionUs);
long firstSyncUs = streamElement.getStartTimeUs(chunkIndex);
long secondSyncUs =
firstSyncUs < positionUs && chunkIndex < streamElement.chunkCount - 1
? streamElement.getStartTimeUs(chunkIndex + 1)
: firstSyncUs;
return Util.resolveSeekPositionUs(positionUs, seekParameters, firstSyncUs, secondSyncUs);
}
代码示例来源:origin: google/ExoPlayer
@Override
public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
int chunkIndex = dataSet.getChunkIndexByPosition(positionUs);
long firstSyncUs = dataSet.getStartTime(chunkIndex);
long secondSyncUs =
firstSyncUs < positionUs && chunkIndex < dataSet.getChunkCount() - 1
? dataSet.getStartTime(chunkIndex + 1)
: firstSyncUs;
return Util.resolveSeekPositionUs(positionUs, seekParameters, firstSyncUs, secondSyncUs);
}
代码示例来源:origin: google/ExoPlayer
@Override
public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
// Segments are aligned across representations, so any segment index will do.
for (RepresentationHolder representationHolder : representationHolders) {
if (representationHolder.segmentIndex != null) {
long segmentNum = representationHolder.getSegmentNum(positionUs);
long firstSyncUs = representationHolder.getSegmentStartTimeUs(segmentNum);
long secondSyncUs =
firstSyncUs < positionUs && segmentNum < representationHolder.getSegmentCount() - 1
? representationHolder.getSegmentStartTimeUs(segmentNum + 1)
: firstSyncUs;
return Util.resolveSeekPositionUs(positionUs, seekParameters, firstSyncUs, secondSyncUs);
}
}
// We don't have a segment index to adjust the seek position with yet.
return positionUs;
}
代码示例来源:origin: google/ExoPlayer
@Override
public long getAdjustedSeekPositionUs(long positionUs, SeekParameters seekParameters) {
int chunkIndex = dataSet.getChunkIndexByPosition(positionUs);
long firstSyncUs = dataSet.getStartTime(chunkIndex);
long secondSyncUs =
firstSyncUs < positionUs && chunkIndex < dataSet.getChunkCount() - 1
? dataSet.getStartTime(chunkIndex + 1)
: firstSyncUs;
return Util.resolveSeekPositionUs(positionUs, seekParameters, firstSyncUs, secondSyncUs);
}
内容来源于网络,如有侵权,请联系作者删除!