audio
The HTML audio element is used to play audio files and optionally offer stock control components.
<audio src="Scurvy_Pirate.mp3" controls="controls" autoplay="autoplay">
Fallback embed or object tags go here
</audio>
Alternately you can supply the audio tag with <source> tags in place of using the "src" attribute and specify alternative audio file formats for different environments.
<audio controls="controls">
<source src="Scurvy_Pirate.mp3" type='audio/mpeg'>
<source src="Scurvy_Pirate.mp4" type='audio/mp4'>
<source src="Scurvy_Pirate.wav" type='audio/wav'>
<source src="Scurvy_Pirate.ogg" type='audio/ogg'>
Fallback embed or object tags go here
</audio>
File Formats
Due to inconsistencies between different browser software vendors we cannot just link to one sound resource file type to render HTML5 Audio. Using OGG and MP4 together is recommended to consider most browsing environments people would use. Currently Firefox and Opera prefer OGG files, Internet Explorer prefers MP3 or MP4 files, while Chrome will render most audio file types.
HTML Attributes
src - "path/to/audio_files/song.mp3"
the path(URL) to the audio file
autoplay - "autoplay" or ""
specify if the audio should auto play when the audio file is buffered enough
controls - "controls" or ""
tell the browser software to give controls for the audio playback
loop - "loop" or ""
specify if the audio should loop when it ends
mediagroup - string
link multiple media streams together into a media group
preload - "auto", "metadata", "none", ""
specify the download setting for the audio resource
auto - optimized downloading set for entire audio resource.
metadata - audio not expected to play, but fetching the metadata for it is desirable.
none - spend no resources fetching or preloading audio data.
Empty string is equivalent to "auto".
0 Response to "audio"
Post a Comment