Class DamVideoMediaMarkupBuilder

  • All Implemented Interfaces:
    MediaMarkupBuilder

    @Model(adaptables={org.apache.sling.api.SlingHttpServletRequest.class,org.apache.sling.api.resource.Resource.class})
    @ConsumerType
    public class DamVideoMediaMarkupBuilder
    extends java.lang.Object
    implements MediaMarkupBuilder
    Default implementation of MediaMarkupBuilder for DAM video assets.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accepts​(@NotNull Media media)
      Checks whether this builder can generate markup for the given media.
      protected void addSources​(io.wcm.handler.commons.dom.Video video, Media media)
      Add sources for HTML5 video player
      io.wcm.handler.commons.dom.HtmlElement build​(@NotNull Media media)
      Build media element markup
      protected java.util.Map<java.lang.String,​java.lang.String> getAdditionalFlashPlayerFlashVars​(Media media, Dimension dimension)
      Get additional parameters to be set as flashvars parameter on html object element for flash player.
      protected java.util.Map<java.lang.String,​java.lang.String> getAdditionalFlashPlayerParameters​(Media media, Dimension dimension)
      Get additional parameters to be set as <param> elements on html object element for flash player.
      protected @Nullable com.day.cq.dam.api.Asset getDamAsset​(Media media)  
      protected io.wcm.handler.commons.dom.Video getVideoPlayerElement​(@NotNull Media media)
      Build HTML5 video player element
      protected java.util.List<java.lang.String> getVideoProfileNames()
      Return video profile names stored below /etc/dam/video supported by this markup builder.
      protected java.util.List<com.day.cq.dam.video.VideoProfile> getVideoProfiles()
      Return video profiles supported by this markup builder.
      boolean isValidMedia​(@NotNull io.wcm.handler.commons.dom.HtmlElement element)
      Checks if the given HTML element is valid.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DamVideoMediaMarkupBuilder

        public DamVideoMediaMarkupBuilder()
    • Method Detail

      • accepts

        public final boolean accepts​(@NotNull
                                     @NotNull Media media)
        Description copied from interface: MediaMarkupBuilder
        Checks whether this builder can generate markup for the given media.
        Specified by:
        accepts in interface MediaMarkupBuilder
        Parameters:
        media - Media metadata
        Returns:
        true if this markup builder can handle the given media
      • getVideoProfileNames

        protected java.util.List<java.lang.String> getVideoProfileNames()
        Return video profile names stored below /etc/dam/video supported by this markup builder.
        Returns:
        Video profile names
      • getVideoProfiles

        protected java.util.List<com.day.cq.dam.video.VideoProfile> getVideoProfiles()
        Return video profiles supported by this markup builder.
        Returns:
        Video profiles
      • getDamAsset

        @Nullable
        protected @Nullable com.day.cq.dam.api.Asset getDamAsset​(Media media)
        Parameters:
        media - Media metadata
        Returns:
        DAM asset or null
      • build

        public final io.wcm.handler.commons.dom.HtmlElement build​(@NotNull
                                                                  @NotNull Media media)
        Description copied from interface: MediaMarkupBuilder
        Build media element markup
        Specified by:
        build in interface MediaMarkupBuilder
        Parameters:
        media - Media metadata
        Returns:
        Media element or null if media is invalid
      • getVideoPlayerElement

        protected io.wcm.handler.commons.dom.Video getVideoPlayerElement​(@NotNull
                                                                         @NotNull Media media)
        Build HTML5 video player element
        Parameters:
        media - Media metadata
        Returns:
        Media element
      • addSources

        protected void addSources​(io.wcm.handler.commons.dom.Video video,
                                  Media media)
        Add sources for HTML5 video player
        Parameters:
        video - Video
        media - Media metadata
      • getAdditionalFlashPlayerParameters

        protected java.util.Map<java.lang.String,​java.lang.String> getAdditionalFlashPlayerParameters​(Media media,
                                                                                                            Dimension dimension)
        Get additional parameters to be set as <param> elements on html object element for flash player.
        Parameters:
        media - Media metadata
        dimension - Dimension
        Returns:
        Set of key/value pairs
      • getAdditionalFlashPlayerFlashVars

        protected java.util.Map<java.lang.String,​java.lang.String> getAdditionalFlashPlayerFlashVars​(Media media,
                                                                                                           Dimension dimension)
        Get additional parameters to be set as flashvars parameter on html object element for flash player.
        Parameters:
        media - Media metadata
        dimension - Dimension
        Returns:
        Set of key/value pairs
      • isValidMedia

        public final boolean isValidMedia​(@NotNull
                                          @NotNull io.wcm.handler.commons.dom.HtmlElement element)
        Description copied from interface: MediaMarkupBuilder
        Checks if the given HTML element is valid. It is treated as invalid if it is null, or if it is a simple IMG element containing the dummy image.
        Specified by:
        isValidMedia in interface MediaMarkupBuilder
        Parameters:
        element - Media markup element.
        Returns:
        true if media element is invalid