Class Video

All Implemented Interfaces:
android.os.Parcelable, Serializable

public class Video extends MetadataObject implements android.os.Parcelable
The Video class is an immutable representation of all data related to a video, including associated metadata (in properties) and the groupings of source assets for this video.
See Also:
  • Field Details

    • DEFAULT_LIVE_VIDEO_DURATION

      public static final int DEFAULT_LIVE_VIDEO_DURATION
      Deprecated. Instead use {DEFAULT_LIVE_VIDEO_DURATION_LONG}
      See Also:
    • DEFAULT_LIVE_VIDEO_DURATION_LONG

      public static final int DEFAULT_LIVE_VIDEO_DURATION_LONG
      Represent the default duration for a Live Video.
      See Also:
    • DEFAULT_REMOTE_VIDEO_DURATION

      public static final int DEFAULT_REMOTE_VIDEO_DURATION
      Represent the default duration for a Remote Video (including Remote Live Videos).
      See Also:
    • PARCEL_OBJECT_TYPE

      public static final int PARCEL_OBJECT_TYPE
      The type of the parcelable object.
      See Also:
    • CREATOR

      public static android.os.Parcelable.Creator<Video> CREATOR
      Creator for de-serializing Video object from the given Parcel.
  • Constructor Details

    • Video

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

      public Video(Map<String,Object> properties, Set<SourceCollection> sourceCollectionSet)
      Initializes a new Video with a predefined metadata properties collection and a predefined Set of SourceCollection objects.
      Parameters:
      properties - the metadata assigned to this instance
      sourceCollectionSet - the collections of video asset sources to associate with this Video
      Throws:
      IllegalArgumentException - if either or both arguments are null
    • Video

      public Video(Map<String,Object> properties, Set<SourceCollection> sourceCollectionSet, List<CuePoint> cuePoints)
      Initializes a new Video with a predefined metadata properties collection, a predefined Set of SourceCollection objects, and a list of cue points.
      Parameters:
      properties - the metadata assigned to this instance
      sourceCollectionSet - the collections of video asset sources to associate with this Video
      Throws:
      IllegalArgumentException - if either or both arguments are null
  • Method Details

    • getStatus

      @NonNull public Video.Status getStatus()
      Returns Video.Status.OK when the Video is valid and playable, or Video.Status.ERROR where there was an error while retrieving or creating the video.
      Returns:
      the Video.Status
    • fixProperties

      public Video fixProperties()
      Ensures that the video properties to conform the expected value types.
      Returns:
      reference to the video
    • detectDeliveryType

      @NonNull public static DeliveryType detectDeliveryType(@NonNull String uri)
      Attempts to detect the delivery type of the asset URI provided.
      Parameters:
      uri - the asset uri
      Returns:
      the delivery type
    • createVideo

      public static Video createVideo(@NonNull String uri)
      Creates a Video object from a string path. The video's delivery type will be set for URLs whose path end with .mp4 and .m3u(8). Otherwise it will be UNKNOWN.
      Parameters:
      uri - String URI to video
      Returns:
      the created Video object
    • createVideo

      public static Video createVideo(@NonNull String uri, Video.ProjectionFormat projectionFormat)
      Creates a Video object from a string path. The video's delivery type will be set for URLs whose path end with .mp4 and .m3u(8). Otherwise it will be UNKNOWN.
      Parameters:
      uri - String URI to video
      projectionFormat - the video projectionFormat
      Returns:
      the created Video object
    • createVideo

      public static Video createVideo(@NonNull String uri, DeliveryType type)
      Creates a Video object from a string path.
      Parameters:
      uri - String URI to video
      type - DeliveryType
      Returns:
      the created Video object
    • createVideo

      public static Video createVideo(@NonNull String uri, @Nullable DeliveryType type, @Nullable Video.ProjectionFormat projectionFormat)
      Creates a Video object from a string path.
      Parameters:
      uri - String URI to video
      type - DeliveryType
      projectionFormat - the projection format
      Returns:
      the created Video object
    • getCuePoints

      public List<CuePoint> getCuePoints()
      Retrieve a list of the cue points associated with this Video.
      Returns:
      a list of cue points or null if there are no cue points.
    • getSourceCollections

      public Map<DeliveryType,SourceCollection> getSourceCollections()
      Retrieve a Set of the SourceCollections associated with this Video.
      Returns:
      a collection of grouped Source video assets for this video
    • getSourceCollectionByDeliveryType

      @Nullable public SourceCollection getSourceCollectionByDeliveryType(DeliveryType deliveryType)
      Retrieve the SourceCollection associated with this Video and the specified Delivery Type. It returns null if no SourceCollection was found.
      Returns:
      the associated SourceCollection
    • findHighQualitySource

      @Nullable public Source findHighQualitySource(@NonNull DeliveryType deliveryType)
      Finds the source with highest bitrate for the specified delivery type.
      Parameters:
      deliveryType - the delivery type.
      Returns:
      null if a source was not found otherwise reference to the source.
    • findLowQualitySource

      @Nullable public Source findLowQualitySource(@NonNull DeliveryType deliveryType)
      Finds the source with lowest bitrate for the specified delivery type.
      Parameters:
      deliveryType - the delivery type.
      Returns:
      null if a source was not found otherwise reference to the source.
    • toString

      public String toString()
      Overrides:
      toString in class MetadataObject
    • getId

      @NonNull public String getId()
      Convenience method for obtaining the parsed ID from the properties map.
      Returns:
      String representing the ID of the Video. Returns empty string if none exists
    • getReferenceId

      @NonNull public String getReferenceId()
      Convenience method for obtaining the parsed reference identifier from the properties map.
      Returns:
      the video reference identifier, or an empty string if the video does not have reference identifier.
    • getDuration

      @Deprecated public int getDuration()
      Deprecated.
      Convenience method for obtaining the parsed Duration value from the properties Map
      Returns:
      the Duration, in milliseconds as an Integer. 0 if no duration key found, if the value fails to parse (e.g. if "zzz" is in the duration), or if the duration is actually 0 (as can be the case for remote Video objects)
    • getDurationLong

      public long getDurationLong()
      Convenience method for obtaining the parsed Duration value from the properties Map
      Returns:
      the Duration, in milliseconds as a Long. 0 if no duration key found, if the value fails to parse (e.g. if "zzz" is in the duration), or if the duration is actually 0 (as can be the case for remote Video objects)
    • getProjectionFormat

      @NonNull public Video.ProjectionFormat getProjectionFormat()
      Gets the video format.
      Returns:
      reference to the projection format. Default is Video.ProjectionFormat.NORMAL
    • isVideo360

      public boolean isVideo360()
      Checks if this is a 360 degree video.
      Returns:
      true if the video is a 360 degree video, otherwise false.
    • isClearContent

      public boolean isClearContent()
      Check if the video is DRM free content.
      Returns:
      true if the video is DRM free, otherwise false.
    • isOfflinePlaybackAllowed

      public final boolean isOfflinePlaybackAllowed()
      Checks if the video can be stored locally on the host device. A video is considered storable if it has Video.Fields.ODRM_PLAYBACK_ALLOWED flag set and has at least one DRM enabled source.
      Returns:
      true if the video can be stored, otherwise false.
    • getName

      @NonNull public String getName()
      It gets the video name from the Video.Fields.NAME video property if available, or an empty string otherwise.
      Returns:
      the video's name.
    • getDescription

      @NonNull public String getDescription()
      It gets the video description from the Video.Fields.SHORT_DESCRIPTION video property if available, or an empty string otherwise.
      Returns:
      the video's description.
    • getLongDescription

      @Nullable public String getLongDescription()
      It gets the video's long description from the Video.Fields.LONG_DESCRIPTION video property if available.
      Returns:
      the video's long description.
    • getStillImageUri

      @Nullable public URI getStillImageUri()
      It gets the URI from the Video.Fields.STILL_IMAGE_URI video property if available, or null otherwise. NOTE: It is recommended to use getPosterImage() instead.
      Returns:
      the Still Image
      See Also:
    • getPosterImage

      @Nullable public URI getPosterImage()
      Gets the poster image source. It selects a source from the list of Video.Fields.POSTER_SOURCES in the Video properties if available, giving preference to the HTTPS version of the poster source. If the Video.Fields.POSTER_SOURCES video property is not available, it will return the Video.Fields.STILL_IMAGE_URI video property, or null otherwise.
      Returns:
      the poster image
    • getThumbnail

      @Nullable public URI getThumbnail()
      Gets the thumbnail image source. It selects a source from the list of Video.Fields.THUMBNAIL_SOURCES in the Video properties if available, giving preference to the HTTPS version of the thumbnail source. If the Video.Fields.THUMBNAIL_SOURCES video property is not available, it will return the Video.Fields.THUMBNAIL video property, or null otherwise.
      Returns:
      the thumbnail
    • getPosterSources

      @NonNull public Set<URI> getPosterSources()
      Gets the list of poster sources. It gets the list from the Video.Fields.POSTER_SOURCES video property if available, or an empty list otherwise.
      Returns:
      the poster sources
    • getThumbnailSources

      @NonNull public Set<URI> getThumbnailSources()
      Gets the list of thumbnail sources. It gets the list from the Video.Fields.THUMBNAIL_SOURCES video property if available, or an empty list otherwise.
      Returns:
      the thumbnail sources
    • isOwned

      public boolean isOwned()
      Checks if the video has a valid purchase license.
      Returns:
      true if the video is owned, otherwise false.
    • isRented

      public boolean isRented()
      Checks if the video has a valid rental license.
      Returns:
      true if the video is rented, otherwise false.
    • getDownloadId

      @Nullable public UUID getDownloadId()
      Gets the globally unique identifier to the local copy of this video, if any.
      Returns:
      null if there is no local copy of the video, otherwise the globally unique identifier.
    • setDownloadId

      public void setDownloadId(@Nullable UUID downloadId)

      Sets the globally unique identifier to the local copy of this video, if any. This method exists so that globally unique identifier can be accessed conveniently from the associated video object.

      This method can be called only by methods within the SDK that have explicit permission.

      Parameters:
      downloadId - null if there is no local copy of the video, otherwise the globally unique identifier.
      Throws:
      UnsupportedOperationException - if the caller is not permitted to call this method.
    • getOfflinePlaybackLicenseKey

      @Nullable public byte[] getOfflinePlaybackLicenseKey()
      Gets the key set identifier for the current offline playback license for this video, if any.
      Returns:
      null if the video has no offline playback license, otherwise the license key identifier.
    • setOfflinePlaybackLicenseKey

      public void setOfflinePlaybackLicenseKey(@Nullable byte[] licenseKeySetId)

      Sets the key set identifier for the current offline playback license for this video, if any. This method exists so that the license key set identifier can be accessed conveniently from the associated video object. Setting or clearing the license key set identifier directly using this method will not grant or release the offline playback license.

      This method can be called only by methods within the SDK that have explicit permission.

      Parameters:
      licenseKeySetId - null if the video has no offline playback license, otherwise the license key identifier.
      Throws:
      UnsupportedOperationException - if the caller is not permitted to call this method.
    • getLicenseExpiryDate

      @Nullable public Date getLicenseExpiryDate()
      Gets the UTC date and time when the offline playback license for this video will expire.
      Returns:
      null if the video has no offline playback license, otherwise the date.
    • setLicenseExpiryDate

      public void setLicenseExpiryDate(@Nullable Date expiryDate)

      Sets the UTC date and time when the offline playback license for this video is expected to expire. Please note that changing this value here will not change the actual license expiry date. This method exists so that license expiry date can be accessed conveniently from the associated video object.

      This method can be called only by methods within the SDK that have explicit permission.

      Parameters:
      expiryDate - null if the video has no offline playback license, otherwise the date.
      Throws:
      UnsupportedOperationException - if the caller is not permitted to call this method.
    • isOfflineCopy

      public boolean isOfflineCopy()
      Checks if this video is an offline copy, if and only if all of its sources are local.
      Returns:
      true if the video is an offline copy, otherwise false.
      See Also:
    • getPreviewThumbnailSources

      @NonNull public List<PreviewThumbnailFormat> getPreviewThumbnailSources()
      Returns:
      a list of available sources with the preview thumbnails of the video.
    • describeContents

      public int describeContents()
      Specified by:
      describeContents in interface android.os.Parcelable
    • writeToParcel

      public void writeToParcel(android.os.Parcel parcel, int i)
      Specified by:
      writeToParcel in interface android.os.Parcelable