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 Details

  • Method Details

    • 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)
      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)
      Parameters:
      percentile - The percentile
      Returns:
      The builder
    • bytesThreshold

      public AbrConfiguration.Builder bytesThreshold(int bytesThreshold)
      Parameters:
      bytesThreshold - The bytesThreshold
      Returns:
      The builder
    • timeThresholdMs

      public AbrConfiguration.Builder timeThresholdMs(int timeThresholdMs)
      Parameters:
      timeThresholdMs - The timeThresholdMs
      Returns:
      The builder
    • minSampledBytes

      public AbrConfiguration.Builder minSampledBytes(long minSampledBytes)
      Parameters:
      minSampledBytes - The minSampledBytes
      Returns:
      The builder
    • degradationRecovery

      public AbrConfiguration.Builder degradationRecovery(float degradationRecovery)
      Parameters:
      degradationRecovery - The recovery value
      Returns:
      The builder
    • degradationPenalty

      public AbrConfiguration.Builder degradationPenalty(float degradationPenalty)
      Parameters:
      degradationPenalty - The penalty value
      Returns:
      The builder
    • minDegradationSamples

      public AbrConfiguration.Builder minDegradationSamples(int minDegradationSamples)
      Parameters:
      minDegradationSamples - The penalty value
      Returns:
      The builder
    • useCMSD

      public AbrConfiguration.Builder useCMSD(boolean value)
      Parameters:
      value - whether to enable CMSD parsing
      Returns:
      The builder
    • get

      public AbrConfiguration get()
      Get the ABR configuration created by this builder
      Returns:
      The ABR configuration