Package com.castlabs.android.network

# Class NetworkConfiguration.Builder

java.lang.Object
com.castlabs.android.network.NetworkConfiguration.Builder

Enclosing class:
  `NetworkConfiguration`

public static class NetworkConfiguration.Builder extends Object
Builder for `NetworkConfiguration` instances.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder()`
  Creates a new Builder with default values.
  `Builder(NetworkConfiguration copy)`
  Creates a new Builder by copying values from an existing `NetworkConfiguration`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `NetworkConfiguration.Builder`
  `allowCrossProtocolRedirects(boolean value)`
  Sets the flag whether to allow cross protocol redirects
  `NetworkConfiguration.Builder`
  `connectionTimeoutMs(int value)`
  Sets the connection timeout for both manifest and segment requests
  `NetworkConfiguration.Builder`
  `dashCallbackConnectionTimeoutMs(int value)`
  Sets the connection timeout for DASH callbacks
  `NetworkConfiguration.Builder`
  `dashCallbackReadTimeoutMs(int value)`
  Sets the read timeout for DASH callbacks
  `NetworkConfiguration.Builder`
  `drainConnectionTimeoutMs(int value)`
  Sets the drain timeout in milliseconds.
  `NetworkConfiguration.Builder`
  `drmAcquisitionTimeoutMs(int value)`
  Sets the acquisition timeout for DRM requests.
  `NetworkConfiguration.Builder`
  `drmConnectionTimeoutMs(int value)`
  Sets the connection timeout for DRM requests
  `NetworkConfiguration.Builder`
  `drmReadTimeoutMs(int value)`
  Sets the read timeout for DRM requests
  `NetworkConfiguration.Builder`
  `drmRetryConfiguration(RetryConfiguration value)`
  Sets the retry configuration used for DRM license requests
  `NetworkConfiguration`
  `get()`
  Get the network configuration
  `NetworkConfiguration.Builder`
  `iptvReadTimeoutMs(int value)`
  Sets the read timeout for DRM requests
  `NetworkConfiguration.Builder`
  `manifestConnectionTimeoutMs(int value)`
  Sets the connection timeout for manifest requests
  `NetworkConfiguration.Builder`
  `manifestReadTimeoutMs(int value)`
  Sets the read timeout for manifest requests
  `NetworkConfiguration.Builder`
  `manifestRetryConfiguration(RetryConfiguration value)`
  Sets the retry configuration used for manifests
  `NetworkConfiguration.Builder`
  `provisioningRetryConfiguration(RetryConfiguration value)`
  Sets the retry configuration used for device provisioning
  `NetworkConfiguration.Builder`
  `readTimeoutMs(int value)`
  Sets the read timeout for both manifest and segment requests
  `NetworkConfiguration.Builder`
  `retryConfiguration(RetryConfiguration value)`
  Sets the retry configuration used for both manifests and segments
  `NetworkConfiguration.Builder`
  `segmentsCallTimeoutMs(int value)`
  Sets the Call timeout for segment requests including the request, redirect and response This only currently works with the OkHttp Plugin.
  `NetworkConfiguration.Builder`
  `segmentsConnectionTimeoutMs(int value)`
  Sets the connection timeout for segment requests
  `NetworkConfiguration.Builder`
  `segmentsReadTimeoutMs(int value)`
  Sets the read timeout for segment requests
  `NetworkConfiguration.Builder`
  `segmentsRetryConfiguration(RetryConfiguration value)`
  Sets the retry configuration used for segments
  `NetworkConfiguration.Builder`
  `thumbnailConnectionTimeoutMs(int value)`
  Sets the connection timeout for thumbnail requests.
  `NetworkConfiguration.Builder`
  `thumbnailReadTimeoutMs(int value)`
  Sets the read timeout for thumbnail requests.

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

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

- ## Constructor Details

  - ### Builder

    public Builder()
    Creates a new Builder with default values.

  - ### Builder

    public Builder(@NonNull NetworkConfiguration copy)
    Creates a new Builder by copying values from an existing `NetworkConfiguration`.
    Parameters:
      `copy` - The `NetworkConfiguration` to copy.

- ## Method Details

  - ### retryConfiguration

    @NonNull public NetworkConfiguration.Builder retryConfiguration(@NonNull RetryConfiguration value)
    Sets the retry configuration used for both manifests and segments
    Parameters:
      `value` - Retry configuration
    Returns:
      The builder

  - ### segmentsRetryConfiguration

    @NonNull public NetworkConfiguration.Builder segmentsRetryConfiguration(@NonNull RetryConfiguration value)
    Sets the retry configuration used for segments
    Parameters:
      `value` - Retry configuration
    Returns:
      The builder

  - ### drmRetryConfiguration

    @NonNull public NetworkConfiguration.Builder drmRetryConfiguration(@NonNull RetryConfiguration value)
    Sets the retry configuration used for DRM license requests
    Parameters:
      `value` - Retry configuration
    Returns:
      The builder

  - ### provisioningRetryConfiguration

    @NonNull public NetworkConfiguration.Builder provisioningRetryConfiguration(@NonNull RetryConfiguration value)
    Sets the retry configuration used for device provisioning
    Parameters:
      `value` - Retry configuration
    Returns:
      The builder

  - ### manifestRetryConfiguration

    @NonNull public NetworkConfiguration.Builder manifestRetryConfiguration(@NonNull RetryConfiguration value)
    Sets the retry configuration used for manifests
    Parameters:
      `value` - Retry configuration
    Returns:
      The builder

  - ### connectionTimeoutMs

    @NonNull public NetworkConfiguration.Builder connectionTimeoutMs(int value)
    Sets the connection timeout for both manifest and segment requests
    Parameters:
      `value` - The new connection timeout
    Returns:
      The builder

  - ### segmentsConnectionTimeoutMs

    @NonNull public NetworkConfiguration.Builder segmentsConnectionTimeoutMs(int value)
    Sets the connection timeout for segment requests
    Parameters:
      `value` - The new connection timeout
    Returns:
      The builder

  - ### manifestConnectionTimeoutMs

    @NonNull public NetworkConfiguration.Builder manifestConnectionTimeoutMs(int value)
    Sets the connection timeout for manifest requests
    Parameters:
      `value` - The new connection timeout
    Returns:
      The builder

  - ### drmConnectionTimeoutMs

    @NonNull public NetworkConfiguration.Builder drmConnectionTimeoutMs(int value)
    Sets the connection timeout for DRM requests
    Parameters:
      `value` - The new connection timeout or `NetworkConfiguration.DEFAULT_DRM_CONNECT_TIMEOUT_MILLIS` to use default
    Returns:
      The builder

  - ### dashCallbackConnectionTimeoutMs

    @NonNull public NetworkConfiguration.Builder dashCallbackConnectionTimeoutMs(int value)
    Sets the connection timeout for DASH callbacks
    Parameters:
      `value` - The new connection timeout or `NetworkConfiguration.DEFAULT_CONNECT_TIMEOUT_MILLIS` to use default
    Returns:
      The builder

  - ### thumbnailConnectionTimeoutMs

    @NonNull public NetworkConfiguration.Builder thumbnailConnectionTimeoutMs(int value)
    Sets the connection timeout for thumbnail requests. This timeout is used only if the ThumbsPlugin is registered.
    Parameters:
      `value` - The new connection timeout
    Returns:
      The builder

  - ### allowCrossProtocolRedirects

    @NonNull public NetworkConfiguration.Builder allowCrossProtocolRedirects(boolean value)
    Sets the flag whether to allow cross protocol redirects
    Parameters:
      `value` - Whether to allow cross protocol redirects
    Returns:
      The builder

  - ### readTimeoutMs

    @NonNull public NetworkConfiguration.Builder readTimeoutMs(int value)
    Sets the read timeout for both manifest and segment requests
    Parameters:
      `value` - The new connection timeout
    Returns:
      The builder

  - ### segmentsReadTimeoutMs

    @NonNull public NetworkConfiguration.Builder segmentsReadTimeoutMs(int value)
    Sets the read timeout for segment requests
    Parameters:
      `value` - The new connection timeout
    Returns:
      The builder

  - ### segmentsCallTimeoutMs

    @NonNull public NetworkConfiguration.Builder segmentsCallTimeoutMs(int value)
    Sets the Call timeout for segment requests including the request, redirect and response This only currently works with the OkHttp Plugin. TODO: Add support in the Default Http Plugin.
    Parameters:
      `value` - The new segment call timeout.
    Returns:
      The builder

  - ### manifestReadTimeoutMs

    @NonNull public NetworkConfiguration.Builder manifestReadTimeoutMs(int value)
    Sets the read timeout for manifest requests
    Parameters:
      `value` - The new connection timeout
    Returns:
      The builder

  - ### drmReadTimeoutMs

    @NonNull public NetworkConfiguration.Builder drmReadTimeoutMs(int value)
    Sets the read timeout for DRM requests
    Parameters:
      `value` - The new connection timeout or `NetworkConfiguration.DEFAULT_DRM_READ_TIMEOUT_MILLIS` to use default
    Returns:
      The builder

  - ### iptvReadTimeoutMs

    @NonNull public NetworkConfiguration.Builder iptvReadTimeoutMs(int value)
    Sets the read timeout for DRM requests
    Parameters:
      `value` - The new read timeout or `NetworkConfiguration.DEFAULT_READ_TIMEOUT_MILLIS` to use default
    Returns:
      The builder

  - ### dashCallbackReadTimeoutMs

    @NonNull public NetworkConfiguration.Builder dashCallbackReadTimeoutMs(int value)
    Sets the read timeout for DASH callbacks
    Parameters:
      `value` - The new connection timeout or `NetworkConfiguration.DEFAULT_READ_TIMEOUT_MILLIS` to use default
    Returns:
      The builder

  - ### thumbnailReadTimeoutMs

    @NonNull public NetworkConfiguration.Builder thumbnailReadTimeoutMs(int value)
    Sets the read timeout for thumbnail requests. This timeout is used only if the ThumbsPlugin is registered.
    Parameters:
      `value` - The new connection timeout
    Returns:
      The builder

  - ### drmAcquisitionTimeoutMs

    @NonNull public NetworkConfiguration.Builder drmAcquisitionTimeoutMs(int value)
    Sets the acquisition timeout for DRM requests. Maximum total time a single DRM request can take.
    Parameters:
      `value` - The new acquisition timeout or `NetworkConfiguration.DEFAULT_DRM_ACQUISITION_TIMEOUT_MILLIS` to use default
    Returns:
      The builder

  - ### drainConnectionTimeoutMs

    @NonNull public NetworkConfiguration.Builder drainConnectionTimeoutMs(int value)
    Sets the drain timeout in milliseconds. This is the time that we give the player to drain and read all remaining data when a connection is closed. If all data can be drained in time, the connection can potentially be re-used.
    Parameters:
      `value` - The new timeout in milliseconds
    Returns:
      The builder

  - ### get

    @NonNull public NetworkConfiguration get()
    Get the network configuration
    Returns:
      The network configuration