From 40547e6914cd62ba6a718c00a2117451bf25c36d Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Wed, 9 Aug 2017 10:24:04 +0300 Subject: Add loop and preload attributes for media elements, fix null poster (#9797) Picked from #9161 Fixes #7261 Fixes #5178 Fixes #4409 --- .../src/main/java/com/vaadin/ui/AbstractMedia.java | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'server') diff --git a/server/src/main/java/com/vaadin/ui/AbstractMedia.java b/server/src/main/java/com/vaadin/ui/AbstractMedia.java index a992554d67..800f5dca31 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractMedia.java +++ b/server/src/main/java/com/vaadin/ui/AbstractMedia.java @@ -39,6 +39,7 @@ import com.vaadin.server.VaadinSession; import com.vaadin.shared.communication.URLReference; import com.vaadin.shared.ui.AbstractMediaState; import com.vaadin.shared.ui.MediaControl; +import com.vaadin.shared.ui.PreloadMode; import com.vaadin.ui.declarative.DesignAttributeHandler; import com.vaadin.ui.declarative.DesignContext; @@ -198,6 +199,48 @@ public abstract class AbstractMedia extends AbstractComponent { return getState(false).altText; } + /** + * Sets the preload attribute that is intended to provide a hint to the + * browser how the media should be preloaded. Valid values are 'none', + * 'metadata', 'preload', see the + * Mozilla Developer Network for details. + * + * @param preload + * preload mode + * @since 7.7.11 + */ + public void setPreload(final PreloadMode preload) { + getState().preload = preload; + } + + /** + * @return the configured media preload value + * @since 7.7.11 + */ + public PreloadMode getPreload() { + return getState(false).preload; + } + + /** + * Enables or disables looping. + * + * @param loop + * if true, enable looping + * @since 7.7.11 + */ + public void setLoop(final boolean loop) { + getState().loop = loop; + } + + /** + * @return true if looping is enabled + * @since 7.7.11 + */ + public boolean isLoop() { + return getState(false).loop; + } + /** * Set whether the alternative text ({@link #setAltText(String)}) is * rendered as HTML or not. -- cgit v1.2.3