Class: AudioHtml5Impl

AudioHtml5Impl

new mmir.env.media.AudioHtml5Impl()

The Audio abstraction that is returned by mmir.MediaManager#getURLAsAudio.

NOTE: when an audio object is not used anymore, its release method should be called.

This is the same interface as mmir.env.media.AudioCordovaImpl.

Methods

protecteddisable()

Disable audio (should only be used internally).

protectedenable()

Enable audio (should only be used internally).

getDuration(){Number}

Get the duration of the audio file
Returns:
duration in MS (or -1 if unknown)

isEnabled(){Boolean}

Check if audio is currently enabled
Returns:
if enabled

isPaused(){Boolean}

Check if audio is currently paused.

NOTE: the state "paused" is a different status than state "stopped".

Returns:
if paused, false otherwise

play(){Boolean}

Play audio.
Returns:
if playing was started immediately. If false, the Audio object may have been disabled, or is still preparing (in which case it is auto-started, when preparing completes)
Release audio: should be called when the audio file is not used any more.

NOTE some environments - such as Android - have limited resources available. Not releasing resources may result in not being able to instantiate new (audio) resources.

setVolume(value)

Set the volume of this audio file
Name Type Description
value Number the new value for the volume: a number between [0.0, 1.0]

stop(){Boolean}

Stop playing audio.
Returns:
if stopping was successful.