Class VideoUtil
- java.lang.Object
-
- com.brightcove.player.util.VideoUtil
-
public final class VideoUtil extends java.lang.ObjectAn Video utility class to perform tasks with Brightcove video objects.
-
-
Constructor Summary
Constructors Constructor Description VideoUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanaddCaptions(Video video, java.util.Map<java.lang.String,java.lang.String> languageCodeCaptionsMap)Adds theVideo.Fields.CAPTION_SOURCESvideo property with the languageCodeCaptionsMap, if and on only if, theVideo.Fields.CAPTION_SOURCESdoesn't exist.static voidaddClosedCaptionLanguagesMapToVideo(Video video)Queries the CAPTION_SOURCES Video property, and builds a Map of language/label references.static voidaddWatermarkingToken(Video video, java.lang.String token)Add a watermarking token to this video's sources if a placeholder is presentstatic voidcheckDolbyAtmosSources(Video video)If device does not support Dolby Atmos features, then filter relatedSource, only if it is Mpeg-DASHstatic voidcheckDolbyAtmosSources(java.util.Collection<Video> newVideos)If device does not support Dolby Atmos features, then filter relatedSource, only if they are Mpeg-DASHstatic voidfilterSourcesOnDeliveryType(Video video, DeliveryType deliveryTypeFilter)Filter this Video's SourceCollections to include only the specified DeliveryTypestatic booleanisClosedCaptionsEnabled(BaseVideoView videoView)Utility method to check if closed captions are enabled.static booleanisManifestTtlValid(Video video)Determine whether the video has the following properties: Video.Fields.MANIFEST_URL_TTL Video.Fields.MANIFEST_TIMESTAMPstatic voidremoveSidecarClosedCaptionSources(Video video)Removes existing Sidecar Captions Sources because they are likely not aligned with the Ad breaks in the VMAP for SSAI videos.static booleantoggleClosedCaptions(BaseVideoView videoView)Utility method to toggle the closed captions.
-
-
-
Method Detail
-
addCaptions
public static boolean addCaptions(@NonNull Video video, @NonNull java.util.Map<java.lang.String,java.lang.String> languageCodeCaptionsMap)Adds theVideo.Fields.CAPTION_SOURCESvideo property with the languageCodeCaptionsMap, if and on only if, theVideo.Fields.CAPTION_SOURCESdoesn't exist.- Parameters:
video- The video to add the captions to.languageCodeCaptionsMap- A map of language code to caption urls.- Returns:
- true if the captions were added to the video
-
toggleClosedCaptions
public static boolean toggleClosedCaptions(@NonNull BaseVideoView videoView)Utility method to toggle the closed captions.- Parameters:
videoView- the video view- Returns:
- true if closed captions were enabled.
-
isClosedCaptionsEnabled
public static boolean isClosedCaptionsEnabled(@NonNull BaseVideoView videoView)Utility method to check if closed captions are enabled.- Parameters:
videoView- the video view- Returns:
- true if closed captions are enabled.
-
addClosedCaptionLanguagesMapToVideo
public static void addClosedCaptionLanguagesMapToVideo(@NonNull Video video)Queries the CAPTION_SOURCES Video property, and builds a Map of language/label references.
-
removeSidecarClosedCaptionSources
public static void removeSidecarClosedCaptionSources(@NonNull Video video)Removes existing Sidecar Captions Sources because they are likely not aligned with the Ad breaks in the VMAP for SSAI videos. This method does not remove any in-manifest captions.
-
addWatermarkingToken
public static void addWatermarkingToken(Video video, java.lang.String token)
Add a watermarking token to this video's sources if a placeholder is present- Parameters:
video- The video that may have a token placeholder in its Source URLstoken- The watermarking token that will replace he placeholder in the Source URLs
-
isManifestTtlValid
public static boolean isManifestTtlValid(Video video)
Determine whether the video has the following properties: Video.Fields.MANIFEST_URL_TTL Video.Fields.MANIFEST_TIMESTAMPIf both properties are present and non-null, compute their summed values against the current System time to determine whether the Video's MANIFEST_TIMESTAMP property is expired
- Parameters:
video- The video that may have a token placeholder in its Source URLs
-
filterSourcesOnDeliveryType
public static void filterSourcesOnDeliveryType(Video video, DeliveryType deliveryTypeFilter)
Filter this Video's SourceCollections to include only the specified DeliveryType- Parameters:
video- The Video whose SourceCollections are to be filtereddeliveryTypeFilter- The DeliveryType to filter the Video's SourceCollectionsExamples: -- If the deliveryTypeFilter is DeliveryType.HLS, then all but the HLS sources in the Video are removed Special cases: -- If the specified DeliveryType is DeliveryType.DASH, then all but the DASH Sources will be filtered out of this Video -- If the specified DeliveryType is not found in the SourceCollection's keySet, then no Sources will be filtered out of this Video This includes DeliveryType.UNKNOWN
-
checkDolbyAtmosSources
public static void checkDolbyAtmosSources(Video video)
If device does not support Dolby Atmos features, then filter relatedSource, only if it is Mpeg-DASH- Parameters:
video- - Current video
-
-