diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-08-09 10:24:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-09 10:24:04 +0300 |
commit | 40547e6914cd62ba6a718c00a2117451bf25c36d (patch) | |
tree | 28ae257d2e4890552317b429e67ae9ade30991ef /server | |
parent | 8ca1f5a677d4156b999942c852dc9fcb9eaf0e79 (diff) | |
download | vaadin-framework-40547e6914cd62ba6a718c00a2117451bf25c36d.tar.gz vaadin-framework-40547e6914cd62ba6a718c00a2117451bf25c36d.zip |
Add loop and preload attributes for media elements, fix null poster (#9797)
Picked from #9161
Fixes #7261
Fixes #5178
Fixes #4409
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/AbstractMedia.java | 43 |
1 files changed, 43 insertions, 0 deletions
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; @@ -199,6 +200,48 @@ public abstract class AbstractMedia extends AbstractComponent { } /** + * 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 <a href= + * "https://developer.mozilla.org/en/docs/Web/HTML/Element/video#attr-preload"> + * Mozilla Developer Network</a> 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. * |