Search in sources :

Example 36 with LoadEventInfo

use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.

the class DashMediaSource method startLoading.

private <T> void startLoading(ParsingLoadable<T> loadable, Loader.Callback<ParsingLoadable<T>> callback, int minRetryCount) {
    long elapsedRealtimeMs = loader.startLoading(loadable, callback, minRetryCount);
    manifestEventDispatcher.loadStarted(new LoadEventInfo(loadable.loadTaskId, loadable.dataSpec, elapsedRealtimeMs), loadable.type);
}
Also used : LoadEventInfo(com.google.android.exoplayer2.source.LoadEventInfo)

Example 37 with LoadEventInfo

use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.

the class ChunkSampleStream method onLoadCompleted.

// Loader.Callback implementation.
@Override
public void onLoadCompleted(Chunk loadable, long elapsedRealtimeMs, long loadDurationMs) {
    loadingChunk = null;
    chunkSource.onChunkLoadCompleted(loadable);
    LoadEventInfo loadEventInfo = new LoadEventInfo(loadable.loadTaskId, loadable.dataSpec, loadable.getUri(), loadable.getResponseHeaders(), elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded());
    loadErrorHandlingPolicy.onLoadTaskConcluded(loadable.loadTaskId);
    mediaSourceEventDispatcher.loadCompleted(loadEventInfo, loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs);
    callback.onContinueLoadingRequested(this);
}
Also used : LoadEventInfo(com.google.android.exoplayer2.source.LoadEventInfo)

Example 38 with LoadEventInfo

use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.

the class SingleSampleMediaPeriod method onLoadCanceled.

@Override
public void onLoadCanceled(SourceLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released) {
    StatsDataSource dataSource = loadable.dataSource;
    LoadEventInfo loadEventInfo = new LoadEventInfo(loadable.loadTaskId, loadable.dataSpec, dataSource.getLastOpenedUri(), dataSource.getLastResponseHeaders(), elapsedRealtimeMs, loadDurationMs, dataSource.getBytesRead());
    loadErrorHandlingPolicy.onLoadTaskConcluded(loadable.loadTaskId);
    eventDispatcher.loadCanceled(loadEventInfo, C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */
    null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
    null, /* mediaStartTimeUs= */
    0, durationUs);
}
Also used : StatsDataSource(com.google.android.exoplayer2.upstream.StatsDataSource)

Example 39 with LoadEventInfo

use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.

the class SingleSampleMediaPeriod method continueLoading.

@Override
public boolean continueLoading(long positionUs) {
    if (loadingFinished || loader.isLoading() || loader.hasFatalError()) {
        return false;
    }
    DataSource dataSource = dataSourceFactory.createDataSource();
    if (transferListener != null) {
        dataSource.addTransferListener(transferListener);
    }
    SourceLoadable loadable = new SourceLoadable(dataSpec, dataSource);
    long elapsedRealtimeMs = loader.startLoading(loadable, /* callback= */
    this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(C.DATA_TYPE_MEDIA));
    eventDispatcher.loadStarted(new LoadEventInfo(loadable.loadTaskId, dataSpec, elapsedRealtimeMs), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, format, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
    null, /* mediaStartTimeUs= */
    0, durationUs);
    return true;
}
Also used : StatsDataSource(com.google.android.exoplayer2.upstream.StatsDataSource) DataSource(com.google.android.exoplayer2.upstream.DataSource)

Example 40 with LoadEventInfo

use of com.google.android.exoplayer2.source.LoadEventInfo in project ExoPlayer by google.

the class ProgressiveMediaPeriod method startLoading.

private void startLoading() {
    ExtractingLoadable loadable = new ExtractingLoadable(uri, dataSource, progressiveMediaExtractor, /* extractorOutput= */
    this, loadCondition);
    if (prepared) {
        Assertions.checkState(isPendingReset());
        if (durationUs != C.TIME_UNSET && pendingResetPositionUs > durationUs) {
            loadingFinished = true;
            pendingResetPositionUs = C.TIME_UNSET;
            return;
        }
        loadable.setLoadPosition(Assertions.checkNotNull(seekMap).getSeekPoints(pendingResetPositionUs).first.position, pendingResetPositionUs);
        for (SampleQueue sampleQueue : sampleQueues) {
            sampleQueue.setStartTimeUs(pendingResetPositionUs);
        }
        pendingResetPositionUs = C.TIME_UNSET;
    }
    extractedSamplesCountAtStartOfLoad = getExtractedSamplesCount();
    long elapsedRealtimeMs = loader.startLoading(loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(dataType));
    DataSpec dataSpec = loadable.dataSpec;
    mediaSourceEventDispatcher.loadStarted(new LoadEventInfo(loadable.loadTaskId, dataSpec, elapsedRealtimeMs), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */
    null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */
    null, /* mediaStartTimeUs= */
    loadable.seekTimeUs, durationUs);
}
Also used : DataSpec(com.google.android.exoplayer2.upstream.DataSpec)

Aggregations

LoadEventInfo (com.google.android.exoplayer2.source.LoadEventInfo)27 MediaLoadData (com.google.android.exoplayer2.source.MediaLoadData)7 LoadErrorInfo (com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy.LoadErrorInfo)7 StatsDataSource (com.google.android.exoplayer2.upstream.StatsDataSource)7 LoadErrorAction (com.google.android.exoplayer2.upstream.Loader.LoadErrorAction)6 Nullable (androidx.annotation.Nullable)4 EventTime (com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime)4 SampleQueue (com.google.android.exoplayer2.source.SampleQueue)2 HttpDataSource (com.google.android.exoplayer2.upstream.HttpDataSource)2 ParsingLoadable (com.google.android.exoplayer2.upstream.ParsingLoadable)2 Uri (android.net.Uri)1 Timeline (com.google.android.exoplayer2.Timeline)1 MediaPeriod (com.google.android.exoplayer2.source.MediaPeriod)1 MediaPeriodId (com.google.android.exoplayer2.source.MediaSource.MediaPeriodId)1 MediaSourceEventListener (com.google.android.exoplayer2.source.MediaSourceEventListener)1 Chunk (com.google.android.exoplayer2.source.chunk.Chunk)1 DashManifest (com.google.android.exoplayer2.source.dash.manifest.DashManifest)1 SsManifest (com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest)1 DataSource (com.google.android.exoplayer2.upstream.DataSource)1 DataSpec (com.google.android.exoplayer2.upstream.DataSpec)1