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 HTML5.embedded-content-0#the-audio-element <audio>}
023 * element.
024 *
025 * <h5 class='section'>See Also:</h5>
026 * <ul class='doctree'>
027 *    <li class='link'>{@doc juneau-dto.HTML5}
028 * </ul>
029 */
030@Bean(typeName="audio")
031public class Audio extends HtmlElementContainer {
032
033   /**
034    * {@doc HTML5.embedded-content-0#attr-media-autoplay autoplay}
035    * attribute.
036    *
037    * <p>
038    * Hint that the media resource can be started automatically when the page is loaded.
039    *
040    * @param autoplay
041    *    The new value for this attribute.
042    *    Typically a {@link Boolean} or {@link String}.
043    * @return This object (for method chaining).
044    */
045   public final Audio autoplay(Object autoplay) {
046      attr("autoplay", deminimize(autoplay, "autoplay"));
047      return this;
048   }
049
050   /**
051    * {@doc HTML5.embedded-content-0#attr-media-controls controls}
052    * attribute.
053    *
054    * <p>
055    * Show user agent controls.
056    *
057    * @param controls
058    *    The new value for this attribute.
059    *    Typically a {@link Boolean} or {@link String}.
060    * @return This object (for method chaining).
061    */
062   public final Audio controls(Object controls) {
063      attr("controls", deminimize(controls, "controls"));
064      return this;
065   }
066
067   /**
068    * {@doc HTML5.embedded-content-0#attr-media-crossorigin crossorigin}
069    * attribute.
070    *
071    * <p>
072    * How the element handles cross-origin requests.
073    *
074    * @param crossorigin The new value for this attribute.
075    * @return This object (for method chaining).
076    */
077   public final Audio crossorigin(String crossorigin) {
078      attr("crossorigin", crossorigin);
079      return this;
080   }
081
082   /**
083    * {@doc HTML5.embedded-content-0#attr-media-loop loop} attribute.
084    *
085    * <p>
086    * Whether to loop the media resource.
087    *
088    * @param loop
089    *    The new value for this attribute.
090    *    Typically a {@link Boolean} or {@link String}.
091    * @return This object (for method chaining).
092    */
093   public final Audio loop(Object loop) {
094      attr("loop", loop);
095      return this;
096   }
097
098   /**
099    * {@doc HTML5.embedded-content-0#attr-media-mediagroup mediagroup}
100    * attribute.
101    *
102    * <p>
103    * Groups media elements together with an implicit MediaController.
104    *
105    * @param mediagroup The new value for this attribute.
106    * @return This object (for method chaining).
107    */
108   public final Audio mediagroup(String mediagroup) {
109      attr("mediagroup", mediagroup);
110      return this;
111   }
112
113   /**
114    * {@doc HTML5.embedded-content-0#attr-media-muted muted}
115    * attribute.
116    *
117    * <p>
118    * Whether to mute the media resource by default.
119    *
120    * @param muted
121    *    The new value for this attribute.
122    *    Typically a {@link Boolean} or {@link String}.
123    * @return This object (for method chaining).
124    */
125   public final Audio muted(Object muted) {
126      attr("muted", muted);
127      return this;
128   }
129
130   /**
131    * {@doc HTML5.embedded-content-0#attr-media-preload preload}
132    * attribute.
133    *
134    * <p>
135    * Hints how much buffering the media resource will likely need.
136    *
137    * @param preload The new value for this attribute.
138    * @return This object (for method chaining).
139    */
140   public final Audio preload(Object preload) {
141      attr("preload", preload);
142      return this;
143   }
144
145   /**
146    * {@doc HTML5.embedded-content-0#attr-media-src src} attribute.
147    *
148    * <p>
149    * Address of the resource.
150    *
151    * <p>
152    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
153    * Strings must be valid URIs.
154    *
155    * <p>
156    * URIs defined by {@link UriResolver} can be used for values.
157    *
158    * @param src
159    *    The new value for this attribute.
160    *    Typically a {@link URL} or {@link String}.
161    * @return This object (for method chaining).
162    */
163   public final Audio src(Object src) {
164      attrUri("src", src);
165      return this;
166   }
167
168
169   //-----------------------------------------------------------------------------------------------------------------
170   // Overridden methods
171   //-----------------------------------------------------------------------------------------------------------------
172
173   @Override /* HtmlElement */
174   public final Audio _class(String _class) {
175      super._class(_class);
176      return this;
177   }
178
179   @Override /* HtmlElement */
180   public final Audio id(String id) {
181      super.id(id);
182      return this;
183   }
184
185   @Override /* HtmlElement */
186   public final Audio style(String style) {
187      super.style(style);
188      return this;
189   }
190
191   @Override /* HtmlElementContainer */
192   public final Audio children(Object...children) {
193      super.children(children);
194      return this;
195   }
196
197   @Override /* HtmlElementContainer */
198   public final Audio child(Object child) {
199      super.child(child);
200      return this;
201   }
202}