VOPlayer Class
A class for managing audio by only playing one at a time, playing a list, and even managing captions (CloudKidCaptions library) at the same time.
Constructor
VOPlayer
-
[useCaptions=false]
Parameters:
-
[useCaptions=false]
Bool | cloudkid.Captions optionalIf a cloudkid.Captions object should be created for use or the captions object to use
Item Index
Methods
Methods
_onAudioFinished
()
private
Callback for when audio/timer is finished to advance to the next item in the list.
_playAudio
()
private
Plays the current audio item and begins preloading the next item.
_update
-
elapsed
The update callback used for silence timers and updating captions without active audio. This method is bound to the VOPlayer instance.
Parameters:
-
elapsed
IntThe time elapsed since the previous frame, in milliseconds.
_updateCaptionPos
-
elapsed
The update callback used for updating captions with active audio. This method is bound to the VOPlayer instance.
Parameters:
-
elapsed
IntThe time elapsed since the previous frame, in milliseconds.
destroy
()
public
Cleans up this VOPlayer.
play
-
id
-
callback
-
cancelledCallback
Plays a single audio alias, interrupting any current playback.
playList
-
list
-
callback
-
cancelledCallback
Plays a list of audio files, timers, and/or functions, interrupting any current playback. Audio in the list will be preloaded to minimize pauses for loading.
stop
()
public
Stops playback of any audio/timer.
unloadPlayedAudio
()
public
Unloads all audio this VOPlayer has played. If trackAudio is false, this won't do anything.
Properties
_listCounter
Int
private
The current position in audioList.
_listHelper
Array
private
An Array used when play() is called to avoid creating lots of Array objects.
_timer
Int
private
A timer for silence entries in the list, in milliseconds.
audioList
Array
public
The current list of audio/silence times/functions. Generally you will not need to modify this.
playing
Bool
public
If VOPlayer is currently playing (audio or silence).
trackAudio
Bool
public
If the VOPlayer should keep a list of all audio it plays for unloading later. Default is false.