com.brightcove.player.model

## Class Video

- java.lang.Object
- - com.brightcove.player.model.MetadataObject
  - - com.brightcove.player.model.Video

- All Implemented Interfaces:
    android.os.Parcelable, java.io.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:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Video.Builder` Convenience Builder to build Video objects.
    `static interface` | `Video.CanSetDownloadIdentifier` Any method attempting to call `setDownloadId(UUID)` must be annotated explicitly with this annotation.
    `static interface` | `Video.CanSetLicenseExpiryDate` Any method attempting to call `setLicenseExpiryDate(Date)` must be annotated explicitly with this annotation.
    `static interface` | `Video.CanSetLicenseKeySetId` Any method attempting to call `setOfflinePlaybackLicenseKey(byte[])` must be annotated explicitly with this annotation.
    `static class` | `Video.Fields` Provides the list of known field names that can appear in the properties Map.
    `static class` | `Video.ProjectionFormat` The list of known projection formats.
    `static class` | `Video.Status`

    - ### Nested classes/interfaces inherited from interface android.os.Parcelable

      `android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static android.os.Parcelable.Creator<Video>` | `CREATOR` Creator for de-serializing Video object from the given `Parcel`.
    `static int` | `DEFAULT_LIVE_VIDEO_DURATION` Deprecated.
    `static int` | `DEFAULT_LIVE_VIDEO_DURATION_LONG` Represent the default duration for a Live Video.
    `static int` | `DEFAULT_REMOTE_VIDEO_DURATION` Represent the default duration for a Remote Video (including Remote Live Videos).
    `static int` | `PARCEL_OBJECT_TYPE` The type of the parcelable object.

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

      `properties, TAG`

    - ### Fields inherited from interface android.os.Parcelable

      `CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Video(java.util.Map<java.lang.String,java.lang.Object> properties)`
    `Video(java.util.Map<java.lang.String,java.lang.Object> properties, java.util.Set<SourceCollection> sourceCollectionSet)` Initializes a new Video with a predefined metadata properties collection and a predefined Set of SourceCollection objects.
    `Video(java.util.Map<java.lang.String,java.lang.Object> properties, java.util.Set<SourceCollection> sourceCollectionSet, java.util.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.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Video` | `createVideo(java.lang.String uri)` Creates a Video object from a string path.
    `static Video` | `createVideo(java.lang.String uri, DeliveryType type)` Creates a Video object from a string path.
    `static Video` | `createVideo(java.lang.String uri, DeliveryType type, Video.ProjectionFormat projectionFormat)` Creates a Video object from a string path.
    `static Video` | `createVideo(java.lang.String uri, Video.ProjectionFormat projectionFormat)` Creates a Video object from a string path.
    `int` | `describeContents()`
    `static DeliveryType` | `detectDeliveryType(java.lang.String uri)` Attempts to detect the delivery type of the asset URI provided.
    `Source` | `findHighQualitySource(DeliveryType deliveryType)` Finds the source with highest bitrate for the specified delivery type.
    `Source` | `findLowQualitySource(DeliveryType deliveryType)` Finds the source with lowest bitrate for the specified delivery type.
    `Video` | `fixProperties()` Ensures that the video properties to conform the expected value types.
    `java.util.List<CuePoint>` | `getCuePoints()` Retrieve a list of the cue points associated with this Video.
    `java.lang.String` | `getDescription()` It gets the video description from the `Video.Fields.SHORT_DESCRIPTION` video property if available, or an empty string otherwise.
    `java.util.UUID` | `getDownloadId()` Gets the globally unique identifier to the local copy of this video, if any.
    `int` | `getDuration()` Deprecated.
    `long` | `getDurationLong()` Convenience method for obtaining the parsed Duration value from the properties Map
    `java.lang.String` | `getId()` Convenience method for obtaining the parsed ID from the properties map.
    `java.util.Date` | `getLicenseExpiryDate()` Gets the UTC date and time when the offline playback license for this video will expire.
    `java.lang.String` | `getLongDescription()` It gets the video's long description from the `Video.Fields.LONG_DESCRIPTION` video property if available.
    `java.lang.String` | `getName()` It gets the video name from the `Video.Fields.NAME` video property if available, or an empty string otherwise.
    `byte[]` | `getOfflinePlaybackLicenseKey()` Gets the key set identifier for the current offline playback license for this video, if any.
    `java.net.URI` | `getPosterImage()` Gets the poster image source.
    `java.util.Set<java.net.URI>` | `getPosterSources()` Gets the list of poster sources.
    `java.util.List<PreviewThumbnailFormat>` | `getPreviewThumbnailSources()`
    `Video.ProjectionFormat` | `getProjectionFormat()` Gets the video format.
    `java.lang.String` | `getReferenceId()` Convenience method for obtaining the parsed reference identifier from the properties map.
    `SourceCollection` | `getSourceCollectionByDeliveryType(DeliveryType deliveryType)` Retrieve the SourceCollection associated with this Video and the specified Delivery Type.
    `java.util.Map<DeliveryType,SourceCollection>` | `getSourceCollections()` Retrieve a Set of the SourceCollections associated with this Video.
    `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.
    `java.net.URI` | `getStillImageUri()` It gets the `URI` from the `Video.Fields.STILL_IMAGE_URI` video property if available, or null otherwise.
    `java.net.URI` | `getThumbnail()` Gets the thumbnail image source.
    `java.util.Set<java.net.URI>` | `getThumbnailSources()` Gets the list of thumbnail sources.
    `boolean` | `isClearContent()` Check if the video is DRM free content.
    `boolean` | `isOfflineCopy()` Checks if this video is an offline copy, if and only if all of its sources are local.
    `boolean` | `isOfflinePlaybackAllowed()` Checks if the video can be stored locally on the host device.
    `boolean` | `isOwned()` Checks if the video has a valid purchase license.
    `boolean` | `isRented()` Checks if the video has a valid rental license.
    `boolean` | `isVideo360()` Checks if this is a 360 degree video.
    `void` | `setDownloadId(java.util.UUID downloadId)` Sets the globally unique identifier to the local copy of this video, if any.
    `void` | `setLicenseExpiryDate(java.util.Date expiryDate)` Sets the UTC date and time when the offline playback license for this video is expected to expire.
    `void` | `setOfflinePlaybackLicenseKey(byte[] licenseKeySetId)` Sets the key set identifier for the current offline playback license for this video, if any.
    `java.lang.String` | `toString()`
    `void` | `writeToParcel(android.os.Parcel parcel, int i)`

    - ### 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

    - #### DEFAULT_LIVE_VIDEO_DURATION

          public static final int DEFAULT_LIVE_VIDEO_DURATION

      Deprecated. Instead use {`DEFAULT_LIVE_VIDEO_DURATION_LONG`}
      See Also:
        Constant Field Values

    - #### DEFAULT_LIVE_VIDEO_DURATION_LONG

          public static final int DEFAULT_LIVE_VIDEO_DURATION_LONG

      Represent the default duration for a Live Video.
      See Also:
        Constant Field Values

    - #### 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:
        Constant Field Values

    - #### PARCEL_OBJECT_TYPE

          public static final int PARCEL_OBJECT_TYPE

      The type of the parcelable object.
      See Also:
        Constant Field Values

    - #### CREATOR

          public static android.os.Parcelable.Creator<Video> CREATOR

      Creator for de-serializing Video object from the given `Parcel`.

  - ### Constructor Detail

    - #### Video

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

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

    - #### Video

          public Video(java.util.Map<java.lang.String,java.lang.Object> properties,
                       java.util.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:
        `java.lang.IllegalArgumentException` - if either or both arguments are null

    - #### Video

          public Video(java.util.Map<java.lang.String,java.lang.Object> properties,
                       java.util.Set<SourceCollection> sourceCollectionSet,
                       java.util.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:
        `java.lang.IllegalArgumentException` - if either or both arguments are null

  - ### Method Detail

    - #### 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
                                                                 java.lang.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
                                          java.lang.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
                                          java.lang.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
                                          java.lang.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
                                          java.lang.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 java.util.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 java.util.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 java.lang.String toString()

      Overrides:
        `toString` in class `MetadataObject`

    - #### getId

          @NonNull
          public java.lang.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 java.lang.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 (however unlikely)

    - #### 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 (however unlikely)

    - #### 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 java.lang.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 java.lang.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 java.lang.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 java.net.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()`

    - #### getPosterImage

          @Nullable
          public java.net.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 java.net.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 java.util.Set<java.net.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 java.util.Set<java.net.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 java.util.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
                                    java.util.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:
        `java.lang.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:
        `java.lang.UnsupportedOperationException` - if the caller is not permitted to call this method.

    - #### getLicenseExpiryDate

          @Nullable
          public java.util.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
                                           java.util.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:
        `java.lang.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:
        `Source.isLocal()`

    - #### getPreviewThumbnailSources

          @NonNull
          public java.util.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`