Java Code Examples for com.google.android.exoplayer2.C#DATA_TYPE_MEDIA_PROGRESSIVE_LIVE
The following examples show how to use
com.google.android.exoplayer2.C#DATA_TYPE_MEDIA_PROGRESSIVE_LIVE .
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: ProgressiveMediaPeriod.java From MediaSDK with Apache License 2.0 | 5 votes |
@Override public long seekToUs(long positionUs) { PreparedState preparedState = getPreparedState(); SeekMap seekMap = preparedState.seekMap; boolean[] trackIsAudioVideoFlags = preparedState.trackIsAudioVideoFlags; // Treat all seeks into non-seekable media as being to t=0. positionUs = seekMap.isSeekable() ? positionUs : 0; notifyDiscontinuity = false; lastSeekPositionUs = positionUs; if (isPendingReset()) { // A reset is already pending. We only need to update its position. pendingResetPositionUs = positionUs; return positionUs; } // If we're not playing a live stream, try and seek within the buffer. if (dataType != C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE && seekInsideBufferUs(trackIsAudioVideoFlags, positionUs)) { return positionUs; } // We can't seek inside the buffer, and so need to reset. pendingDeferredRetry = false; pendingResetPositionUs = positionUs; loadingFinished = false; if (loader.isLoading()) { loader.cancelLoading(); } else { loader.clearFatalError(); for (SampleQueue sampleQueue : sampleQueues) { sampleQueue.reset(); } } return positionUs; }
Example 2
Source File: DefaultLoadErrorHandlingPolicy.java From MediaSDK with Apache License 2.0 | 5 votes |
/** * See {@link #DefaultLoadErrorHandlingPolicy()} and {@link #DefaultLoadErrorHandlingPolicy(int)} * for documentation about the behavior of this method. */ @Override public int getMinimumLoadableRetryCount(int dataType) { if (minimumLoadableRetryCount == DEFAULT_BEHAVIOR_MIN_LOADABLE_RETRY_COUNT) { return dataType == C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE ? DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE : DEFAULT_MIN_LOADABLE_RETRY_COUNT; } else { return minimumLoadableRetryCount; } }
Example 3
Source File: ProgressiveMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public long seekToUs(long positionUs) { PreparedState preparedState = getPreparedState(); SeekMap seekMap = preparedState.seekMap; boolean[] trackIsAudioVideoFlags = preparedState.trackIsAudioVideoFlags; // Treat all seeks into non-seekable media as being to t=0. positionUs = seekMap.isSeekable() ? positionUs : 0; notifyDiscontinuity = false; lastSeekPositionUs = positionUs; if (isPendingReset()) { // A reset is already pending. We only need to update its position. pendingResetPositionUs = positionUs; return positionUs; } // If we're not playing a live stream, try and seek within the buffer. if (dataType != C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE && seekInsideBufferUs(trackIsAudioVideoFlags, positionUs)) { return positionUs; } // We can't seek inside the buffer, and so need to reset. pendingDeferredRetry = false; pendingResetPositionUs = positionUs; loadingFinished = false; if (loader.isLoading()) { loader.cancelLoading(); } else { loader.clearFatalError(); for (SampleQueue sampleQueue : sampleQueues) { sampleQueue.reset(); } } return positionUs; }
Example 4
Source File: DefaultLoadErrorHandlingPolicy.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * See {@link #DefaultLoadErrorHandlingPolicy()} and {@link #DefaultLoadErrorHandlingPolicy(int)} * for documentation about the behavior of this method. */ @Override public int getMinimumLoadableRetryCount(int dataType) { if (minimumLoadableRetryCount == DEFAULT_BEHAVIOR_MIN_LOADABLE_RETRY_COUNT) { return dataType == C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE ? DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE : DEFAULT_MIN_LOADABLE_RETRY_COUNT; } else { return minimumLoadableRetryCount; } }
Example 5
Source File: ProgressiveMediaPeriod.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public long seekToUs(long positionUs) { PreparedState preparedState = getPreparedState(); SeekMap seekMap = preparedState.seekMap; boolean[] trackIsAudioVideoFlags = preparedState.trackIsAudioVideoFlags; // Treat all seeks into non-seekable media as being to t=0. positionUs = seekMap.isSeekable() ? positionUs : 0; notifyDiscontinuity = false; lastSeekPositionUs = positionUs; if (isPendingReset()) { // A reset is already pending. We only need to update its position. pendingResetPositionUs = positionUs; return positionUs; } // If we're not playing a live stream, try and seek within the buffer. if (dataType != C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE && seekInsideBufferUs(trackIsAudioVideoFlags, positionUs)) { return positionUs; } // We can't seek inside the buffer, and so need to reset. pendingDeferredRetry = false; pendingResetPositionUs = positionUs; loadingFinished = false; if (loader.isLoading()) { loader.cancelLoading(); } else { loader.clearFatalError(); for (SampleQueue sampleQueue : sampleQueues) { sampleQueue.reset(); } } return positionUs; }
Example 6
Source File: DefaultLoadErrorHandlingPolicy.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * See {@link #DefaultLoadErrorHandlingPolicy()} and {@link #DefaultLoadErrorHandlingPolicy(int)} * for documentation about the behavior of this method. */ @Override public int getMinimumLoadableRetryCount(int dataType) { if (minimumLoadableRetryCount == DEFAULT_BEHAVIOR_MIN_LOADABLE_RETRY_COUNT) { return dataType == C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE ? DEFAULT_MIN_LOADABLE_RETRY_COUNT_PROGRESSIVE_LIVE : DEFAULT_MIN_LOADABLE_RETRY_COUNT; } else { return minimumLoadableRetryCount; } }
Example 7
Source File: ProgressiveMediaPeriod.java From MediaSDK with Apache License 2.0 | 4 votes |
private void maybeFinishPrepare() { SeekMap seekMap = this.seekMap; if (released || prepared || !sampleQueuesBuilt || seekMap == null) { return; } for (SampleQueue sampleQueue : sampleQueues) { if (sampleQueue.getUpstreamFormat() == null) { return; } } loadCondition.close(); int trackCount = sampleQueues.length; TrackGroup[] trackArray = new TrackGroup[trackCount]; boolean[] trackIsAudioVideoFlags = new boolean[trackCount]; durationUs = seekMap.getDurationUs(); for (int i = 0; i < trackCount; i++) { Format trackFormat = sampleQueues[i].getUpstreamFormat(); String mimeType = trackFormat.sampleMimeType; boolean isAudio = MimeTypes.isAudio(mimeType); boolean isAudioVideo = isAudio || MimeTypes.isVideo(mimeType); trackIsAudioVideoFlags[i] = isAudioVideo; haveAudioVideoTracks |= isAudioVideo; IcyHeaders icyHeaders = this.icyHeaders; if (icyHeaders != null) { if (isAudio || sampleQueueTrackIds[i].isIcyTrack) { Metadata metadata = trackFormat.metadata; trackFormat = trackFormat.copyWithMetadata( metadata == null ? new Metadata(icyHeaders) : metadata.copyWithAppendedEntries(icyHeaders)); } if (isAudio && trackFormat.bitrate == Format.NO_VALUE && icyHeaders.bitrate != Format.NO_VALUE) { trackFormat = trackFormat.copyWithBitrate(icyHeaders.bitrate); } } trackArray[i] = new TrackGroup(trackFormat); } isLive = length == C.LENGTH_UNSET && seekMap.getDurationUs() == C.TIME_UNSET; dataType = isLive ? C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE : C.DATA_TYPE_MEDIA; preparedState = new PreparedState(seekMap, new TrackGroupArray(trackArray), trackIsAudioVideoFlags); prepared = true; listener.onSourceInfoRefreshed(durationUs, seekMap.isSeekable(), isLive); Assertions.checkNotNull(callback).onPrepared(this); }
Example 8
Source File: ProgressiveMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
private void maybeFinishPrepare() { SeekMap seekMap = this.seekMap; if (released || prepared || !sampleQueuesBuilt || seekMap == null) { return; } for (SampleQueue sampleQueue : sampleQueues) { if (sampleQueue.getUpstreamFormat() == null) { return; } } loadCondition.close(); int trackCount = sampleQueues.length; TrackGroup[] trackArray = new TrackGroup[trackCount]; boolean[] trackIsAudioVideoFlags = new boolean[trackCount]; durationUs = seekMap.getDurationUs(); for (int i = 0; i < trackCount; i++) { Format trackFormat = sampleQueues[i].getUpstreamFormat(); String mimeType = trackFormat.sampleMimeType; boolean isAudio = MimeTypes.isAudio(mimeType); boolean isAudioVideo = isAudio || MimeTypes.isVideo(mimeType); trackIsAudioVideoFlags[i] = isAudioVideo; haveAudioVideoTracks |= isAudioVideo; IcyHeaders icyHeaders = this.icyHeaders; if (icyHeaders != null) { if (isAudio || sampleQueueTrackIds[i].isIcyTrack) { Metadata metadata = trackFormat.metadata; trackFormat = trackFormat.copyWithMetadata( metadata == null ? new Metadata(icyHeaders) : metadata.copyWithAppendedEntries(icyHeaders)); } if (isAudio && trackFormat.bitrate == Format.NO_VALUE && icyHeaders.bitrate != Format.NO_VALUE) { trackFormat = trackFormat.copyWithBitrate(icyHeaders.bitrate); } } trackArray[i] = new TrackGroup(trackFormat); } dataType = length == C.LENGTH_UNSET && seekMap.getDurationUs() == C.TIME_UNSET ? C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE : C.DATA_TYPE_MEDIA; preparedState = new PreparedState(seekMap, new TrackGroupArray(trackArray), trackIsAudioVideoFlags); prepared = true; listener.onSourceInfoRefreshed(durationUs, seekMap.isSeekable()); Assertions.checkNotNull(callback).onPrepared(this); }
Example 9
Source File: ProgressiveMediaPeriod.java From Telegram with GNU General Public License v2.0 | 4 votes |
private void maybeFinishPrepare() { SeekMap seekMap = this.seekMap; if (released || prepared || !sampleQueuesBuilt || seekMap == null) { return; } for (SampleQueue sampleQueue : sampleQueues) { if (sampleQueue.getUpstreamFormat() == null) { return; } } loadCondition.close(); int trackCount = sampleQueues.length; TrackGroup[] trackArray = new TrackGroup[trackCount]; boolean[] trackIsAudioVideoFlags = new boolean[trackCount]; durationUs = seekMap.getDurationUs(); for (int i = 0; i < trackCount; i++) { Format trackFormat = sampleQueues[i].getUpstreamFormat(); String mimeType = trackFormat.sampleMimeType; boolean isAudio = MimeTypes.isAudio(mimeType); boolean isAudioVideo = isAudio || MimeTypes.isVideo(mimeType); trackIsAudioVideoFlags[i] = isAudioVideo; haveAudioVideoTracks |= isAudioVideo; IcyHeaders icyHeaders = this.icyHeaders; if (icyHeaders != null) { if (isAudio || sampleQueueTrackIds[i].isIcyTrack) { Metadata metadata = trackFormat.metadata; trackFormat = trackFormat.copyWithMetadata( metadata == null ? new Metadata(icyHeaders) : metadata.copyWithAppendedEntries(icyHeaders)); } if (isAudio && trackFormat.bitrate == Format.NO_VALUE && icyHeaders.bitrate != Format.NO_VALUE) { trackFormat = trackFormat.copyWithBitrate(icyHeaders.bitrate); } } trackArray[i] = new TrackGroup(trackFormat); } dataType = length == C.LENGTH_UNSET && seekMap.getDurationUs() == C.TIME_UNSET ? C.DATA_TYPE_MEDIA_PROGRESSIVE_LIVE : C.DATA_TYPE_MEDIA; preparedState = new PreparedState(seekMap, new TrackGroupArray(trackArray), trackIsAudioVideoFlags); prepared = true; listener.onSourceInfoRefreshed(durationUs, seekMap.isSeekable()); Assertions.checkNotNull(callback).onPrepared(this); }