Java Code Examples for com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement#getStartTimeUs()
The following examples show how to use
com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement#getStartTimeUs() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultSsChunkSource.java From MediaSDK with Apache License 2.0 | 6 votes |
@Override public void updateManifest(SsManifest newManifest) { StreamElement currentElement = manifest.streamElements[streamElementIndex]; int currentElementChunkCount = currentElement.chunkCount; StreamElement newElement = newManifest.streamElements[streamElementIndex]; if (currentElementChunkCount == 0 || newElement.chunkCount == 0) { // There's no overlap between the old and new elements because at least one is empty. currentManifestChunkOffset += currentElementChunkCount; } else { long currentElementEndTimeUs = currentElement.getStartTimeUs(currentElementChunkCount - 1) + currentElement.getChunkDurationUs(currentElementChunkCount - 1); long newElementStartTimeUs = newElement.getStartTimeUs(0); if (currentElementEndTimeUs <= newElementStartTimeUs) { // There's no overlap between the old and new elements. currentManifestChunkOffset += currentElementChunkCount; } else { // The new element overlaps with the old one. currentManifestChunkOffset += currentElement.getChunkIndex(newElementStartTimeUs); } } manifest = newManifest; }
Example 2
Source File: DefaultSsChunkSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void updateManifest(SsManifest newManifest) { StreamElement currentElement = manifest.streamElements[streamElementIndex]; int currentElementChunkCount = currentElement.chunkCount; StreamElement newElement = newManifest.streamElements[streamElementIndex]; if (currentElementChunkCount == 0 || newElement.chunkCount == 0) { // There's no overlap between the old and new elements because at least one is empty. currentManifestChunkOffset += currentElementChunkCount; } else { long currentElementEndTimeUs = currentElement.getStartTimeUs(currentElementChunkCount - 1) + currentElement.getChunkDurationUs(currentElementChunkCount - 1); long newElementStartTimeUs = newElement.getStartTimeUs(0); if (currentElementEndTimeUs <= newElementStartTimeUs) { // There's no overlap between the old and new elements. currentManifestChunkOffset += currentElementChunkCount; } else { // The new element overlaps with the old one. currentManifestChunkOffset += currentElement.getChunkIndex(newElementStartTimeUs); } } manifest = newManifest; }
Example 3
Source File: DefaultSsChunkSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void updateManifest(SsManifest newManifest) { StreamElement currentElement = manifest.streamElements[streamElementIndex]; int currentElementChunkCount = currentElement.chunkCount; StreamElement newElement = newManifest.streamElements[streamElementIndex]; if (currentElementChunkCount == 0 || newElement.chunkCount == 0) { // There's no overlap between the old and new elements because at least one is empty. currentManifestChunkOffset += currentElementChunkCount; } else { long currentElementEndTimeUs = currentElement.getStartTimeUs(currentElementChunkCount - 1) + currentElement.getChunkDurationUs(currentElementChunkCount - 1); long newElementStartTimeUs = newElement.getStartTimeUs(0); if (currentElementEndTimeUs <= newElementStartTimeUs) { // There's no overlap between the old and new elements. currentManifestChunkOffset += currentElementChunkCount; } else { // The new element overlaps with the old one. currentManifestChunkOffset += currentElement.getChunkIndex(newElementStartTimeUs); } } manifest = newManifest; }
Example 4
Source File: DefaultSsChunkSource.java From K-Sonic with MIT License | 6 votes |
@Override public void updateManifest(SsManifest newManifest) { StreamElement currentElement = manifest.streamElements[elementIndex]; int currentElementChunkCount = currentElement.chunkCount; StreamElement newElement = newManifest.streamElements[elementIndex]; if (currentElementChunkCount == 0 || newElement.chunkCount == 0) { // There's no overlap between the old and new elements because at least one is empty. currentManifestChunkOffset += currentElementChunkCount; } else { long currentElementEndTimeUs = currentElement.getStartTimeUs(currentElementChunkCount - 1) + currentElement.getChunkDurationUs(currentElementChunkCount - 1); long newElementStartTimeUs = newElement.getStartTimeUs(0); if (currentElementEndTimeUs <= newElementStartTimeUs) { // There's no overlap between the old and new elements. currentManifestChunkOffset += currentElementChunkCount; } else { // The new element overlaps with the old one. currentManifestChunkOffset += currentElement.getChunkIndex(newElementStartTimeUs); } } manifest = newManifest; }
Example 5
Source File: DefaultSsChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void updateManifest(SsManifest newManifest) { StreamElement currentElement = manifest.streamElements[streamElementIndex]; int currentElementChunkCount = currentElement.chunkCount; StreamElement newElement = newManifest.streamElements[streamElementIndex]; if (currentElementChunkCount == 0 || newElement.chunkCount == 0) { // There's no overlap between the old and new elements because at least one is empty. currentManifestChunkOffset += currentElementChunkCount; } else { long currentElementEndTimeUs = currentElement.getStartTimeUs(currentElementChunkCount - 1) + currentElement.getChunkDurationUs(currentElementChunkCount - 1); long newElementStartTimeUs = newElement.getStartTimeUs(0); if (currentElementEndTimeUs <= newElementStartTimeUs) { // There's no overlap between the old and new elements. currentManifestChunkOffset += currentElementChunkCount; } else { // The new element overlaps with the old one. currentManifestChunkOffset += currentElement.getChunkIndex(newElementStartTimeUs); } } manifest = newManifest; }
Example 6
Source File: DefaultSsChunkSource.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void updateManifest(SsManifest newManifest) { StreamElement currentElement = manifest.streamElements[streamElementIndex]; int currentElementChunkCount = currentElement.chunkCount; StreamElement newElement = newManifest.streamElements[streamElementIndex]; if (currentElementChunkCount == 0 || newElement.chunkCount == 0) { // There's no overlap between the old and new elements because at least one is empty. currentManifestChunkOffset += currentElementChunkCount; } else { long currentElementEndTimeUs = currentElement.getStartTimeUs(currentElementChunkCount - 1) + currentElement.getChunkDurationUs(currentElementChunkCount - 1); long newElementStartTimeUs = newElement.getStartTimeUs(0); if (currentElementEndTimeUs <= newElementStartTimeUs) { // There's no overlap between the old and new elements. currentManifestChunkOffset += currentElementChunkCount; } else { // The new element overlaps with the old one. currentManifestChunkOffset += currentElement.getChunkIndex(newElementStartTimeUs); } } manifest = newManifest; }
Example 7
Source File: DefaultSsChunkSource.java From MediaSDK with Apache License 2.0 | 5 votes |
@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); }
Example 8
Source File: DefaultSsChunkSource.java From MediaSDK with Apache License 2.0 | 5 votes |
private long resolveTimeToLiveEdgeUs(long playbackPositionUs) { if (!manifest.isLive) { return C.TIME_UNSET; } StreamElement currentElement = manifest.streamElements[streamElementIndex]; int lastChunkIndex = currentElement.chunkCount - 1; long lastChunkEndTimeUs = currentElement.getStartTimeUs(lastChunkIndex) + currentElement.getChunkDurationUs(lastChunkIndex); return lastChunkEndTimeUs - playbackPositionUs; }
Example 9
Source File: DefaultSsChunkSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@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); }
Example 10
Source File: DefaultSsChunkSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private long resolveTimeToLiveEdgeUs(long playbackPositionUs) { if (!manifest.isLive) { return C.TIME_UNSET; } StreamElement currentElement = manifest.streamElements[streamElementIndex]; int lastChunkIndex = currentElement.chunkCount - 1; long lastChunkEndTimeUs = currentElement.getStartTimeUs(lastChunkIndex) + currentElement.getChunkDurationUs(lastChunkIndex); return lastChunkEndTimeUs - playbackPositionUs; }
Example 11
Source File: DefaultSsChunkSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@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); }
Example 12
Source File: DefaultSsChunkSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private long resolveTimeToLiveEdgeUs(long playbackPositionUs) { if (!manifest.isLive) { return C.TIME_UNSET; } StreamElement currentElement = manifest.streamElements[streamElementIndex]; int lastChunkIndex = currentElement.chunkCount - 1; long lastChunkEndTimeUs = currentElement.getStartTimeUs(lastChunkIndex) + currentElement.getChunkDurationUs(lastChunkIndex); return lastChunkEndTimeUs - playbackPositionUs; }
Example 13
Source File: DefaultSsChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@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); }
Example 14
Source File: DefaultSsChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private long resolveTimeToLiveEdgeUs(long playbackPositionUs) { if (!manifest.isLive) { return C.TIME_UNSET; } StreamElement currentElement = manifest.streamElements[streamElementIndex]; int lastChunkIndex = currentElement.chunkCount - 1; long lastChunkEndTimeUs = currentElement.getStartTimeUs(lastChunkIndex) + currentElement.getChunkDurationUs(lastChunkIndex); return lastChunkEndTimeUs - playbackPositionUs; }
Example 15
Source File: DefaultSsChunkSource.java From Telegram with GNU General Public License v2.0 | 5 votes |
@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); }
Example 16
Source File: DefaultSsChunkSource.java From Telegram with GNU General Public License v2.0 | 5 votes |
private long resolveTimeToLiveEdgeUs(long playbackPositionUs) { if (!manifest.isLive) { return C.TIME_UNSET; } StreamElement currentElement = manifest.streamElements[streamElementIndex]; int lastChunkIndex = currentElement.chunkCount - 1; long lastChunkEndTimeUs = currentElement.getStartTimeUs(lastChunkIndex) + currentElement.getChunkDurationUs(lastChunkIndex); return lastChunkEndTimeUs - playbackPositionUs; }