Java Code Examples for com.google.android.exoplayer2.upstream.Loader#RETRY
The following examples show how to use
com.google.android.exoplayer2.upstream.Loader#RETRY .
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: DashMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
LoadErrorAction onManifestLoadError( ParsingLoadable<DashManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { boolean isFatal = error instanceof ParserException; manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY; }
Example 2
Source File: SsMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<SsManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { boolean isFatal = error instanceof ParserException; manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY; }
Example 3
Source File: DashMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
LoadErrorAction onManifestLoadError( ParsingLoadable<DashManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { boolean isFatal = error instanceof ParserException; manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY; }
Example 4
Source File: SsMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public LoadErrorAction onLoadError( ParsingLoadable<SsManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { boolean isFatal = error instanceof ParserException; manifestEventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY; }
Example 5
Source File: HlsPlaylistTracker.java From K-Sonic with MIT License | 6 votes |
@Override public int onLoadError(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { boolean isFatal = error instanceof ParserException; eventDispatcher.loadError(loadable.dataSpec, C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); if (isFatal) { return Loader.DONT_RETRY_FATAL; } boolean shouldRetry = true; if (ChunkedTrackBlacklistUtil.shouldBlacklist(error)) { blacklistUntilMs = SystemClock.elapsedRealtime() + ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS; notifyPlaylistBlacklisting(playlistUrl, ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS); shouldRetry = primaryHlsUrl == playlistUrl && !maybeSelectNewPrimaryUrl(); } return shouldRetry ? Loader.RETRY : Loader.DONT_RETRY; }
Example 6
Source File: SsMediaSource.java From K-Sonic with MIT License | 5 votes |
@Override public int onLoadError(ParsingLoadable<SsManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { boolean isFatal = error instanceof ParserException; eventDispatcher.loadError(loadable.dataSpec, loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY; }
Example 7
Source File: ExtractorMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( ExtractingLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { copyLengthFromLoader(loadable); LoadErrorAction retryAction; if (isLoadableExceptionFatal(error)) { retryAction = Loader.DONT_RETRY_FATAL; } else { int extractedSamplesCount = getExtractedSamplesCount(); boolean madeProgress = extractedSamplesCount > extractedSamplesCountAtStartOfLoad; retryAction = configureRetry(loadable, extractedSamplesCount) ? (madeProgress ? Loader.RETRY_RESET_ERROR_COUNT : Loader.RETRY) : Loader.DONT_RETRY; } boolean wasCanceled = retryAction == Loader.DONT_RETRY || retryAction == Loader.DONT_RETRY_FATAL; eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */ null, /* mediaStartTimeUs= */ loadable.seekTimeUs, durationUs, elapsedRealtimeMs, loadDurationMs, loadable.dataSource.getBytesRead(), error, wasCanceled); return retryAction; }
Example 8
Source File: DashMediaSource.java From K-Sonic with MIT License | 5 votes |
int onManifestLoadError(ParsingLoadable<DashManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { boolean isFatal = error instanceof ParserException; eventDispatcher.loadError(loadable.dataSpec, loadable.type, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY; }
Example 9
Source File: ChunkSampleStream.java From K-Sonic with MIT License | 5 votes |
@Override public int onLoadError(Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { long bytesLoaded = loadable.bytesLoaded(); boolean isMediaChunk = isMediaChunk(loadable); boolean cancelable = !isMediaChunk || bytesLoaded == 0 || mediaChunks.size() > 1; boolean canceled = false; if (chunkSource.onChunkLoadError(loadable, cancelable, error)) { canceled = true; if (isMediaChunk) { BaseMediaChunk removed = mediaChunks.removeLast(); Assertions.checkState(removed == loadable); primarySampleQueue.discardUpstreamSamples(removed.getFirstSampleIndex(0)); for (int i = 0; i < embeddedSampleQueues.length; i++) { embeddedSampleQueues[i].discardUpstreamSamples(removed.getFirstSampleIndex(i + 1)); } if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } } eventDispatcher.loadError(loadable.dataSpec, loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, bytesLoaded, error, canceled); if (canceled) { callback.onContinueLoadingRequested(this); return Loader.DONT_RETRY; } else { return Loader.RETRY; } }
Example 10
Source File: ExtractorMediaPeriod.java From K-Sonic with MIT License | 5 votes |
@Override public int onLoadError(ExtractingLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { copyLengthFromLoader(loadable); notifyLoadError(error); if (isLoadableExceptionFatal(error)) { return Loader.DONT_RETRY_FATAL; } int extractedSamplesCount = getExtractedSamplesCount(); boolean madeProgress = extractedSamplesCount > extractedSamplesCountAtStartOfLoad; configureRetry(loadable); // May reset the sample queues. extractedSamplesCountAtStartOfLoad = getExtractedSamplesCount(); return madeProgress ? Loader.RETRY_RESET_ERROR_COUNT : Loader.RETRY; }
Example 11
Source File: HlsSampleStreamWrapper.java From K-Sonic with MIT License | 5 votes |
@Override public int onLoadError(Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { long bytesLoaded = loadable.bytesLoaded(); boolean isMediaChunk = isMediaChunk(loadable); boolean cancelable = !isMediaChunk || bytesLoaded == 0; boolean canceled = false; if (chunkSource.onChunkLoadError(loadable, cancelable, error)) { if (isMediaChunk) { HlsMediaChunk removed = mediaChunks.removeLast(); Assertions.checkState(removed == loadable); if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } canceled = true; } eventDispatcher.loadError(loadable.dataSpec, loadable.type, trackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, canceled); if (canceled) { if (!prepared) { continueLoading(lastSeekPositionUs); } else { callback.onContinueLoadingRequested(this); } return Loader.DONT_RETRY; } else { return Loader.RETRY; } }
Example 12
Source File: HlsPlaylistTracker.java From K-Sonic with MIT License | 5 votes |
@Override public int onLoadError(ParsingLoadable<HlsPlaylist> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { boolean isFatal = error instanceof ParserException; eventDispatcher.loadError(loadable.dataSpec, C.DATA_TYPE_MANIFEST, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded(), error, isFatal); return isFatal ? Loader.DONT_RETRY_FATAL : Loader.RETRY; }
Example 13
Source File: SingleSampleMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( SourceLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { boolean cancel = treatLoadErrorsAsEndOfStream && errorCount >= minLoadableRetryCount; eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, format, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */ null, /* mediaStartTimeUs= */ 0, durationUs, elapsedRealtimeMs, loadDurationMs, loadable.dataSource.getBytesRead(), error, /* wasCanceled= */ cancel); if (cancel) { loadingFinished = true; return Loader.DONT_RETRY; } return Loader.RETRY; }
Example 14
Source File: ExtractorMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( ExtractingLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { copyLengthFromLoader(loadable); LoadErrorAction retryAction; if (isLoadableExceptionFatal(error)) { retryAction = Loader.DONT_RETRY_FATAL; } else { int extractedSamplesCount = getExtractedSamplesCount(); boolean madeProgress = extractedSamplesCount > extractedSamplesCountAtStartOfLoad; retryAction = configureRetry(loadable, extractedSamplesCount) ? (madeProgress ? Loader.RETRY_RESET_ERROR_COUNT : Loader.RETRY) : Loader.DONT_RETRY; } boolean wasCanceled = retryAction == Loader.DONT_RETRY || retryAction == Loader.DONT_RETRY_FATAL; eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, /* trackFormat= */ null, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */ null, /* mediaStartTimeUs= */ loadable.seekTimeUs, durationUs, elapsedRealtimeMs, loadDurationMs, loadable.dataSource.getBytesRead(), error, wasCanceled); return retryAction; }
Example 15
Source File: SingleSampleMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public LoadErrorAction onLoadError( SourceLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { boolean cancel = treatLoadErrorsAsEndOfStream && errorCount >= minLoadableRetryCount; eventDispatcher.loadError( loadable.dataSpec, loadable.dataSource.getLastOpenedUri(), C.DATA_TYPE_MEDIA, C.TRACK_TYPE_UNKNOWN, format, C.SELECTION_REASON_UNKNOWN, /* trackSelectionData= */ null, /* mediaStartTimeUs= */ 0, durationUs, elapsedRealtimeMs, loadDurationMs, loadable.dataSource.getBytesRead(), error, /* wasCanceled= */ cancel); if (cancel) { loadingFinished = true; return Loader.DONT_RETRY; } return Loader.RETRY; }
Example 16
Source File: ChunkSampleStream.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public LoadErrorAction onLoadError( Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long bytesLoaded = loadable.bytesLoaded(); boolean isMediaChunk = isMediaChunk(loadable); int lastChunkIndex = mediaChunks.size() - 1; boolean cancelable = bytesLoaded == 0 || !isMediaChunk || !haveReadFromMediaChunk(lastChunkIndex); boolean canceled = false; if (chunkSource.onChunkLoadError(loadable, cancelable, error)) { if (!cancelable) { Log.w(TAG, "Ignoring attempt to cancel non-cancelable load."); } else { canceled = true; if (isMediaChunk) { BaseMediaChunk removed = discardUpstreamMediaChunksFromIndex(lastChunkIndex); Assertions.checkState(removed == loadable); if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } } } eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, bytesLoaded, error, canceled); if (canceled) { callback.onContinueLoadingRequested(this); return Loader.DONT_RETRY; } else { return Loader.RETRY; } }
Example 17
Source File: SingleSampleMediaPeriod.java From K-Sonic with MIT License | 4 votes |
@Override public int onLoadError(SourceLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error) { notifyLoadError(error); return Loader.RETRY; }
Example 18
Source File: ChunkSampleStream.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public LoadErrorAction onLoadError( Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { long bytesLoaded = loadable.bytesLoaded(); boolean isMediaChunk = isMediaChunk(loadable); int lastChunkIndex = mediaChunks.size() - 1; boolean cancelable = bytesLoaded == 0 || !isMediaChunk || !haveReadFromMediaChunk(lastChunkIndex); boolean canceled = false; if (chunkSource.onChunkLoadError(loadable, cancelable, error)) { if (!cancelable) { Log.w(TAG, "Ignoring attempt to cancel non-cancelable load."); } else { canceled = true; if (isMediaChunk) { BaseMediaChunk removed = discardUpstreamMediaChunksFromIndex(lastChunkIndex); Assertions.checkState(removed == loadable); if (mediaChunks.isEmpty()) { pendingResetPositionUs = lastSeekPositionUs; } } } } eventDispatcher.loadError( loadable.dataSpec, loadable.getUri(), loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, bytesLoaded, error, canceled); if (canceled) { callback.onContinueLoadingRequested(this); return Loader.DONT_RETRY; } else { return Loader.RETRY; } }