use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.
the class FakeMediaPeriod method prepare.
@Override
public synchronized void prepare(Callback callback, long positionUs) {
mediaSourceEventDispatcher.loadStarted(new LoadEventInfo(fakePreparationLoadTaskId, FAKE_DATA_SPEC, SystemClock.elapsedRealtime()), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */
null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
null, /* mediaStartTimeUs= */
0, /* mediaEndTimeUs = */
C.TIME_UNSET);
prepareCallback = callback;
if (deferOnPrepared) {
playerHandler = Util.createHandlerForCurrentLooper();
} else {
finishPreparation();
}
}
use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.
the class FakeMediaSource method finishSourcePreparation.
private void finishSourcePreparation(boolean sendManifestLoadEvents) {
refreshSourceInfo(Assertions.checkStateNotNull(timeline));
if (!timeline.isEmpty() && sendManifestLoadEvents) {
MediaLoadData mediaLoadData = new MediaLoadData(C.DATA_TYPE_MANIFEST, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */
null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
null, /* mediaStartTimeMs= */
C.TIME_UNSET, /* mediaEndTimeMs = */
C.TIME_UNSET);
long elapsedRealTimeMs = SystemClock.elapsedRealtime();
MediaSourceEventListener.EventDispatcher eventDispatcher = createEventDispatcher(/* mediaPeriodId= */
null);
long loadTaskId = LoadEventInfo.getNewId();
eventDispatcher.loadStarted(new LoadEventInfo(loadTaskId, FAKE_DATA_SPEC, FAKE_DATA_SPEC.uri, /* responseHeaders= */
ImmutableMap.of(), elapsedRealTimeMs, /* loadDurationMs= */
0, /* bytesLoaded= */
0), mediaLoadData);
eventDispatcher.loadCompleted(new LoadEventInfo(loadTaskId, FAKE_DATA_SPEC, FAKE_DATA_SPEC.uri, /* responseHeaders= */
ImmutableMap.of(), elapsedRealTimeMs, /* loadDurationMs= */
0, /* bytesLoaded= */
MANIFEST_LOAD_BYTES), mediaLoadData);
}
}
use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.
the class FakeMediaPeriod method finishPreparation.
private void finishPreparation() {
prepared = true;
Util.castNonNull(prepareCallback).onPrepared(this);
mediaSourceEventDispatcher.loadCompleted(new LoadEventInfo(fakePreparationLoadTaskId, FAKE_DATA_SPEC, FAKE_DATA_SPEC.uri, /* responseHeaders= */
Collections.emptyMap(), SystemClock.elapsedRealtime(), /* loadDurationMs= */
0, /* bytesLoaded= */
100), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */
null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
null, /* mediaStartTimeUs= */
0, /* mediaEndTimeUs = */
C.TIME_UNSET);
}
use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.
the class FakeAdaptiveMediaPeriod method prepare.
@Override
public void prepare(Callback callback, long positionUs) {
mediaSourceEventDispatcher.loadStarted(new LoadEventInfo(fakePreparationLoadTaskId, FAKE_DATA_SPEC, SystemClock.elapsedRealtime()), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */
null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
null, /* mediaStartTimeUs= */
0, /* mediaEndTimeUs = */
C.TIME_UNSET);
this.callback = callback;
prepared = true;
Util.castNonNull(this.callback).onPrepared(this);
mediaSourceEventDispatcher.loadCompleted(new LoadEventInfo(fakePreparationLoadTaskId, FAKE_DATA_SPEC, FAKE_DATA_SPEC.uri, /* responseHeaders= */
ImmutableMap.of(), SystemClock.elapsedRealtime(), /* loadDurationMs= */
0, /* bytesLoaded= */
100), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */
null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
null, /* mediaStartTimeUs= */
0, /* mediaEndTimeUs = */
C.TIME_UNSET);
}
use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.
the class DefaultAnalyticsCollector method onLoadError.
@Override
public final void onLoadError(int windowIndex, @Nullable MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, IOException error, boolean wasCanceled) {
EventTime eventTime = generateMediaPeriodEventTime(windowIndex, mediaPeriodId);
sendEvent(eventTime, AnalyticsListener.EVENT_LOAD_ERROR, listener -> listener.onLoadError(eventTime, loadEventInfo, mediaLoadData, error, wasCanceled));
}
Aggregations