A class for managing audio by only playing one at a time, playing a list, and even managing captions (Captions library) at the same time.
_onSoundFinished
Callback for when audio/timer is finished to advance to the next item in the list.
_syncCaptionToSound
elapsed
The update callback used for updating captions with active audio. This method is bound to the VOPlayer instance.
elapsed
Int
The time elapsed since the previous frame, in milliseconds.
_updateSilence
elapsed
The update callback used for silence timers. This method is bound to the VOPlayer instance.
elapsed
Int
The time elapsed since the previous frame, in milliseconds.
_updateSoloCaption
elapsed
The update callback used for updating captions without active audio. This method is bound to the VOPlayer instance.
elapsed
Int
The time elapsed since the previous frame, in milliseconds.
getElapsed
Calculates the amount of time elapsed in the current playlist of audio/silence.
The elapsed time in milliseconds.
play
idOrList
[callback]
[cancelledCallback]
Plays a single audio alias, interrupting any current playback. Alternatively, plays a list of audio files, timers, and/or functions. Audio in the list will be preloaded to minimize pauses for loading.
idOrList
String | Array
The alias of the audio file to play or the array of items to play/call in order.
[callback]
Function
optional
The function to call when playback is complete.
[cancelledCallback]
Function | Boolean
optional
The function to call when playback
is interrupted with a stop() or play() call. If this value is a boolean
true
then callback will be used instead.
_listHelper
An Array used when play() is called to avoid creating lots of Array objects.
_trackedSounds
A list of audio file played by this, so that they can be unloaded later.
currentDuration
The duration of the currently playing item of audio/silence in milliseconds. If this is waiting on an audio file to load for the first time, it will be 0, as there is no duration data to give.
currentPosition
The amount of time elapsed in the currently playing item of audio/silence in milliseconds
currentVO
The current VO alias that is playing, even if it is just a caption. If a silence timer is running, currentVO will be null.
paused
If the sound is currently paused. Setting this has no effect - use pause() and resume().
trackSound
If the VOPlayer should keep a list of all audio it plays for unloading later. Default is false.
voList
The current list of audio/silence times/functions. Generally you will not need to modify this.
end
Fired when a new VO, caption, or silence timer completes
currentVO
String
The alias of the VO or caption that has begun, or null if it is a silence timer.
start
Fired when a new VO, caption, or silence timer begins
currentVO
String
The alias of the VO or caption that has begun, or null if it is a silence timer.