Java Code Examples for com.google.android.exoplayer2.Timeline#getUidOfPeriod()
The following examples show how to use
com.google.android.exoplayer2.Timeline#getUidOfPeriod() .
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: DefaultPlaybackSessionManager.java From MediaSDK with Apache License 2.0 | 6 votes |
private int resolveWindowIndexToNewTimeline( Timeline oldTimeline, Timeline newTimeline, int windowIndex) { if (windowIndex >= oldTimeline.getWindowCount()) { return windowIndex < newTimeline.getWindowCount() ? windowIndex : C.INDEX_UNSET; } oldTimeline.getWindow(windowIndex, window); for (int periodIndex = window.firstPeriodIndex; periodIndex <= window.lastPeriodIndex; periodIndex++) { Object periodUid = oldTimeline.getUidOfPeriod(periodIndex); int newPeriodIndex = newTimeline.getIndexOfPeriod(periodUid); if (newPeriodIndex != C.INDEX_UNSET) { return newTimeline.getPeriod(newPeriodIndex, period).windowIndex; } } return C.INDEX_UNSET; }
Example 2
Source File: AdsMediaSource.java From MediaSDK with Apache License 2.0 | 6 votes |
private void onAdSourceInfoRefreshed(MediaSource mediaSource, int adGroupIndex, int adIndexInAdGroup, Timeline timeline) { Assertions.checkArgument(timeline.getPeriodCount() == 1); adGroupTimelines[adGroupIndex][adIndexInAdGroup] = timeline; List<MaskingMediaPeriod> mediaPeriods = maskingMediaPeriodByAdMediaSource.remove(mediaSource); if (mediaPeriods != null) { Object periodUid = timeline.getUidOfPeriod(/* periodIndex= */ 0); for (int i = 0; i < mediaPeriods.size(); i++) { MaskingMediaPeriod mediaPeriod = mediaPeriods.get(i); MediaPeriodId adSourceMediaPeriodId = new MediaPeriodId(periodUid, mediaPeriod.id.windowSequenceNumber); mediaPeriod.createPeriod(adSourceMediaPeriodId); } } maybeUpdateSourceInfo(); }
Example 3
Source File: AdsMediaSource.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private void onAdSourceInfoRefreshed(MediaSource mediaSource, int adGroupIndex, int adIndexInAdGroup, Timeline timeline) { Assertions.checkArgument(timeline.getPeriodCount() == 1); adGroupTimelines[adGroupIndex][adIndexInAdGroup] = timeline; List<DeferredMediaPeriod> mediaPeriods = deferredMediaPeriodByAdMediaSource.remove(mediaSource); if (mediaPeriods != null) { Object periodUid = timeline.getUidOfPeriod(/* periodIndex= */ 0); for (int i = 0; i < mediaPeriods.size(); i++) { DeferredMediaPeriod mediaPeriod = mediaPeriods.get(i); MediaPeriodId adSourceMediaPeriodId = new MediaPeriodId(periodUid, mediaPeriod.id.windowSequenceNumber); mediaPeriod.createPeriod(adSourceMediaPeriodId); } } maybeUpdateSourceInfo(); }
Example 4
Source File: AdsMediaSource.java From Telegram with GNU General Public License v2.0 | 6 votes |
private void onAdSourceInfoRefreshed(MediaSource mediaSource, int adGroupIndex, int adIndexInAdGroup, Timeline timeline) { Assertions.checkArgument(timeline.getPeriodCount() == 1); adGroupTimelines[adGroupIndex][adIndexInAdGroup] = timeline; List<DeferredMediaPeriod> mediaPeriods = deferredMediaPeriodByAdMediaSource.remove(mediaSource); if (mediaPeriods != null) { Object periodUid = timeline.getUidOfPeriod(/* periodIndex= */ 0); for (int i = 0; i < mediaPeriods.size(); i++) { DeferredMediaPeriod mediaPeriod = mediaPeriods.get(i); MediaPeriodId adSourceMediaPeriodId = new MediaPeriodId(periodUid, mediaPeriod.id.windowSequenceNumber); mediaPeriod.createPeriod(adSourceMediaPeriodId); } } maybeUpdateSourceInfo(); }
Example 5
Source File: ConcatenatingMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public DeferredTimeline cloneWithNewTimeline(Timeline timeline) { return new DeferredTimeline( timeline, replacedId == DUMMY_ID && timeline.getPeriodCount() > 0 ? timeline.getUidOfPeriod(0) : replacedId); }
Example 6
Source File: ConcatenatingMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public DeferredTimeline cloneWithNewTimeline(Timeline timeline) { return new DeferredTimeline( timeline, replacedId == DUMMY_ID && timeline.getPeriodCount() > 0 ? timeline.getUidOfPeriod(0) : replacedId); }