HTML and CSS Reference
In-Depth Information
auto —The server will have no problem with the browser download-
ing the entire video even if the user doesn't explicitly create it.
The browser is free to ignore the preload attribute—for example, a
mobile browser may choose not to download any media over a limited
cell connection unless the user explicitly requests it.
The autoplay and loop attributes
specify that the file is to start playing
as soon as the user loads the page and
to continue to play repeatedly after
it's started:
<audio src="myaudio.ogg" controls
autoplay loop>
Until recently the loop attribute didn't have any effect in browsers, but
you can simulate the effect in older browsers with a little JavaScript:
<audio src="myaudio.ogg" controls autoplay onended=";">
The ended event is fired when the video has finished playing. The code
waits for that event and starts the audio playing again when it happens.
Be careful with autoplay . Remember, your users may be working in a
quiet environment, or listening to music while they're browsing, or
depending on the audio provided by their screen-reader software, and
they may not appreciate an audible interruption from a website they
were only visiting to find a phone number.
If you're wondering why the <audio> element has opening and
closing tags, it's because <audio> is also a container for
other content. That content is displayed only if the
browser doesn't support the <audio> element. This allows
you to work around a lack of browser support.
Search WWH ::

Custom Search