Package com.castlabs.android.player

## Class PlayerConfig

- java.lang.Object
- - com.castlabs.android.player.PlayerConfig

- All Implemented Interfaces:
    `Parcelable`

      public class PlayerConfig
      extends Object
      implements Parcelable

  Object which represents a specific Player configuration.

  You can use a `PlayerConfig` object to start playback on a `PlayerController` calling its `PlayerController.open(PlayerConfig)` method.

  An instance can be built with the `PlayerConfig.Builder`. The `Builder` can be populated with an already existing `PlayerConfig` or with a `Bundle`.

  It is possible to convert an instance of `PlayerConfig` `toBundle()`. This `Bundle` can also be used to `PlayerController.open(Bundle)` the `PlayerController`.

  This class is `Parcelable`.

  Since:
    4.2.1

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `PlayerConfig.Builder` | A Builder for `PlayerConfig`.

    - ### Nested classes/interfaces inherited from interface android.os.Parcelable

      `Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `AbrConfiguration` | `abrConfiguration` | The initial video quality
    `AdRequest` | `adRequest` | The Ad request (if any)
    `AdSchedule` | `adSchedule` | Describes a custom ad schedule.
    `AnalyticsMetaData` | `analyticsMetaData` | The analytics meta-data
    `int` | `analyticsSessionType` | Analytics session type
    `AudioAttributes` | `audioAttributes` | The Audio Attributes.
    `boolean` | `audioDecoderFallback` | If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder.
    `int` | `audioTrackGroupIndex` | The index of the selected audio track group
    `int` | `audioTrackIndex` | The index of the selected audio track
    `boolean` | `autoPlay` | Whether to autoplay or not
    `BufferConfiguration` | `bufferConfiguration` | The buffer configuration
    `CasConfiguration` | `casConfiguration` | Cas configuration (if any)
    `boolean` | `clipPeriods` | If true then media periods will be clipped to their durations (currently is only applicable for DASH streams)
    `long` | `clippingEndUs` | The clipping end position in microseconds
    `long` | `clippingStartUs` | The clipping start position in microseconds
    `String` | `configurationUrl` | Optional configuration backend url
    `Bundle` | `contentParameters` | Header params to add to content (manifest) requests
    `Bundle` | `contentQueryParameters` | Query params to add to content (manifest) requests
    `int` | `contentType` | The content format
    `String` | `contentUrl` | Playback url
    `static Parcelable.Creator<PlayerConfig>` | `CREATOR` |
    `String` | `downloadFolder` | Download folder in case the content is played offline
    `DrmConfiguration` | `drmConfiguration` | Drm configuration (if any)
    `boolean` | `enableAdSpeedUp` | The flag to enable or disable automatic setting of a speed to 1x when playing ads.
    `boolean` | `enableDashEventCallback` | Enable internal handling of DASH event callbacks
    `boolean` | `enableLooping` | If set to true then the playback looping will be enabled and the player will automatically restart the playback after reaching end of content
    `boolean` | `enableTrickplayMode` | Enable Trickplay mode at the start of the playback.
    `boolean` | `enableTunneling` | Enable tunneling support
    `boolean` | `enableTunnelingWithoutAudio` | Force using of tunneling when audio track is disabled.
    `boolean` | `enableWorkaroundEveryVideoFrameIsSyncFrame` | If True, the workaround will be enabled to not treat the video frames as sync frames except the very first one.
    `boolean` | `forceInStreamDrmInitData` | If true then DRM init data from segments will be used instead of the one from manifest (currently is only applicable for DASH streams)
    `String` | `id` | ID for this content
    `static String` | `INTENT_CONFIGURATION_ID` | A unique ID for the configuration
    `static String` | `INTENT_CONFIGURATION_URL` | Intent key to specify an optional URL to an API endpoint that can be used to refresh the configuration.
    `static String` | `INTENT_LIVE` | Indicates live content
    `static String` | `INTENT_METADATA` | Additional Bundle-formatted meta-data such as poster images, titles, byline and any custom meta-data
    `static String` | `INTENT_PREFERRED_CODEC_INFOS` | Preferred media codec infos
    `static String` | `INTENT_THREESIXTY` | Indicates 360 degree content
    `boolean` | `live` | Content live or VoD
    `LiveConfiguration` | `liveConfiguration` | The Live configuration
    `boolean` | `mergeVideoTracks` | If True, the video tracks will be merged into a single video track
    `Bundle` | `metaData` | Optional metadata
    `NetworkConfiguration` | `networkConfiguration` | The network configuration
    `boolean` | `pauseOnHdmiDisconnected` | Enable or disable automatic pausing on HDMI disconnected
    `long` | `positionUs` | The position in microseconds.
    `String` | `preferredAudioLanguage` | Preferred audio language
    `List<MediaCodecInfo>` | `preferredCodecInfos` |
    `String` | `preferredTextLanguage` | Preferred subtitles language
    `boolean` | `preservePlayerViewSurface` | If set to true and the `PlayerView` is used, the playback surface be kept on screen and preserved when the player player is released.
    `boolean` | `pushBlackScreenOnDispose` | If true, indicates if the decoder should push a black screen to the surface when disposed.
    `boolean` | `restoreSpeed` | The flag to enable or disable automatic restoring of a speed after playing ads.
    `Bundle` | `segmentParameters` | Header params to add to segment requests
    `Bundle` | `segmentQueryParameters` | Query params to add to segment requests
    `List<SideloadedTrack>` | `sideloadedTracks` | Array of side-loaded tracks, either subtitles or thumbnails
    `int` | `subtitlesTrackGroupIndex` | The index of the selected subtitle track group or -1 for if subtitles are disabled
    `int` | `subtitlesTrackIndex` | The index of the selected subtitle track or -1 for if subtitles are disabled
    `boolean` | `threesixty` | 360 support
    `TrickplayConfiguration` | `trickplayConfiguration` | The Trickplay configuration
    `boolean` | `unsecureDecoderFallback` | If true (default), allows the player to fallback to unsecure decoders if it failed to initialize the primary decoder.
    `boolean` | `useEth0` | A boolean flag to indicate to use eth0 for multicast reception
    `String` | `userID` | User ID.
    `boolean` | `useStandaloneMediaClock` | If set to true, will use Exoplayer's `StandaloneMediaClock` instead of the Renderer Clock.
    `int` | `videoCodecFilter` | The video codec filter
    `boolean` | `videoDecoderFallback` | If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder.
    `VideoFilterConfiguration` | `videoFilterConfiguration` | The video filter configuration
    `Point` | `videoSizeFilter` | Deprecated. Use `VideoFilterConfiguration.maxPixel` instead.
    `int` | `videoTrackGroupIndex` | The index of the selected video track group
    `float` | `volume` | The audio track volume

    - ### Fields inherited from interface android.os.Parcelable

      `CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `PlayerConfig.Builder` | `buildUpon()` | Set the `Builder` values to the stored values in the `Bundle`.
    `int` | `describeContents()` |
    `boolean` | `equals​(Object obj)` |
    `static int` | `guessFormat​(String url)` | Guess the format of the or return `SdkConsts.CONTENT_TYPE_UNKNOWN`.
    `int` | `hashCode()` |
    `void` | `save​(Bundle bundle)` | Saves the current configuration into a `Bundle`.
    `Bundle` | `toBundle()` | Obtain a `Bundle` filled with key-value pairs representing the current configuration.
    `void` | `writeToParcel​(Parcel dest, int flags)` |

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

      `getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INTENT_CONFIGURATION_URL

          public static final String INTENT_CONFIGURATION_URL

      Intent key to specify an optional URL to an API endpoint that can be used to refresh the configuration.

      This is intended only informative purposes, no actual refreshing will be performed by the SDK.

      See Also:
        Constant Field Values

    - #### INTENT_CONFIGURATION_ID

          public static final String INTENT_CONFIGURATION_ID

      A unique ID for the configuration
      See Also:
        Constant Field Values

    - #### INTENT_LIVE

          public static final String INTENT_LIVE

      Indicates live content
      See Also:
        Constant Field Values

    - #### INTENT_THREESIXTY

          public static final String INTENT_THREESIXTY

      Indicates 360 degree content
      See Also:
        Constant Field Values

    - #### INTENT_METADATA

          public static final String INTENT_METADATA

      Additional Bundle-formatted meta-data such as poster images, titles, byline and any custom meta-data
      See Also:
        Constant Field Values

    - #### INTENT_PREFERRED_CODEC_INFOS

          public static final String INTENT_PREFERRED_CODEC_INFOS

      Preferred media codec infos
      See Also:
        Constant Field Values

    - #### positionUs

          public final long positionUs

      The position in microseconds. If set, `LiveConfiguration.liveEdgeLatencyMs` will be ignored. If there's an `InitialPositionProvider`, it will take precedence over this setting.

    - #### clippingStartUs

          public final long clippingStartUs

      The clipping start position in microseconds

    - #### clippingEndUs

          public final long clippingEndUs

      The clipping end position in microseconds

    - #### subtitlesTrackGroupIndex

          public final int subtitlesTrackGroupIndex

      The index of the selected subtitle track group or -1 for if subtitles are disabled

    - #### subtitlesTrackIndex

          public final int subtitlesTrackIndex

      The index of the selected subtitle track or -1 for if subtitles are disabled

    - #### audioTrackGroupIndex

          public final int audioTrackGroupIndex

      The index of the selected audio track group

    - #### audioTrackIndex

          public final int audioTrackIndex

      The index of the selected audio track

    - #### volume

          public final float volume

      The audio track volume

    - #### pauseOnHdmiDisconnected

          public final boolean pauseOnHdmiDisconnected

      Enable or disable automatic pausing on HDMI disconnected

    - #### videoTrackGroupIndex

          public final int videoTrackGroupIndex

      The index of the selected video track group

    - #### abrConfiguration

          public final AbrConfiguration abrConfiguration

      The initial video quality

    - #### bufferConfiguration

          public final BufferConfiguration bufferConfiguration

      The buffer configuration

    - #### liveConfiguration

          @Nullable
          public final LiveConfiguration liveConfiguration

      The Live configuration

    - #### networkConfiguration

          @NonNull
          public final NetworkConfiguration networkConfiguration

      The network configuration

    - #### trickplayConfiguration

          @NonNull
          public final TrickplayConfiguration trickplayConfiguration

      The Trickplay configuration

    - #### enableTrickplayMode

          public final boolean enableTrickplayMode

      Enable Trickplay mode at the start of the playback.
      See Also:
        `trickplayConfiguration`

    - #### enableDashEventCallback

          public final boolean enableDashEventCallback

      Enable internal handling of DASH event callbacks

    - #### mergeVideoTracks

          public final boolean mergeVideoTracks

      If True, the video tracks will be merged into a single video track

    - #### enableWorkaroundEveryVideoFrameIsSyncFrame

          public final boolean enableWorkaroundEveryVideoFrameIsSyncFrame

      If True, the workaround will be enabled to not treat the video frames as sync frames except the very first one. This flag may be needed to set up when the metadata of a video frame reports the video frame to be a sync frame (which is not in fact) but should not be treated as a sync frame by the decoder i.e. without the workaround the video artifacts appear upon every playback start and seek until the real key frame is rendered.

    - #### clipPeriods

          public final boolean clipPeriods

      If true then media periods will be clipped to their durations (currently is only applicable for DASH streams)

    - #### forceInStreamDrmInitData

          public final boolean forceInStreamDrmInitData

      If true then DRM init data from segments will be used instead of the one from manifest (currently is only applicable for DASH streams)

    - #### videoCodecFilter

          public final int videoCodecFilter

      The video codec filter

    - #### videoSizeFilter

          public final Point videoSizeFilter

      Deprecated.
      Use `VideoFilterConfiguration.maxPixel` instead.
      The video size filter

    - #### preferredCodecInfos

          @NonNull
          public final List<MediaCodecInfo> preferredCodecInfos

    - #### downloadFolder

          @Nullable
          public final String downloadFolder

      Download folder in case the content is played offline

    - #### enableTunneling

          public final boolean enableTunneling

      Enable tunneling support

    - #### enableTunnelingWithoutAudio

          public final boolean enableTunnelingWithoutAudio

      Force using of tunneling when audio track is disabled. To take effect the `enableTunneling` should also be on.

    - #### analyticsSessionType

          public final int analyticsSessionType

      Analytics session type

    - #### userID

          @Nullable
          public final String userID

      User ID. Unique identifier for the current user.

    - #### adRequest

          @Nullable
          public final AdRequest adRequest

      The Ad request (if any)

    - #### enableAdSpeedUp

          public final boolean enableAdSpeedUp

      The flag to enable or disable automatic setting of a speed to 1x when playing ads.

    - #### restoreSpeed

          public final boolean restoreSpeed

      The flag to enable or disable automatic restoring of a speed after playing ads.

    - #### configurationUrl

          @Nullable
          public final String configurationUrl

      Optional configuration backend url

    - #### id

          @NonNull
          public final String id

      ID for this content

    - #### contentUrl

          @NonNull
          public final String contentUrl

      Playback url

    - #### contentType

          public final int contentType

      The content format

    - #### autoPlay

          public final boolean autoPlay

      Whether to autoplay or not

    - #### live

          public final boolean live

      Content live or VoD

    - #### threesixty

          public final boolean threesixty

      360 support

    - #### preferredTextLanguage

          @Nullable
          public final String preferredTextLanguage

      Preferred subtitles language

    - #### preferredAudioLanguage

          @Nullable
          public final String preferredAudioLanguage

      Preferred audio language

    - #### sideloadedTracks

          @NonNull
          public final List<SideloadedTrack> sideloadedTracks

      Array of side-loaded tracks, either subtitles or thumbnails

    - #### metaData

          @Nullable
          public final Bundle metaData

      Optional metadata

    - #### contentParameters

          @Nullable
          public final Bundle contentParameters

      Header params to add to content (manifest) requests

    - #### segmentParameters

          @Nullable
          public final Bundle segmentParameters

      Header params to add to segment requests

    - #### contentQueryParameters

          public final Bundle contentQueryParameters

      Query params to add to content (manifest) requests

    - #### segmentQueryParameters

          @Nullable
          public final Bundle segmentQueryParameters

      Query params to add to segment requests

    - #### drmConfiguration

          @Nullable
          public final DrmConfiguration drmConfiguration

      Drm configuration (if any)

    - #### casConfiguration

          @Nullable
          public final CasConfiguration casConfiguration

      Cas configuration (if any)

    - #### preservePlayerViewSurface

          public final boolean preservePlayerViewSurface

      If set to true and the `PlayerView` is used, the playback surface be kept on screen and preserved when the player player is released. This allows to reuse (instead of re-create) the playback surface and can also be used to keep the last frame on screen even if the underlying player was already released.

    - #### pushBlackScreenOnDispose

          public final boolean pushBlackScreenOnDispose

      If true, indicates if the decoder should push a black screen to the surface when disposed. This is only relevant if you enabled `preservePlayerViewSurface`

    - #### useStandaloneMediaClock

          public boolean useStandaloneMediaClock

      If set to true, will use Exoplayer's `StandaloneMediaClock` instead of the Renderer Clock.

    - #### enableLooping

          public final boolean enableLooping

      If set to true then the playback looping will be enabled and the player will automatically restart the playback after reaching end of content

    - #### analyticsMetaData

          @Nullable
          public AnalyticsMetaData analyticsMetaData

      The analytics meta-data

    - #### audioAttributes

          @Nullable
          public AudioAttributes audioAttributes

      The Audio Attributes. If set to `SdkConsts.AUDIO_ATTRIBUTES_FOCUS_DISABLED`, the SDK won't request Audio Focus and play sound regardless of it. It is recommended to provide an instance of `AudioAttributes`, or at least use the default configuration.

    - #### adSchedule

          @Nullable
          public AdSchedule adSchedule

      Describes a custom ad schedule.

    - #### videoFilterConfiguration

          @NonNull
          public final VideoFilterConfiguration videoFilterConfiguration

      The video filter configuration

    - #### useEth0

          @Nullable
          public final boolean useEth0

      A boolean flag to indicate to use eth0 for multicast reception

    - #### videoDecoderFallback

          public final boolean videoDecoderFallback

      If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder. This can for instance happen if the primary decoder is a hardware implementation and is already blocked by another playback session. In that case, secondary decoders, i.e. software implementations, will be used if possible.

    - #### audioDecoderFallback

          public final boolean audioDecoderFallback

      If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder. This can for instance happen if the primary decoder is a hardware implementation and is already blocked by another playback session. In that case, secondary decoders, i.e. software implementations, will be used if possible.

    - #### unsecureDecoderFallback

          public final boolean unsecureDecoderFallback

      If true (default), allows the player to fallback to unsecure decoders if it failed to initialize the primary decoder. This requires `videoDecoderFallback` to also be enabled.

    - #### CREATOR

          public static final Parcelable.Creator<PlayerConfig> CREATOR

  - ### Method Detail

    - #### guessFormat

          public static int guessFormat​(@NonNull
                                        String url)

      Guess the format of the or return `SdkConsts.CONTENT_TYPE_UNKNOWN`.
      Parameters:
        `url` - the url to the content
      Returns:
        the format or `SdkConsts.CONTENT_TYPE_UNKNOWN`

    - #### save

          public void save​(@NonNull
                           Bundle bundle)

      Saves the current configuration into a `Bundle`.
      Parameters:
        `bundle` - the Bundle to which store the `PlayerConfig`

    - #### toBundle

          public Bundle toBundle()

      Obtain a `Bundle` filled with key-value pairs representing the current configuration. This Bundle can be used to `start playback` on a `PlayerController`.
      Returns:
        the Bundle

    - #### buildUpon

          public PlayerConfig.Builder buildUpon()

      Set the `Builder` values to the stored values in the `Bundle`.
      Returns:
        the Builder

    - #### describeContents

          public int describeContents()

      Specified by:
        `describeContents` in interface `Parcelable`

    - #### writeToParcel

          public void writeToParcel​(Parcel dest,
                                    int flags)

      Specified by:
        `writeToParcel` in interface `Parcelable`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals​(Object obj)

      Overrides:
        `equals` in class `Object`