Class Source

All Implemented Interfaces:
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:
  • Field Details

  • Constructor Details

    • Source

      public Source(Map<String,Object> properties)
      See Also:
    • Source

      public Source(String url)
      Initializes a Source with a single URL property.
      Parameters:
      url - the URL for this Source asset
    • Source

      public Source(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 Details

    • isLocal

      public boolean isLocal()
      Checks if the source points to local media.
      Returns:
      true if the source is local, otherwise false.
    • getUrl

      public String getUrl()
      Convenience getter to retrieve the property with the Source.Fields.URL key
      Returns:
      the URL property for this source
    • getBitRate

      public 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 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.
    • getKeySystem

      public Map<String,Object> getKeySystem(@NonNull String keySystem)
      Returns the specified key system, or an empty Map if the key system can not be found
      Parameters:
      keySystem - the unique identifier of the key systems, such as Source.Fields.WIDEVINE_KEY_SYSTEM.
      Returns:
      the Map of the specified key system, or null.
    • hasHlseEncryption

      public boolean hasHlseEncryption()
      Checks if the source has HLSe encryption.
      Returns:
      true if the source has either: - An "encryption" property Map (for Live streams) or - "aes128" in the source URL (for VOD) - otherwise false.
    • getSourceUrl

      @Nullable public static 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 String toString()
      Overrides:
      toString in class MetadataObject