# AbrConfiguration Structure

    public struct AbrConfiguration : Codable, Hashable

The ABR Configuration

Remark

Usable in the Castlabs Player only. Has no effect on AVPlayer.

### Lifecycle

- `init()`

  Creates an ABR configuration initialized with SDK defaults.

  #### Declaration

  Swift

      public init()

- `init(maxInitialBitrate:minDurationForQualityIncreaseMs:maxDurationForQualityDecreaseMs:bandwidthFraction:percentileWeight:percentile:minSampledBytes:degradationPenalty:degradationRecovery:minDegradationSamples:)`

  Creates an ABR configuration with explicit values.

  #### Declaration

  Swift

      public init(
          maxInitialBitrate: Int64 = Defaults.maxInitialBitrate,
          minDurationForQualityIncreaseMs: Int64 = Defaults.minDurationForQualityIncreaseMs,
          maxDurationForQualityDecreaseMs: Int64 = Defaults.maxDurationForQualityDecreaseMs,
          bandwidthFraction: Double = Defaults.bandwidthFraction,
          percentileWeight: Int32 = Defaults.percentileWeight,
          percentile: Double = Defaults.percentile,
          minSampledBytes: Int64 = Defaults.minSampledBytes,
          degradationPenalty: Double = Defaults.degradationPenalty,
          degradationRecovery: Double = Defaults.degradationRecovery,
          minDegradationSamples: Int64 = Defaults.minDegradationSamples
      )

  #### Parameters

  `maxInitialBitrate` | Initial fallback bitrate in bits per second.
  `minDurationForQualityIncreaseMs` | Minimum buffer for quality increase in milliseconds.
  `maxDurationForQualityDecreaseMs` | Maximum buffer for quality decrease in milliseconds.
  `bandwidthFraction` | Effective bandwidth multiplier.
  `percentileWeight` | Sliding-percentile estimator weight.
  `percentile` | Target percentile in range `(0, 1]`.
  `minSampledBytes` | Minimum sampled bytes before estimator is considered reliable.
  `degradationPenalty` | Penalty applied on detected degradation.
  `degradationRecovery` | Recovery applied per selection after degradation.
  `minDegradationSamples` | Minimum segments observed before degradation detection.

### Public

- `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.

  Remark

  Default value is `500,000`.

  #### Declaration

  Swift

      public var maxInitialBitrate: Int64

- `minDurationForQualityIncreaseMs`

  The minimum length of content buffered (in milliseconds) before a quality increase is permitted.

  By default, we we expect to have at least 10 seconds of buffered data before we can switch up the quality. That gives some safe guards around building up a stable buffer when the bandwidth estimation is not very accurate.

  Remark

  Default value is `10,000` milliseconds.

  #### Declaration

  Swift

      public var minDurationForQualityIncreaseMs: Int64

- `maxDurationForQualityDecreaseMs`

  The maximum length of content buffered (in milliseconds) before a quality decrease is permitted.

  Similar to the min duration for quality increase. By default we will not switch down the quality if we have more than 25 seconds of buffer. That avoids that the player will react to short fluctuations in the network capacity. Decreasing this value will prevent down switches longer, but increase the chance for a buffer under run.

  Remark

  Default value is `25,000` milliseconds.

  #### Declaration

  Swift

      public var maxDurationForQualityDecreaseMs: Int64

- `bandwidthFraction`

  The fraction of the bandwidth estimation that we consider to calculate the effective bandwidth.

  Remark

  Default value is `1.0`.

  #### Declaration

  Swift

      public var bandwidthFraction: Double

- `percentileWeight`

  The weight used for the sliding percentile bandwidth estimator.

  Remark

  Default value is `2000`.

  #### Declaration

  Swift

      public var percentileWeight: Int32

- `percentile`

  The desired percentile, expressed as a fraction in the range (0,1].

  Remark

  Default value is `0.5`.

  #### Declaration

  Swift

      public var percentile: Double

- `minSampledBytes`

  The min number of totally transferred bytes before the ABR calculations are considered reliable.

  Remark

  Default value is `262,144 (1024 * 256)`.

  #### Declaration

  Swift

      public var minSampledBytes: Int64

- `degradationPenalty`

  A value between 0 and 1 that is used as a penalty when a buffer degradation or a download time issue us detected.

  In that case the assumption is that the current bandwidth estimate is not enough, since the buffer is getting smaller or became already too small to provide enough time to download the next segment of a selected rendition. permit the player to re-build some of its buffer.

  Remark

  Default value is `0.2`.

  #### Declaration

  Swift

      public var degradationPenalty: Double

- `degradationRecovery`

  The recovery that is applied on each selection after a degradationPenalty was applied. This removes the penalty over time.

  Remark

  Default value is `0.05`.

  #### Declaration

  Swift

      public var degradationRecovery: Double

- `minDegradationSamples`

  The minimum number of segments observed before buffer degradation detection is permitted.

  Remark

  Default value is `4`.

  #### Declaration

  Swift

      public var minDegradationSamples: Int64