Package com.castlabs.android.player

# Class BufferConfiguration.Builder

java.lang.Object
com.castlabs.android.player.BufferConfiguration.Builder

Enclosing class:
  `BufferConfiguration`

public static class BufferConfiguration.Builder extends Object

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `boolean`
  `audioFeedYieldEnabled`
  `boolean`
  `videoFeedYieldEnabled`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder()`
  Create a new builder with default values
  `Builder(BufferConfiguration cfg)`
  Create a new builder starting with the value from the given configuration

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BufferConfiguration.Builder`
  `audioFeedYield(boolean audioFeedYieldEnabled)`
  Whether to enable audio renderer stop feeding decoder when other renderers (video) are ready to start new render cycle.
  `BufferConfiguration.Builder`
  `backBufferDuration(long backBufferDuration, TimeUnit timeUnit)`
  Maximum duration of the back buffer.
  `BufferConfiguration.Builder`
  `bufferSegmentSize(int bufferSegmentSize)`
  The internal buffer is divided into segment and this specifies the size of a single buffer segment.
  `BufferConfiguration.Builder`
  `bufferSizeBytes(int bufferSizeBytes)`
  The buffer size in bytes
  `BufferConfiguration.Builder`
  `drainWhileCharging(boolean drainWhileCharging)`
  Whether to enter drain state when the device is charging.
  `BufferConfiguration`
  `get()`
  `BufferConfiguration.Builder`
  `highMediaTime(int highMediaTime, TimeUnit timeUnit)`
  Time in milliseconds that will be used by the buffer controls to determine if the buffer can be drained.
  `BufferConfiguration.Builder`
  `lowMediaTime(int lowMediaTime, TimeUnit timeUnit)`
  Time in milliseconds that will be used by the buffer controls to determine if the buffer needs to be filled.
  `BufferConfiguration.Builder`
  `minPlaybackStart(int minPlaybackStart, TimeUnit timeUnit)`
  The minimum duration of data that must be buffered for playback to start or resume following a user action such as a seek.
  `BufferConfiguration.Builder`
  `minRebufferStart(int minRebufferStart, TimeUnit timeUnit)`
  The minimum duration of data that must be buffered for playback to resume after a player invoked rebuffer (i.e.
  `BufferConfiguration.Builder`
  `prioritizeInstreamOverManifestDuration(boolean prioritizeInstreamOverManifestDuration)`
  Prioritization of buffered duration calculation based on audio/video segments over the playlist (manifest)
  `BufferConfiguration.Builder`
  `prioritizeTimeOverSizeThresholds(boolean prioritizeTimeOverSizeThresholds)`
  Prioritization of buffer time constraints over size constraints
  `BufferConfiguration.Builder`
  `videoFeedYield(boolean videoFeedYieldEnabled)`
  Whether to enable video renderer stop feeding decoder when other renderers (audio) are ready to start new render cycle.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### audioFeedYieldEnabled

    public boolean audioFeedYieldEnabled

  - ### videoFeedYieldEnabled

    public boolean videoFeedYieldEnabled

- ## Constructor Details

  - ### Builder

    public Builder()
    Create a new builder with default values

  - ### Builder

    public Builder(BufferConfiguration cfg)
    Create a new builder starting with the value from the given configuration
    Parameters:
      `cfg` - The configuration

- ## Method Details

  - ### bufferSizeBytes

    public BufferConfiguration.Builder bufferSizeBytes(int bufferSizeBytes)
    The buffer size in bytes
    Parameters:
      `bufferSizeBytes` - The buffer size in bytes. Must be >= 0
    Returns:
      The builder

  - ### lowMediaTime

    public BufferConfiguration.Builder lowMediaTime(int lowMediaTime, TimeUnit timeUnit)
    Time in milliseconds that will be used by the buffer controls to determine if the buffer needs to be filled. If the buffer contains data that accumulate to less than this time, the buffer can be put in "fill" state.
    Parameters:
      `lowMediaTime` - time in ms to determine if the buffer needs to be filled
      `timeUnit` - The time unit
    Returns:
      The builder

  - ### highMediaTime

    public BufferConfiguration.Builder highMediaTime(int highMediaTime, TimeUnit timeUnit)
    Time in milliseconds that will be used by the buffer controls to determine if the buffer can be drained. If the buffer contains data that accumulate to more than this time, the buffer can be put in "drain" state.
    Parameters:
      `highMediaTime` - time in ms to determine if the buffer can be drained
      `timeUnit` - The time unit
    Returns:
      The builder

  - ### bufferSegmentSize

    public BufferConfiguration.Builder bufferSegmentSize(int bufferSegmentSize)
    The internal buffer is divided into segment and this specifies the size of a single buffer segment.
    Parameters:
      `bufferSegmentSize` - The buffer segment size in bytes
    Returns:
      The builder

  - ### minPlaybackStart

    public BufferConfiguration.Builder minPlaybackStart(int minPlaybackStart, TimeUnit timeUnit)
    The minimum duration of data that must be buffered for playback to start or resume following a user action such as a seek.
    Parameters:
      `minPlaybackStart` - minimum duration of data that must be buffered for playback to start
    Returns:
      The builder

  - ### minRebufferStart

    public BufferConfiguration.Builder minRebufferStart(int minRebufferStart, TimeUnit timeUnit)
    The minimum duration of data that must be buffered for playback to resume after a player invoked rebuffer (i.e. a rebuffer that occurs due to buffer depletion, and not due to a user action such as starting playback or seeking).
    Parameters:
      `minRebufferStart` - minimum duration of data that must be buffered for playback to resume after a rebuffering event
      `timeUnit` - The time unit
    Returns:
      The builder

  - ### prioritizeTimeOverSizeThresholds

    public BufferConfiguration.Builder prioritizeTimeOverSizeThresholds(boolean prioritizeTimeOverSizeThresholds)
    Prioritization of buffer time constraints over size constraints
    Parameters:
      `prioritizeTimeOverSizeThresholds` - whether the buffer time constraints are prioritized over buffer size constraints
    Returns:
      The builder

  - ### prioritizeInstreamOverManifestDuration

    public BufferConfiguration.Builder prioritizeInstreamOverManifestDuration(boolean prioritizeInstreamOverManifestDuration)
    Prioritization of buffered duration calculation based on audio/video segments over the playlist (manifest)
    Parameters:
      `prioritizeInstreamOverManifestDuration` - whether audio/video segments are prioritized over playlist
    Returns:
      The builder

  - ### audioFeedYield

    public BufferConfiguration.Builder audioFeedYield(boolean audioFeedYieldEnabled)
    Whether to enable audio renderer stop feeding decoder when other renderers (video) are ready to start new render cycle. Enable it to play high-frame rate content.
    Parameters:
      `audioFeedYieldEnabled` - `true` to enable
    Returns:
      The builder

  - ### videoFeedYield

    public BufferConfiguration.Builder videoFeedYield(boolean videoFeedYieldEnabled)
    Whether to enable video renderer stop feeding decoder when other renderers (audio) are ready to start new render cycle. Enable it to play high-frame rate content.
    Parameters:
      `videoFeedYieldEnabled` - `true` to enable
    Returns:
      The builder

  - ### drainWhileCharging

    public BufferConfiguration.Builder drainWhileCharging(boolean drainWhileCharging)
    Whether to enter drain state when the device is charging.
    Parameters:
      `drainWhileCharging` - whether to enter drain state when the device is charging.
    Returns:
      The builder

  - ### backBufferDuration

    public BufferConfiguration.Builder backBufferDuration(long backBufferDuration, TimeUnit timeUnit)
    Maximum duration of the back buffer. In other words, how much time are already played segments to remain in the buffer.

    Note that this value is independent and does not take into account other "forward" buffer parameters such as `bufferSizeBytes`. If this value is too high, it can lead to memory exhaustion.

    Parameters:
      `backBufferDuration` - the back buffer duration to set
      `timeUnit` - The time unit
    Returns:
      The builder
    Since:
      4.2.0

  - ### get

    public BufferConfiguration get()