001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.dto.html5; 014 015import java.net.*; 016import java.net.URI; 017 018import org.apache.juneau.*; 019import org.apache.juneau.annotation.*; 020 021/** 022 * DTO for an HTML {@doc ExtHTML5.embedded-content-0#the-video-element <video>} 023 * element. 024 * 025 * <ul class='seealso'> 026 * <li class='link'>{@doc DtoHtml5} 027 * </ul> 028 */ 029@Bean(typeName="video") 030public class Video extends HtmlElementContainer { 031 032 /** 033 * Creates an empty {@link Video} element. 034 */ 035 public Video() {} 036 037 /** 038 * Creates a {@link Video} element with the specified {@link Video#src(Object)} attribute. 039 * 040 * @param src The {@link Video#src(Object)} attribute. 041 */ 042 public Video(Object src) { 043 src(src); 044 } 045 046 /** 047 * {@doc ExtHTML5.embedded-content-0#attr-media-autoplay autoplay} 048 * attribute. 049 * 050 * <p> 051 * Hint that the media resource can be started automatically when the page is loaded. 052 * 053 * @param autoplay 054 * The new value for this attribute. 055 * Typically a {@link Boolean} or {@link String}. 056 * @return This object (for method chaining). 057 */ 058 public final Video autoplay(Object autoplay) { 059 attr("autoplay", deminimize(autoplay, "autoplay")); 060 return this; 061 } 062 063 /** 064 * {@doc ExtHTML5.embedded-content-0#attr-media-controls controls} 065 * attribute. 066 * 067 * <p> 068 * Show user agent controls. 069 * 070 * @param controls 071 * The new value for this attribute. 072 * Typically a {@link Boolean} or {@link String}. 073 * @return This object (for method chaining). 074 */ 075 public final Video controls(Object controls) { 076 attr("controls", deminimize(controls, "controls")); 077 return this; 078 } 079 080 /** 081 * {@doc ExtHTML5.embedded-content-0#attr-media-crossorigin crossorigin} 082 * attribute. 083 * 084 * <p> 085 * How the element handles cross-origin requests. 086 * 087 * @param crossorigin The new value for this attribute. 088 * @return This object (for method chaining). 089 */ 090 public final Video crossorigin(String crossorigin) { 091 attr("crossorigin", crossorigin); 092 return this; 093 } 094 095 /** 096 * {@doc ExtHTML5.embedded-content-0#attr-dim-height height} 097 * attribute. 098 * 099 * <p> 100 * Vertical dimension. 101 * 102 * @param height 103 * The new value for this attribute. 104 * Typically a {@link Number} or {@link String}. 105 * @return This object (for method chaining). 106 */ 107 public final Video height(Object height) { 108 attr("height", height); 109 return this; 110 } 111 112 /** 113 * {@doc ExtHTML5.embedded-content-0#attr-media-loop loop} attribute. 114 * 115 * <p> 116 * Whether to loop the media resource. 117 * 118 * @param loop 119 * The new value for this attribute. 120 * Typically a {@link Boolean} or {@link String}. 121 * @return This object (for method chaining). 122 */ 123 public final Video loop(Object loop) { 124 attr("loop", loop); 125 return this; 126 } 127 128 /** 129 * {@doc ExtHTML5.embedded-content-0#attr-media-mediagroup mediagroup} 130 * attribute. 131 * 132 * <p> 133 * Groups media elements together with an implicit MediaController. 134 * 135 * @param mediagroup The new value for this attribute. 136 * @return This object (for method chaining). 137 */ 138 public final Video mediagroup(String mediagroup) { 139 attr("mediagroup", mediagroup); 140 return this; 141 } 142 143 /** 144 * {@doc ExtHTML5.embedded-content-0#attr-media-muted muted} 145 * attribute. 146 * 147 * <p> 148 * Whether to mute the media resource by default. 149 * 150 * @param muted 151 * The new value for this attribute. 152 * Typically a {@link Boolean} or {@link String}. 153 * @return This object (for method chaining). 154 */ 155 public final Video muted(Object muted) { 156 attr("muted", muted); 157 return this; 158 } 159 160 /** 161 * {@doc ExtHTML5.embedded-content-0#attr-video-poster poster} 162 * attribute. 163 * 164 * <p> 165 * Poster frame to show prior to video playback. 166 * 167 * @param poster The new value for this attribute. 168 * @return This object (for method chaining). 169 */ 170 public final Video poster(String poster) { 171 attr("poster", poster); 172 return this; 173 } 174 175 /** 176 * {@doc ExtHTML5.embedded-content-0#attr-media-preload preload} 177 * attribute. 178 * 179 * <p> 180 * Hints how much buffering the media resource will likely need. 181 * 182 * @param preload The new value for this attribute. 183 * @return This object (for method chaining). 184 */ 185 public final Video preload(String preload) { 186 attr("preload", preload); 187 return this; 188 } 189 190 /** 191 * {@doc ExtHTML5.embedded-content-0#attr-media-src src} attribute. 192 * 193 * <p> 194 * Address of the resource. 195 * 196 * <p> 197 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 198 * Strings must be valid URIs. 199 * 200 * <p> 201 * URIs defined by {@link UriResolver} can be used for values. 202 * 203 * @param src 204 * The new value for this attribute. 205 * Typically a {@link URL} or {@link String}. 206 * @return This object (for method chaining). 207 */ 208 public final Video src(Object src) { 209 attrUri("src", src); 210 return this; 211 } 212 213 /** 214 * {@doc ExtHTML5.embedded-content-0#attr-dim-width width} attribute. 215 * 216 * <p> 217 * Horizontal dimension. 218 * 219 * @param width 220 * The new value for this attribute. 221 * Typically a {@link Number} or {@link String}. 222 * @return This object (for method chaining). 223 */ 224 public final Video width(Object width) { 225 attr("width", width); 226 return this; 227 } 228 229 230 //----------------------------------------------------------------------------------------------------------------- 231 // Overridden methods 232 //----------------------------------------------------------------------------------------------------------------- 233 234 @Override /* HtmlElement */ 235 public final Video _class(String _class) { 236 super._class(_class); 237 return this; 238 } 239 240 @Override /* HtmlElement */ 241 public final Video id(String id) { 242 super.id(id); 243 return this; 244 } 245 246 @Override /* HtmlElement */ 247 public final Video style(String style) { 248 super.style(style); 249 return this; 250 } 251 252 @Override /* HtmlElementContainer */ 253 public final Video children(Object...children) { 254 super.children(children); 255 return this; 256 } 257 258 @Override /* HtmlElementContainer */ 259 public final Video child(Object child) { 260 super.child(child); 261 return this; 262 } 263}