当前位置: 首页>>代码示例>>Java>>正文


Java TimeRange类代码示例

本文整理汇总了Java中com.google.android.exoplayer.TimeRange的典型用法代码示例。如果您正苦于以下问题:Java TimeRange类的具体用法?Java TimeRange怎么用?Java TimeRange使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TimeRange类属于com.google.android.exoplayer包,在下文中一共展示了TimeRange类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: enable

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
@Override
public void enable() {
  fatalError = null;
  formatEvaluator.enable();
  if (manifestFetcher != null) {
    manifestFetcher.enable();
  }
  DashSegmentIndex segmentIndex =
      representationHolders.get(formats[0].id).representation.getIndex();
  if (segmentIndex == null) {
    seekRange = new TimeRange(TimeRange.TYPE_SNAPSHOT, 0, currentManifest.duration * 1000);
    notifySeekRangeChanged(seekRange);
  } else {
    long nowUs = getNowUs();
    updateAvailableSegmentBounds(segmentIndex, nowUs);
    updateSeekRange(segmentIndex, nowUs);
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:19,代码来源:DashChunkSource.java

示例2: getAvailableRange

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
private TimeRange getAvailableRange(long nowUnixTimeUs) {
  PeriodHolder firstPeriod = periodHolders.valueAt(0);
  PeriodHolder lastPeriod = periodHolders.valueAt(periodHolders.size() - 1);

  if (!currentManifest.dynamic || lastPeriod.isIndexExplicit()) {
    return new StaticTimeRange(firstPeriod.getAvailableStartTimeUs(),
        lastPeriod.getAvailableEndTimeUs());
  }

  long minStartPositionUs = firstPeriod.getAvailableStartTimeUs();
  long maxEndPositionUs = lastPeriod.isIndexUnbounded() ? Long.MAX_VALUE
      : lastPeriod.getAvailableEndTimeUs();
  long elapsedRealtimeAtZeroUs = (systemClock.elapsedRealtime() * 1000)
      - (nowUnixTimeUs - (currentManifest.availabilityStartTime * 1000));
  long timeShiftBufferDepthUs = currentManifest.timeShiftBufferDepth == -1 ? -1
      : currentManifest.timeShiftBufferDepth * 1000;
  return new DynamicTimeRange(minStartPositionUs, maxEndPositionUs, elapsedRealtimeAtZeroUs,
      timeShiftBufferDepthUs, systemClock);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:20,代码来源:DashChunkSource.java

示例3: updateSeekRange

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
private void updateSeekRange(DashSegmentIndex segmentIndex, long nowUs) {
  long earliestSeekPosition = segmentIndex.getTimeUs(firstAvailableSegmentNum);
  long latestSeekPosition = segmentIndex.getTimeUs(lastAvailableSegmentNum)
      + segmentIndex.getDurationUs(lastAvailableSegmentNum);
  if (currentManifest.dynamic) {
    long liveEdgeTimestampUs;
    if (segmentIndex.getLastSegmentNum() == DashSegmentIndex.INDEX_UNBOUNDED) {
      liveEdgeTimestampUs = nowUs - currentManifest.availabilityStartTime * 1000;
    } else {
      liveEdgeTimestampUs = segmentIndex.getTimeUs(segmentIndex.getLastSegmentNum())
          + segmentIndex.getDurationUs(segmentIndex.getLastSegmentNum());
      if (!segmentIndex.isExplicit()) {
        // Some segments defined by the index may not be available yet. Bound the calculated live
        // edge based on the elapsed time since the manifest became available.
        liveEdgeTimestampUs = Math.min(liveEdgeTimestampUs,
            nowUs - currentManifest.availabilityStartTime * 1000);
      }
    }

    // it's possible that the live edge latency actually puts our latest position before
    // the earliest position in the case of a DVR-like stream that's just starting up, so
    // in that case just return the earliest position instead
    latestSeekPosition = Math.max(earliestSeekPosition, liveEdgeTimestampUs - liveEdgeLatencyUs);
  }

  TimeRange newSeekRange = new TimeRange(TimeRange.TYPE_SNAPSHOT, earliestSeekPosition,
      latestSeekPosition);
  if (seekRange == null || !seekRange.equals(newSeekRange)) {
    seekRange = newSeekRange;
    notifySeekRangeChanged(seekRange);
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:33,代码来源:DashChunkSource.java

示例4: notifySeekRangeChanged

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
private void notifySeekRangeChanged(final TimeRange seekRange) {
  if (eventHandler != null && eventListener != null) {
    eventHandler.post(new Runnable() {
      @Override
      public void run() {
        eventListener.onSeekRangeChanged(seekRange);
      }
    });
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:11,代码来源:DashChunkSource.java

示例5: notifyAvailableRangeChanged

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
private void notifyAvailableRangeChanged(final TimeRange seekRange) {
  if (eventHandler != null && eventListener != null) {
    eventHandler.post(new Runnable() {
      @Override
      public void run() {
        eventListener.onAvailableRangeChanged(eventSourceId, seekRange);
      }
    });
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:11,代码来源:DashChunkSource.java

示例6: testGetAvailableRangeOnVod

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
public void testGetAvailableRangeOnVod() {
  DashChunkSource chunkSource = new DashChunkSource(buildVodMpd(),
      DefaultDashTrackSelector.newVideoInstance(null, false, false), null, null);
  chunkSource.prepare();
  chunkSource.enable(0);
  TimeRange availableRange = chunkSource.getAvailableRange();

  checkAvailableRange(availableRange, 0, VOD_DURATION_MS * 1000);

  long[] seekRangeValuesMs = availableRange.getCurrentBoundsMs(null);
  assertEquals(0, seekRangeValuesMs[0]);
  assertEquals(VOD_DURATION_MS, seekRangeValuesMs[1]);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:14,代码来源:DashChunkSourceTest.java

示例7: testGetAvailableRangeOnMultiPeriodVod

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
public void testGetAvailableRangeOnMultiPeriodVod() {
  DashChunkSource chunkSource = new DashChunkSource(buildMultiPeriodVodMpd(),
      DefaultDashTrackSelector.newVideoInstance(null, false, false), null, null);
  chunkSource.prepare();
  chunkSource.enable(0);
  TimeRange availableRange = chunkSource.getAvailableRange();
  checkAvailableRange(availableRange, 0, MULTI_PERIOD_VOD_DURATION_MS * 1000);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:9,代码来源:DashChunkSourceTest.java

示例8: checkLiveEdgeConsistency

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
private static void checkLiveEdgeConsistency(DashChunkSource chunkSource, List<MediaChunk> queue,
    ChunkOperationHolder out, long seekPositionMs, long availableRangeStartMs,
    long availableRangeEndMs, long chunkStartTimeMs, long chunkEndTimeMs) {
  chunkSource.getChunkOperation(queue, seekPositionMs * 1000, out);
  TimeRange availableRange = chunkSource.getAvailableRange();
  checkAvailableRange(availableRange, availableRangeStartMs * 1000, availableRangeEndMs * 1000);
  if (chunkStartTimeMs < availableRangeEndMs) {
    assertNotNull(out.chunk);
    assertEquals(chunkStartTimeMs * 1000, ((MediaChunk) out.chunk).startTimeUs);
    assertEquals(chunkEndTimeMs * 1000, ((MediaChunk) out.chunk).endTimeUs);
  } else {
    assertNull(out.chunk);
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:15,代码来源:DashChunkSourceTest.java

示例9: onAvailableRangeChanged

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
/** DashChunkSource.EventListener */
@Override
public void onAvailableRangeChanged(int sourceId, TimeRange timeRange) {
    if (infoListener != null) {
        infoListener.onAvailableRangeChanged(timeRange);
    }
}
 
开发者ID:satorufujiwara,项目名称:exoplayer-textureview,代码行数:8,代码来源:DashEventProxy.java

示例10: testGetSeekRangeOnVod

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
public void testGetSeekRangeOnVod() {
  DashChunkSource chunkSource = new DashChunkSource(generateVodMpd(), AdaptationSet.TYPE_VIDEO,
      null, null, mock(FormatEvaluator.class));
  chunkSource.enable();
  TimeRange seekRange = chunkSource.getSeekRange();

  checkSeekRange(seekRange, 0, VOD_DURATION_MS * 1000);

  long[] seekRangeValuesMs = seekRange.getCurrentBoundsMs(null);
  assertEquals(0, seekRangeValuesMs[0]);
  assertEquals(VOD_DURATION_MS, seekRangeValuesMs[1]);
}
 
开发者ID:raphanda,项目名称:ExoPlayer,代码行数:13,代码来源:DashChunkSourceTest.java

示例11: checkLiveEdgeLatency

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
private void checkLiveEdgeLatency(DashChunkSource chunkSource, List<MediaChunk> queue,
    ChunkOperationHolder out, long seekPositionMs, long seekRangeStartMs, long seekRangeEndMs,
    long chunkStartTimeMs, long chunkEndTimeMs) {
  chunkSource.getChunkOperation(queue, seekPositionMs * 1000, 0, out);
  TimeRange seekRange = chunkSource.getSeekRange();

  assertNotNull(out.chunk);
  checkSeekRange(seekRange, seekRangeStartMs * 1000, seekRangeEndMs * 1000);
  assertEquals(chunkStartTimeMs * 1000, ((MediaChunk) out.chunk).startTimeUs);
  assertEquals(chunkEndTimeMs * 1000, ((MediaChunk) out.chunk).endTimeUs);
}
 
开发者ID:raphanda,项目名称:ExoPlayer,代码行数:12,代码来源:DashChunkSourceTest.java

示例12: onAvailableRangeChanged

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
@Override
public void onAvailableRangeChanged(int sourceId, TimeRange availableRange) {
    if (infoListener != null) {
        infoListener.onAvailableRangeChanged(sourceId, availableRange);
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:7,代码来源:DemoPlayer.java

示例13: onAvailableRangeChanged

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
@Override
public void onAvailableRangeChanged(int sourceId, TimeRange availableRange) {
  availableRangeValuesUs = availableRange.getCurrentBoundsUs(availableRangeValuesUs);
  Log.d(TAG, "availableRange [" + availableRange.isStatic() + ", " + availableRangeValuesUs[0]
      + ", " + availableRangeValuesUs[1] + "]");
}
 
开发者ID:Dreamxiaoxuan,项目名称:AndroidTvDemo,代码行数:7,代码来源:EventLogger.java

示例14: onAvailableRangeChanged

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
@Override
public void onAvailableRangeChanged(int sourceId, TimeRange availableRange) {
  if (infoListener != null) {
    infoListener.onAvailableRangeChanged(sourceId, availableRange);
  }
}
 
开发者ID:Dreamxiaoxuan,项目名称:AndroidTvDemo,代码行数:7,代码来源:DemoPlayer.java

示例15: onAvailableRangeChanged

import com.google.android.exoplayer.TimeRange; //导入依赖的package包/类
@Override
public void onAvailableRangeChanged(TimeRange availableRange) {
  availableRangeValuesUs = availableRange.getCurrentBoundsUs(availableRangeValuesUs);
  Log.d(TAG, "availableRange [" + availableRange.isStatic() + ", " + availableRangeValuesUs[0]
      + ", " + availableRangeValuesUs[1] + "]");
}
 
开发者ID:vuthanhict,项目名称:ExoPlayerController,代码行数:7,代码来源:EventLogger.java


注:本文中的com.google.android.exoplayer.TimeRange类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。