VOPlayer

platypus. VOPlayer

new VOPlayer(game, assetCache)

This class is used to create platypus.game.voPlayer and manages playback by only playing one at a time, playing a list, and even handling captions at the same time.

This class borrows heavily from SpringRoll v1 to match the original capabilities exposed for Platypus v1.

Source:
Parameters:
Name Type Description
game Game

The game instance for which to play audio.

assetCache assetManager

The Platypus assetManager used to load and unload VO clips.

Extends

Methods

destroy()

Cleans up this VOPlayer.

Source:

getElapsed() → {int}

Calculates the amount of time elapsed in the current playlist of audio/silence.

Source:
Returns:
Type:
int

The elapsed time in milliseconds.

pause()

Pauses the current VO, caption, or silence timer if the VOPlayer is playing.

Source:

play(idOrList, callbackopt, cancelledCallbackopt)

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.

Source:
Parameters:
Name Type Attributes Description
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.

resume()

Resumes the current VO, caption, or silence timer if the VOPlayer was paused.

Source:
Listens to Events:

setCaptionMute(muted)

Whether to mute captions.

Source:
Parameters:
Name Type Description
muted Boolean

setMasterVolume(volume)

Sets the master volume of VO playback.

Source:
Parameters:
Name Type Description
volume Number

setVolume(volume)

Sets the volume of VO playback.

Source:
Parameters:
Name Type Description
volume Number

stop()

Stops playback of any audio/timer.

Source:

unloadSound(sound)

Unloads an audio track this VOPlayer has played.

Source:
Parameters:
Name Type Description
sound string

Sound to unload.

Events

end

Fired when a new VO, caption, or silence timer completes

Source:
Parameters:
Name Type Description
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

Source:
Parameters:
Name Type Description
currentVO String

The alias of the VO or caption that has begun, or null if it is a silence timer.