com.brightcove.player.util

## Class VideoUtil

- java.lang.Object
- - com.brightcove.player.util.VideoUtil

-     public final class VideoUtil
      extends java.lang.Object

  An Video utility class to perform tasks with Brightcove video objects.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VideoUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `addCaptions(Video video, java.util.Map<java.lang.String,java.lang.String> languageCodeCaptionsMap)` Adds the `Video.Fields#CAPTION_SOURCES` video property with the languageCodeCaptionsMap, if and on only if, the `Video.Fields#CAPTION_SOURCES` doesn't exist.
    `static void` | `addClosedCaptionLanguagesMapToVideo(Video video)` Queries the CAPTION_SOURCES Video property, and builds a Map of language/label references.
    `static void` | `addWatermarkingToken(Video video, java.lang.String token)` Add a watermarking token to this video's sources if a placeholder is present
    `static boolean` | `isClosedCaptionsEnabled(BaseVideoView videoView)` Utility method to check if closed captions are enabled.
    `static void` | `removeSidecarClosedCaptionSources(Video video)` Removes existing Sidecar Captions Sources because they are likely not aligned with the Ad breaks in the VMAP for SSAI videos.
    `static boolean` | `toggleClosedCaptions(BaseVideoView videoView)` Utility method to toggle the closed captions.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VideoUtil

          public VideoUtil()

  - ### Method Detail

    - #### addCaptions

          public static boolean addCaptions(@NonNull
                                            Video video,
                                            @NonNull
                                            java.util.Map<java.lang.String,java.lang.String> languageCodeCaptionsMap)

      Adds the `Video.Fields#CAPTION_SOURCES` video property with the languageCodeCaptionsMap, if and on only if, the `Video.Fields#CAPTION_SOURCES` doesn'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 URLs
        `token` - The watermarking token that will replace he placeholder in the Source URLs