diff options
author | Krassimir Valev <krassimir_valev@yahoo.com> | 2017-08-08 14:21:15 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-08-08 15:21:15 +0300 |
commit | e981dfbe1f782ae93844886270cac9651be5fb8d (patch) | |
tree | 90e261db1d46bf8e7a17dbe6f980956e13701dc6 /server | |
parent | 3766ab61c90885c8657186c4b033667dc2fa25db (diff) | |
download | vaadin-framework-e981dfbe1f782ae93844886270cac9651be5fb8d.tar.gz vaadin-framework-e981dfbe1f782ae93844886270cac9651be5fb8d.zip |
Added loop and preload attributes for media elements, fixed null poster (#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 a2f2c74d26..3bafa07dcb 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. * |