Package 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 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 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 Description 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.Source(java.util.Map<java.lang.String,java.lang.Object> properties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Integer
getBitRate()
Convenience getter to retrieve the property with a key of BIT_RATEjava.util.Map<java.lang.String,java.lang.Object>
getKeySystem(java.lang.String keySystem)
Returns the specified key system, or an empty Map if the key system can not be foundstatic java.lang.String
getSourceUrl(Source source)
Gets the URL of the source.java.lang.String
getUrl()
Convenience getter to retrieve the property with theSource.Fields.URL
keyboolean
hasHlseEncryption()
Checks if the source has HLSe encryption.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
-
-
-
-
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(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 assetdeliveryType
- 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 theSource.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 asSource.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 asSource.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.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classMetadataObject
-
-