Package com.castlabs.android.player

## Class AbrConfiguration.Builder

- java.lang.Object
- - com.castlabs.android.player.AbrConfiguration.Builder

- Enclosing class:
    AbrConfiguration

      public static class AbrConfiguration.Builder
      extends Object

  A builder for ABR configuration instances

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Builder()` |
    `Builder​(AbrConfiguration copy)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `AbrConfiguration.Builder` | `bandwidthFraction​(float bandwidthFraction)` | The fraction of the bandwidth estimation that we consider the effective bandwidth.
    `AbrConfiguration.Builder` | `bytesThreshold​(int bytesThreshold)` | Set the `AbrConfiguration.bytesThreshold`
    `AbrConfiguration.Builder` | `degradationPenalty​(float degradationPenalty)` | Set the `AbrConfiguration.degradationPenalty`
    `AbrConfiguration.Builder` | `degradationRecovery​(float degradationRecovery)` | Set the `AbrConfiguration.degradationRecovery`
    `AbrConfiguration.Builder` | `downloadTimeFactor​(float downloadTimeFactor)` | Safety factor that is applied to download time calculations
    `AbrConfiguration` | `get()` | Get the ABR configuration created by this builder
    `AbrConfiguration.Builder` | `initialTrackSelection​(int initialTrackSelection, boolean keepInitialSelection)` | The initial track selection can be used to manually select a track by index initially, in combination with `keepInitialSelection`.
    `AbrConfiguration.Builder` | `maxDurationForQualityDecrease​(long maxDurationForQualityDecrease, TimeUnit unit)` | The maximum amount of data that is expected to be buffered before a quality decrease is permitted.
    `AbrConfiguration.Builder` | `maxInitialBitrate​(long maxInitialBitrate)` | The bandwidth estimation in bits per second that is used when the bandwidth estimator reports that it can not estimate due to lack of information.
    `AbrConfiguration.Builder` | `method​(int method)` | Select the underlying ABR method as one of `AbrConfiguration.METHOD_COMMON_NBA`, `AbrConfiguration.METHOD_EXO`, `AbrConfiguration.METHOD_ITERATE`, or `AbrConfiguration.METHOD_FLIP`.
    `AbrConfiguration.Builder` | `minDegradationSamples​(int minDegradationSamples)` | Set the `AbrConfiguration.minDegradationSamples`
    `AbrConfiguration.Builder` | `minDurationForQualityIncrease​(long minDurationForQualityIncrease, TimeUnit unit)` | The minimum amount of that data is expected to be buffered before a quality increase is permitted.
    `AbrConfiguration.Builder` | `minDurationToRetainAfterDiscard​(long minDurationToRetainAfterDiscard, TimeUnit unit)` | The minimum duration of the buffer to retain after discarding the segments when switching to significantly higher quality (i.e.
    `AbrConfiguration.Builder` | `minSampledBytes​(long minSampledBytes)` | Set the `AbrConfiguration.minSampledBytes`
    `AbrConfiguration.Builder` | `percentile​(float percentile)` | Set the `AbrConfiguration.percentile`
    `AbrConfiguration.Builder` | `percentileWeight​(int percentileWeight)` | Set the weight used for the sliding percentile bandwidth estimator
    `AbrConfiguration.Builder` | `safeBufferSize​(long safeBufferSize, TimeUnit unit)` | Minimum target buffer considered safe.
    `AbrConfiguration.Builder` | `timeThresholdMs​(int timeThresholdMs)` | Set the `AbrConfiguration.timeThresholdMs`

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

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

- - ### Constructor Detail

    - #### Builder

          public Builder()

    - #### Builder

          public Builder​(AbrConfiguration copy)

  - ### Method Detail

    - #### maxInitialBitrate

          public AbrConfiguration.Builder maxInitialBitrate​(long maxInitialBitrate)

      The bandwidth estimation in bits per second that is used when the bandwidth estimator reports that it can not estimate due to lack of information. This is usually used for the initial quality selection when no network estimation was collected yet.
      Parameters:
        `maxInitialBitrate` - The initial bitrate
      Returns:
        The builder

    - #### minDurationForQualityIncrease

          public AbrConfiguration.Builder minDurationForQualityIncrease​(long minDurationForQualityIncrease,
                                                                        TimeUnit unit)

      The minimum amount of that data is expected to be buffered before a quality increase is permitted.
      Parameters:
        `minDurationForQualityIncrease` - time
        `unit` - time unit
      Returns:
        The builder

    - #### maxDurationForQualityDecrease

          public AbrConfiguration.Builder maxDurationForQualityDecrease​(long maxDurationForQualityDecrease,
                                                                        TimeUnit unit)

      The maximum amount of data that is expected to be buffered before a quality decrease is permitted.
      Parameters:
        `maxDurationForQualityDecrease` - time
        `unit` - time unit
      Returns:
        The builder

    - #### bandwidthFraction

          public AbrConfiguration.Builder bandwidthFraction​(float bandwidthFraction)

      The fraction of the bandwidth estimation that we consider the effective bandwidth.
      Parameters:
        `bandwidthFraction` - The bandwidth fraction
      Returns:
        The builder

    - #### initialTrackSelection

          public AbrConfiguration.Builder initialTrackSelection​(int initialTrackSelection,
                                                                boolean keepInitialSelection)

      The initial track selection can be used to manually select a track by index initially, in combination with `keepInitialSelection`. You can also use `SdkConsts.VIDEO_QUALITY_HIGHEST` or `SdkConsts.VIDEO_QUALITY_LOWEST`. The default value is `SdkConsts.VIDEO_QUALITY_ADAPTIVE`. The tracks are in descending bitrate order and therefore the index having value of 0 corresponds to the quality with the highest bitrate.

      Please note that `maxInitialBitrate` is a better option if you want to influence the initial track selection because you will no need to know the actual indices.

      Parameters:
        `initialTrackSelection` - The initially selected index or one of `SdkConsts.VIDEO_QUALITY_LOWEST`, `SdkConsts.VIDEO_QUALITY_HIGHEST`, `SdkConsts.VIDEO_QUALITY_ADAPTIVE`
        `keepInitialSelection` - If true, the initial selection will be kept and ABR will be effectively disabled
      Returns:
        The builder

    - #### method

          public AbrConfiguration.Builder method​(int method)

      Select the underlying ABR method as one of `AbrConfiguration.METHOD_COMMON_NBA`, `AbrConfiguration.METHOD_EXO`, `AbrConfiguration.METHOD_ITERATE`, or `AbrConfiguration.METHOD_FLIP`.
      Parameters:
        `method` - The method
      Returns:
        The builder

    - #### minDurationToRetainAfterDiscard

          public AbrConfiguration.Builder minDurationToRetainAfterDiscard​(long minDurationToRetainAfterDiscard,
                                                                          TimeUnit unit)

      The minimum duration of the buffer to retain after discarding the segments when switching to significantly higher quality (i.e. from SD to HD) thus facilitating faster switch to a higher quality.
      Parameters:
        `minDurationToRetainAfterDiscard` - time
        `unit` - time unit
      Returns:
        The builder

    - #### safeBufferSize

          public AbrConfiguration.Builder safeBufferSize​(long safeBufferSize,
                                                         TimeUnit unit)

      Minimum target buffer considered safe. Buffer below or equals this threshold results in emergency handling.
      Parameters:
        `safeBufferSize` - time
        `unit` - time unit
      Returns:
        The builder

    - #### downloadTimeFactor

          public AbrConfiguration.Builder downloadTimeFactor​(float downloadTimeFactor)

      Safety factor that is applied to download time calculations
      Parameters:
        `downloadTimeFactor` - download time factor
      Returns:
        The builder

    - #### percentileWeight

          public AbrConfiguration.Builder percentileWeight​(int percentileWeight)

      Set the weight used for the sliding percentile bandwidth estimator
      Parameters:
        `percentileWeight` - The weight
      Returns:
        The builder

    - #### percentile

          public AbrConfiguration.Builder percentile​(float percentile)

      Set the `AbrConfiguration.percentile`
      Parameters:
        `percentile` - The percentile
      Returns:
        The builder

    - #### bytesThreshold

          public AbrConfiguration.Builder bytesThreshold​(int bytesThreshold)

      Set the `AbrConfiguration.bytesThreshold`
      Parameters:
        `bytesThreshold` - The bytesThreshold
      Returns:
        The builder

    - #### timeThresholdMs

          public AbrConfiguration.Builder timeThresholdMs​(int timeThresholdMs)

      Set the `AbrConfiguration.timeThresholdMs`
      Parameters:
        `timeThresholdMs` - The timeThresholdMs
      Returns:
        The builder

    - #### minSampledBytes

          public AbrConfiguration.Builder minSampledBytes​(long minSampledBytes)

      Set the `AbrConfiguration.minSampledBytes`
      Parameters:
        `minSampledBytes` - The minSampledBytes
      Returns:
        The builder

    - #### degradationRecovery

          public AbrConfiguration.Builder degradationRecovery​(float degradationRecovery)

      Set the `AbrConfiguration.degradationRecovery`
      Parameters:
        `degradationRecovery` - The recovery value
      Returns:
        The builder

    - #### degradationPenalty

          public AbrConfiguration.Builder degradationPenalty​(float degradationPenalty)

      Set the `AbrConfiguration.degradationPenalty`
      Parameters:
        `degradationPenalty` - The penalty value
      Returns:
        The builder

    - #### minDegradationSamples

          public AbrConfiguration.Builder minDegradationSamples​(int minDegradationSamples)

      Set the `AbrConfiguration.minDegradationSamples`
      Parameters:
        `minDegradationSamples` - The penalty value
      Returns:
        The builder

    - #### get

          public AbrConfiguration get()

      Get the ABR configuration created by this builder
      Returns:
        The ABR configuration