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 /shared | |
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 'shared')
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/ui/AbstractMediaState.java | 16 | ||||
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/ui/PreloadMode.java | 49 |
2 files changed, 65 insertions, 0 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/ui/AbstractMediaState.java b/shared/src/main/java/com/vaadin/shared/ui/AbstractMediaState.java index d7cddf566a..6d5024a324 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/AbstractMediaState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/AbstractMediaState.java @@ -36,6 +36,22 @@ public class AbstractMediaState extends AbstractComponentState { @NoLayout public boolean muted; + /** + * Preload mode for the media. + * + * @since 7.7.11 + */ + @NoLayout + public PreloadMode preload; + + /** + * Looping of media active (true) or not. + * + * @since 7.7.11 + */ + @NoLayout + public boolean loop; + public List<URLReference> sources = new ArrayList<>(); public List<String> sourceTypes = new ArrayList<>(); diff --git a/shared/src/main/java/com/vaadin/shared/ui/PreloadMode.java b/shared/src/main/java/com/vaadin/shared/ui/PreloadMode.java new file mode 100644 index 0000000000..111278fb0c --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/ui/PreloadMode.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui; + +/** + * Enumeration that provides a hint to the browser how media should be + * preloaded. + * + * @since 7.7.11 + */ +public enum PreloadMode { + /** + * Indicates that the whole video/audio file could be downloaded, even if + * the user is not expected to use it. This is the default value. + */ + AUTO, + + /** + * Indicates that only media metadata (e.g. length) should be preloaded. + */ + METADATA, + + /** + * Indicates that the video/audio should not be preloaded. + */ + NONE; + + /** + * Returns the preload mode string used by the browser. + * + * @return corresponding preload attribute value string + */ + public String getValue() { + return name().toLowerCase(); + } +} |