Class DefaultLoadControl
- java.lang.Object
-
- com.google.android.exoplayer2.DefaultLoadControl
-
- All Implemented Interfaces:
LoadControl
@Deprecated public class DefaultLoadControl extends Object implements LoadControl
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.The defaultLoadControlimplementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultLoadControl.BuilderDeprecated.Builder forDefaultLoadControl.
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_AUDIO_BUFFER_SIZEDeprecated.A default size in bytes for an audio buffer.static intDEFAULT_BACK_BUFFER_DURATION_MSDeprecated.The default back buffer duration in milliseconds.static intDEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MSDeprecated.The default duration of media that must be buffered for playback to resume after a rebuffer, in milliseconds.static intDEFAULT_BUFFER_FOR_PLAYBACK_MSDeprecated.The default duration of media that must be buffered for playback to start or resume following a user action such as a seek, in milliseconds.static intDEFAULT_CAMERA_MOTION_BUFFER_SIZEDeprecated.A default size in bytes for a camera motion buffer.static intDEFAULT_IMAGE_BUFFER_SIZEDeprecated.A default size in bytes for an image buffer.static intDEFAULT_MAX_BUFFER_MSDeprecated.The default maximum duration of media that the player will attempt to buffer, in milliseconds.static intDEFAULT_METADATA_BUFFER_SIZEDeprecated.A default size in bytes for a metadata buffer.static intDEFAULT_MIN_BUFFER_MSDeprecated.The default minimum duration of media that the player will attempt to ensure is buffered at all times, in milliseconds.static intDEFAULT_MIN_BUFFER_SIZEDeprecated.The buffer size in bytes that will be used as a minimum target buffer in all cases.static intDEFAULT_MUXED_BUFFER_SIZEDeprecated.A default size in bytes for a muxed buffer (e.g.static booleanDEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDSDeprecated.The default prioritization of buffer time constraints over size constraints.static booleanDEFAULT_RETAIN_BACK_BUFFER_FROM_KEYFRAMEDeprecated.The default for whether the back buffer is retained from the previous keyframe.static intDEFAULT_TARGET_BUFFER_BYTESDeprecated.The default target buffer size in bytes.static intDEFAULT_TEXT_BUFFER_SIZEDeprecated.A default size in bytes for a text buffer.static intDEFAULT_VIDEO_BUFFER_SIZEDeprecated.A default size in bytes for a video buffer.-
Fields inherited from interface com.google.android.exoplayer2.LoadControl
EMPTY_MEDIA_PERIOD_ID
-
-
Constructor Summary
Constructors Modifier Constructor Description DefaultLoadControl()Deprecated.Constructs a new instance, using theDEFAULT_*constants defined in this class.protectedDefaultLoadControl(DefaultAllocator allocator, int minBufferMs, int maxBufferMs, int bufferForPlaybackMs, int bufferForPlaybackAfterRebufferMs, int targetBufferBytes, boolean prioritizeTimeOverSizeThresholds, int backBufferDurationMs, boolean retainBackBufferFromKeyframe)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected intcalculateTargetBufferBytes(Renderer[] renderers, ExoTrackSelection[] trackSelectionArray)Deprecated.Calculate target buffer size in bytes based on the selected tracks.AllocatorgetAllocator()Deprecated.Returns theAllocatorthat should be used to obtain media buffer allocations.longgetBackBufferDurationUs()Deprecated.Returns the duration of media to retain in the buffer prior to the current playback position, for fast backward seeking.voidonPrepared()Deprecated.Called by the player when prepared with a new source.voidonReleased()Deprecated.Called by the player when released.voidonStopped()Deprecated.Called by the player when stopped.voidonTracksSelected(Timeline timeline, MediaPeriodId mediaPeriodId, Renderer[] renderers, TrackGroupArray trackGroups, ExoTrackSelection[] trackSelections)Deprecated.Called by the player when a track selection occurs.booleanretainBackBufferFromKeyframe()Deprecated.Returns whether media should be retained from the keyframe before the current playback position minusLoadControl.getBackBufferDurationUs(), rather than any sample before or at that position.booleanshouldContinueLoading(long playbackPositionUs, long bufferedDurationUs, float playbackSpeed)Deprecated.Called by the player to determine whether it should continue to load the source.booleanshouldStartPlayback(Timeline timeline, MediaPeriodId mediaPeriodId, long bufferedDurationUs, float playbackSpeed, boolean rebuffering, long targetLiveOffsetUs)Deprecated.Called repeatedly by the player when it's loading the source, has yet to start playback, and has the minimum amount of data necessary for playback to be started.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.android.exoplayer2.LoadControl
onTracksSelected, shouldStartPlayback
-
-
-
-
Field Detail
-
DEFAULT_MIN_BUFFER_MS
public static final int DEFAULT_MIN_BUFFER_MS
Deprecated.The default minimum duration of media that the player will attempt to ensure is buffered at all times, in milliseconds.- See Also:
- Constant Field Values
-
DEFAULT_MAX_BUFFER_MS
public static final int DEFAULT_MAX_BUFFER_MS
Deprecated.The default maximum duration of media that the player will attempt to buffer, in milliseconds.- See Also:
- Constant Field Values
-
DEFAULT_BUFFER_FOR_PLAYBACK_MS
public static final int DEFAULT_BUFFER_FOR_PLAYBACK_MS
Deprecated.The default duration of media that must be buffered for playback to start or resume following a user action such as a seek, in milliseconds.- See Also:
- Constant Field Values
-
DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS
public static final int DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS
Deprecated.The default duration of media that must be buffered for playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by buffer depletion rather than a user action.- See Also:
- Constant Field Values
-
DEFAULT_TARGET_BUFFER_BYTES
public static final int DEFAULT_TARGET_BUFFER_BYTES
Deprecated.The default target buffer size in bytes. The value (C.LENGTH_UNSET) means that the load control will calculate the target buffer size based on the selected tracks.- See Also:
- Constant Field Values
-
DEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDS
public static final boolean DEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDS
Deprecated.The default prioritization of buffer time constraints over size constraints.- See Also:
- Constant Field Values
-
DEFAULT_BACK_BUFFER_DURATION_MS
public static final int DEFAULT_BACK_BUFFER_DURATION_MS
Deprecated.The default back buffer duration in milliseconds.- See Also:
- Constant Field Values
-
DEFAULT_RETAIN_BACK_BUFFER_FROM_KEYFRAME
public static final boolean DEFAULT_RETAIN_BACK_BUFFER_FROM_KEYFRAME
Deprecated.The default for whether the back buffer is retained from the previous keyframe.- See Also:
- Constant Field Values
-
DEFAULT_VIDEO_BUFFER_SIZE
public static final int DEFAULT_VIDEO_BUFFER_SIZE
Deprecated.A default size in bytes for a video buffer.- See Also:
- Constant Field Values
-
DEFAULT_AUDIO_BUFFER_SIZE
public static final int DEFAULT_AUDIO_BUFFER_SIZE
Deprecated.A default size in bytes for an audio buffer.- See Also:
- Constant Field Values
-
DEFAULT_TEXT_BUFFER_SIZE
public static final int DEFAULT_TEXT_BUFFER_SIZE
Deprecated.A default size in bytes for a text buffer.- See Also:
- Constant Field Values
-
DEFAULT_METADATA_BUFFER_SIZE
public static final int DEFAULT_METADATA_BUFFER_SIZE
Deprecated.A default size in bytes for a metadata buffer.- See Also:
- Constant Field Values
-
DEFAULT_CAMERA_MOTION_BUFFER_SIZE
public static final int DEFAULT_CAMERA_MOTION_BUFFER_SIZE
Deprecated.A default size in bytes for a camera motion buffer.- See Also:
- Constant Field Values
-
DEFAULT_IMAGE_BUFFER_SIZE
public static final int DEFAULT_IMAGE_BUFFER_SIZE
Deprecated.A default size in bytes for an image buffer.- See Also:
- Constant Field Values
-
DEFAULT_MUXED_BUFFER_SIZE
public static final int DEFAULT_MUXED_BUFFER_SIZE
Deprecated.A default size in bytes for a muxed buffer (e.g. containing video, audio and text).- See Also:
- Constant Field Values
-
DEFAULT_MIN_BUFFER_SIZE
public static final int DEFAULT_MIN_BUFFER_SIZE
Deprecated.The buffer size in bytes that will be used as a minimum target buffer in all cases. This is also the default target buffer before tracks are selected.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultLoadControl
public DefaultLoadControl()
Deprecated.Constructs a new instance, using theDEFAULT_*constants defined in this class.
-
DefaultLoadControl
protected DefaultLoadControl(DefaultAllocator allocator, int minBufferMs, int maxBufferMs, int bufferForPlaybackMs, int bufferForPlaybackAfterRebufferMs, int targetBufferBytes, boolean prioritizeTimeOverSizeThresholds, int backBufferDurationMs, boolean retainBackBufferFromKeyframe)
Deprecated.
-
-
Method Detail
-
onPrepared
public void onPrepared()
Deprecated.Description copied from interface:LoadControlCalled by the player when prepared with a new source.- Specified by:
onPreparedin interfaceLoadControl
-
onTracksSelected
public void onTracksSelected(Timeline timeline, MediaPeriodId mediaPeriodId, Renderer[] renderers, TrackGroupArray trackGroups, ExoTrackSelection[] trackSelections)
Deprecated.Description copied from interface:LoadControlCalled by the player when a track selection occurs.- Specified by:
onTracksSelectedin interfaceLoadControl- Parameters:
timeline- The currentTimelinein ExoPlayer. Can beTimeline.EMPTYonly when the deprecatedLoadControl.onTracksSelected(Renderer[], TrackGroupArray, ExoTrackSelection[])was called.mediaPeriodId- Identifies (in the current timeline) theMediaPeriodfor which the selection was made. Will beLoadControl.EMPTY_MEDIA_PERIOD_IDwhentimelineis empty.renderers- The renderers.trackGroups- TheTrackGroups from which the selection was made.trackSelections- The track selections that were made.
-
onStopped
public void onStopped()
Deprecated.Description copied from interface:LoadControlCalled by the player when stopped.- Specified by:
onStoppedin interfaceLoadControl
-
onReleased
public void onReleased()
Deprecated.Description copied from interface:LoadControlCalled by the player when released.- Specified by:
onReleasedin interfaceLoadControl
-
getAllocator
public Allocator getAllocator()
Deprecated.Description copied from interface:LoadControlReturns theAllocatorthat should be used to obtain media buffer allocations.- Specified by:
getAllocatorin interfaceLoadControl
-
getBackBufferDurationUs
public long getBackBufferDurationUs()
Deprecated.Description copied from interface:LoadControlReturns the duration of media to retain in the buffer prior to the current playback position, for fast backward seeking.Note: If
LoadControl.retainBackBufferFromKeyframe()is false then seeking in the back-buffer will only be fast if the back-buffer contains a keyframe prior to the seek position.Note: Implementations should return a single value. Dynamic changes to the back-buffer are not currently supported.
- Specified by:
getBackBufferDurationUsin interfaceLoadControl- Returns:
- The duration of media to retain in the buffer prior to the current playback position, in microseconds.
-
retainBackBufferFromKeyframe
public boolean retainBackBufferFromKeyframe()
Deprecated.Description copied from interface:LoadControlReturns whether media should be retained from the keyframe before the current playback position minusLoadControl.getBackBufferDurationUs(), rather than any sample before or at that position.Warning: Returning true will cause the back-buffer size to depend on the spacing of keyframes in the media being played. Returning true is not recommended unless you control the media and are comfortable with the back-buffer size exceeding
LoadControl.getBackBufferDurationUs()by as much as the maximum duration between adjacent keyframes in the media.Note: Implementations should return a single value. Dynamic changes to the back-buffer are not currently supported.
- Specified by:
retainBackBufferFromKeyframein interfaceLoadControl- Returns:
- Whether media should be retained from the keyframe before the current playback position
minus
LoadControl.getBackBufferDurationUs(), rather than any sample before or at that position.
-
shouldContinueLoading
public boolean shouldContinueLoading(long playbackPositionUs, long bufferedDurationUs, float playbackSpeed)Deprecated.Description copied from interface:LoadControlCalled by the player to determine whether it should continue to load the source. If this method returns true, theMediaPeriodidentified in the most recentLoadControl.onTracksSelected(com.google.android.exoplayer2.Timeline, com.google.android.exoplayer2.source.MediaPeriodId, com.google.android.exoplayer2.Renderer[], com.google.android.exoplayer2.source.TrackGroupArray, com.google.android.exoplayer2.trackselection.ExoTrackSelection[])call will continue being loaded.- Specified by:
shouldContinueLoadingin interfaceLoadControl- Parameters:
playbackPositionUs- The current playback position in microseconds, relative to the start of theperiodthat will continue to be loaded if this method returnstrue. If playback of this period has not yet started, the value will be negative and equal in magnitude to the duration of any media in previous periods still to be played.bufferedDurationUs- The duration of media that's currently buffered.playbackSpeed- The current factor by which playback is sped up.- Returns:
- Whether the loading should continue.
-
shouldStartPlayback
public boolean shouldStartPlayback(Timeline timeline, MediaPeriodId mediaPeriodId, long bufferedDurationUs, float playbackSpeed, boolean rebuffering, long targetLiveOffsetUs)
Deprecated.Description copied from interface:LoadControlCalled repeatedly by the player when it's loading the source, has yet to start playback, and has the minimum amount of data necessary for playback to be started. The value returned determines whether playback is actually started. The load control may opt to returnfalseuntil some condition has been met (e.g. a certain amount of media is buffered).- Specified by:
shouldStartPlaybackin interfaceLoadControl- Parameters:
timeline- The currentTimelinein ExoPlayer. Can beTimeline.EMPTYonly when the deprecatedLoadControl.shouldStartPlayback(long, float, boolean, long)was called.mediaPeriodId- Identifies (in the current timeline) theMediaPeriodfor which playback will start. Will beLoadControl.EMPTY_MEDIA_PERIOD_IDwhentimelineis empty.bufferedDurationUs- The duration of media that's currently buffered.playbackSpeed- The current factor by which playback is sped up.rebuffering- Whether the player is rebuffering. A rebuffer is defined to be caused by buffer depletion rather than a user action. Hence this parameter is false during initial buffering and when buffering as a result of a seek operation.targetLiveOffsetUs- The desired playback position offset to the live edge in microseconds, orC.TIME_UNSETif the media is not a live stream or no offset is configured.- Returns:
- Whether playback should be allowed to start or resume.
-
calculateTargetBufferBytes
protected int calculateTargetBufferBytes(Renderer[] renderers, ExoTrackSelection[] trackSelectionArray)
Deprecated.Calculate target buffer size in bytes based on the selected tracks. The player will try not to exceed this target buffer. Only used whentargetBufferBytesisC.LENGTH_UNSET.- Parameters:
renderers- The renderers for which the track were selected.trackSelectionArray- The selected tracks.- Returns:
- The target buffer size in bytes.
-
-