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