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

        public java.util.Map<java.lang.String,​java.lang.Object> getKeySystem​(@NonNull
                                                                                   java.lang.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 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.