HTMLAudio


Module hilo/media/HTMLAudio Requires hilo/core/Hilo, hilo/core/Class, 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.

Properties

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
HTMLAudio

Methods

Method Defined
HTMLAudio(properties:Object)
Constructor
HTMLAudio
load()
HTMLAudio
HTMLAudio
play()
HTMLAudio
HTMLAudio
setMute(muted)
HTMLAudio
setVolume(volume)
HTMLAudio
stop()
HTMLAudio

Property Detail

autoPlay:Boolean
Is the audio autoplay, default value is false.
duration:Number
The duration of the audio, readonly!
[Static] isSupported
loaded:Boolean
Is the audio resource loaded, readonly!
loop:Boolean
Is loop playback, default value is false.
muted:Boolean
Is the audio muted, default value is false.
playing:Boolean
Is the audio playing, readonly!
src:String
The source of the playing audio.
volume:Number
The volume of the audio, value between 0 to 1.

Constructor

HTMLAudio(properties:Object)
parameters
properties:Object — create object properties, include all writable properties of this class.

Method Detail

load()
pause()
play()
resume()
setMute(muted)
parameters
muted
setVolume(volume)
parameters
volume
stop()