Class VideoUtil

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

public final class VideoUtil extends Object
An Video utility class to perform tasks with Brightcove video objects.
  • Constructor Details

    • VideoUtil

      public VideoUtil()
  • Method Details

    • addCaptions

      public static boolean addCaptions(@NonNull Video video, @NonNull Map<String,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, 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
    • isManifestTtlValid

      public static boolean isManifestTtlValid(Video video)
      Determine whether the video has the following properties: Video.Fields.MANIFEST_URL_TTL Video.Fields.MANIFEST_TIMESTAMP

      If 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 filtered
      deliveryTypeFilter - The DeliveryType to filter the Video's SourceCollections

      Examples: -- 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 related Source, only if it is Mpeg-DASH
      Parameters:
      video - - Current video