Search in sources :

Example 26 with TransferListener

use of com.google.android.exoplayer2.upstream.TransferListener 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)

Aggregations

Test (org.junit.Test)17 Nullable (androidx.annotation.Nullable)15 TransferListener (com.google.android.exoplayer2.upstream.TransferListener)15 FakeMediaSource (com.google.android.exoplayer2.testutil.FakeMediaSource)14 FakeTimeline (com.google.android.exoplayer2.testutil.FakeTimeline)14 MediaPeriodId (com.google.android.exoplayer2.source.MediaSource.MediaPeriodId)13 TrackGroupArray (com.google.android.exoplayer2.source.TrackGroupArray)13 FakeMediaPeriod (com.google.android.exoplayer2.testutil.FakeMediaPeriod)13 Allocator (com.google.android.exoplayer2.upstream.Allocator)13 DrmSessionManager (com.google.android.exoplayer2.drm.DrmSessionManager)12 TestExoPlayerBuilder (com.google.android.exoplayer2.testutil.TestExoPlayerBuilder)11 ExoPlayerTestRunner (com.google.android.exoplayer2.testutil.ExoPlayerTestRunner)8 ClippingMediaSource (com.google.android.exoplayer2.source.ClippingMediaSource)7 CompositeMediaSource (com.google.android.exoplayer2.source.CompositeMediaSource)7 ConcatenatingMediaSource (com.google.android.exoplayer2.source.ConcatenatingMediaSource)7 MaskingMediaSource (com.google.android.exoplayer2.source.MaskingMediaSource)7 MediaSource (com.google.android.exoplayer2.source.MediaSource)7 SinglePeriodTimeline (com.google.android.exoplayer2.source.SinglePeriodTimeline)7 ServerSideAdInsertionMediaSource (com.google.android.exoplayer2.source.ads.ServerSideAdInsertionMediaSource)7 ActionSchedule (com.google.android.exoplayer2.testutil.ActionSchedule)7