API Documentation for: 2.1.0
Show:

VOPlayer Class

Defined in: VOPlayer:14
Namespace: cloudkid

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]
)

Defined in VOPlayer:14

Parameters:

  • [useCaptions=false] Bool | cloudkid.Captions optional

    If a cloudkid.Captions object should be created for use or the captions object to use

Methods

_onAudioFinished

() private

Callback for when audio/timer is finished to advance to the next item in the list.

_playAudio

() private

Defined in _playAudio:268

Plays the current audio item and begins preloading the next item.

_update

(
  • elapsed
)
private

Defined in _update:235

The update callback used for silence timers and updating captions without active audio. This method is bound to the VOPlayer instance.

Parameters:

  • elapsed Int

    The time elapsed since the previous frame, in milliseconds.

_updateCaptionPos

(
  • elapsed
)
private

The update callback used for updating captions with active audio. This method is bound to the VOPlayer instance.

Parameters:

  • elapsed Int

    The time elapsed since the previous frame, in milliseconds.

destroy

() public

Defined in destroy:319

Cleans up this VOPlayer.

play

(
  • id
  • callback
  • cancelledCallback
)
public

Defined in play:135

Plays a single audio alias, interrupting any current playback.

Parameters:

  • id String

    The alias of the audio file to play.

  • callback Function

    The function to call when playback is complete.

  • cancelledCallback Function

    The function to call when playback is interrupted with a stop(), play() or playList() call.

playList

(
  • list
  • callback
  • cancelledCallback
)
public

Defined in playList:154

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.

Parameters:

  • list Array

    The array of items to play/call in order.

  • callback Function

    The function to call when playback is complete.

  • cancelledCallback Function

    The function to call when playback is interrupted with a stop(), play() or playList() call.

stop

() public

Defined in stop:294

Stops playback of any audio/timer.

Properties

_audioInst

SoundInst private

Defined in _audioInst:74

The current audio instance being played.

_audioListener

Function private

Defined in _audioListener:95

The bound _onAudioFinished call.

_callback

Function private

Defined in _callback:81

The callback for when the list is finished.

_cancelledCallback

Function private

The callback for when the list is interrupted for any reason.

_currentAudio

String private

Defined in _currentAudio:67

The current audio alias being played.

_listCounter

Int private

Defined in _listCounter:60

The current position in audioList.

_listHelper

Array private

Defined in _listHelper:117

An Array used when play() is called to avoid creating lots of Array objects.

_timer

Int private

Defined in _timer:102

A timer for silence entries in the list, in milliseconds.

ALIAS

String private final static

Defined in ALIAS:44

The OS update callback alias for the VOPlayer

audioList

Array public

Defined in audioList:53

The current list of audio/silence times/functions. Generally you will not need to modify this.

captions

cloudkid.Captions public

Defined in captions:109

The cloudkid.Captions object used for captions. The developer is responsible for initializing this with a captions dictionary config file and a reference to a text field.

playing

Bool public

Defined in playing:124

If VOPlayer is currently playing (audio or silence).