com.brightcove.player.model

## Class Source

- java.lang.Object
- - com.brightcove.player.model.MetadataObject
  - - com.brightcove.player.model.SourceAwareMetadataObject
    - - com.brightcove.player.model.Source

- All Implemented Interfaces:
    java.io.Serializable

      public class Source
      extends SourceAwareMetadataObject

  The Source class is an immutable representation of a specific playable video asset, including the URL or other necessary information required to play the video.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Source.Fields` Provides the list of known field names that can appear in the properties Map.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `EXT_X_VERSION_4` The constant HLS EXT_X_VERSION_4.
    `static java.lang.String` | `EXT_X_VERSION_5` The constant HLS EXT_X_VERSION_5.

    - ### Fields inherited from class com.brightcove.player.model.MetadataObject

      `properties, TAG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Source(java.util.Map<java.lang.String,java.lang.Object> properties)`
    `Source(java.lang.String url)` Initializes a Source with a single URL property.
    `Source(java.lang.String url, DeliveryType deliveryType)` Initializes a Source with a single URL property with the given DeliveryType.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Integer` | `getBitRate()` Convenience getter to retrieve the property with a key of BIT_RATE
    `static java.lang.String` | `getSourceUrl(Source source)` Gets the URL of the source.
    `java.lang.String` | `getUrl()` Convenience getter to retrieve the property with the `Source.Fields.URL` key
    `boolean` | `hasKeySystem(java.lang.String keySystem)` Checks if the source has the specified key system.
    `boolean` | `isLocal()` Checks if the source points to local media.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class com.brightcove.player.model.SourceAwareMetadataObject

      `getDeliveryType, initializeDeliveryType`

    - ### Methods inherited from class com.brightcove.player.model.MetadataObject

      `getIntegerProperty, getIntegerProperty, getLongProperty, getProperties, getStringProperty, getStringProperty`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### EXT_X_VERSION_5

          public static final java.lang.String EXT_X_VERSION_5

      The constant HLS EXT_X_VERSION_5.
      See Also:
        Constant Field Values

    - #### EXT_X_VERSION_4

          public static final java.lang.String EXT_X_VERSION_4

      The constant HLS EXT_X_VERSION_4.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Source

          public Source(java.util.Map<java.lang.String,java.lang.Object> properties)

      See Also:
        `MetadataObject.MetadataObject(java.util.Map)`

    - #### Source

          public Source(java.lang.String url)

      Initializes a Source with a single URL property.
      Parameters:
        `url` - the URL for this Source asset

    - #### Source

          public Source(java.lang.String url,
                        DeliveryType deliveryType)

      Initializes a Source with a single URL property with the given DeliveryType.
      Parameters:
        `url` - the URL for this Source asset
        `deliveryType` - the DeliveryType for the Source asset

  - ### Method Detail

    - #### isLocal

          public boolean isLocal()

      Checks if the source points to local media.
      Returns:
        true if the source is local, otherwise false.

    - #### getUrl

          public java.lang.String getUrl()

      Convenience getter to retrieve the property with the `Source.Fields.URL` key
      Returns:
        the URL property for this source

    - #### getBitRate

          public java.lang.Integer getBitRate()

      Convenience getter to retrieve the property with a key of BIT_RATE
      Returns:
        the bit rate for this Source, or -1 if none specified

    - #### hasKeySystem

          public boolean hasKeySystem(@NonNull
                                      java.lang.String keySystem)

      Checks if the source has the specified key system.
      Parameters:
        `keySystem` - the unique identifier of the key systems, such as `Source.Fields.WIDEVINE_KEY_SYSTEM`.
      Returns:
        true if the source has the specified key system, otherwise false.

    - #### getSourceUrl

          @Nullable
          public static java.lang.String getSourceUrl(@Nullable
                                                                Source source)

      Gets the URL of the source.
      Parameters:
        `source` - the source.
      Returns:
        null if the source is null or if the source url is null, otherwise the source url as a string value.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `MetadataObject`