Module hilo/media/HTMLAudio
Requires
hilo/core/Class, hilo/util/util, hilo/event/EventMixin
Source
HTMLAudio.js
HTMLAudio is an audio playing module, which uses HTMLAudioElement to play audio.
Limits: iOS platform requires user action events to start playing, and many Android browser can only play one audio at a time.
| Property | Defined | |
|---|---|---|
|
autoPlay:Boolean
Is the audio autoplay, default value is false.
|
HTMLAudio | |
|
duration:Number
The duration of the audio, readonly!
|
HTMLAudio | |
|
loaded:Boolean
Is the audio resource loaded, readonly!
|
HTMLAudio | |
|
loop:Boolean
Is loop playback, default value is false.
|
HTMLAudio | |
|
muted:Boolean
Is the audio muted, default value is false.
|
HTMLAudio | |
|
playing:Boolean
Is the audio playing, readonly!
|
HTMLAudio | |
|
src:String
The source of the playing audio.
|
HTMLAudio | |
|
volume:Number
The volume of the audio, value between 0 to 1.
|
HTMLAudio | |
|
static
Does the browser supports HTMLAudio.
|
HTMLAudio |
| Method | Defined | |
|---|---|---|
|
HTMLAudio(properties:Object)
Constructor
|
HTMLAudio | |
|
load()
Load audio file.
|
HTMLAudio | |
|
pause()
Pause (halt) the currently playing audio.
|
HTMLAudio | |
|
play()
Start playing the audio.
|
HTMLAudio | |
|
resume()
Continue to play the audio.
|
HTMLAudio | |
|
setMute(muted)
Set mute mode.
|
HTMLAudio | |
|
setVolume(volume)
Set the volume.
|
HTMLAudio | |
|
stop()
Stop playing the audio.
|
HTMLAudio |