Create and manage audio in the Phaser scene. Created with
PhaserGame$add_sound() method.
Methods
Method new()
Load a sound file and register it with the Phaser scene.
Arguments
name
Character. Unique key for the sound.
url
Character. URL or path to the audio file.
volume
Numeric. Initial playback volume from 0 to 1 (default: 1).
loop
Logical. Whether the sound should loop by default (default: FALSE).
session
Shiny session object.
Method play()
Play the sound.
Usage
Sound$play(volume = NULL, loop = NULL)
Arguments
volume
Numeric. Optional playback volume from 0 to 1. Defaults to
the sound's current/default volume.
loop
Logical. Optional loop setting for this playback. Defaults to
the sound's current/default loop setting.
Method pause()
Pause the sound.
Method resume()
Resume a paused sound.
Method set_volume()
Set the sound's volume.
Arguments
volume
Numeric. Volume from 0 to 1.
Method set_loop()
Set whether the sound loops by default.
Arguments
loop
Logical. Whether playback should loop.
Method clone()
The objects of this class are cloneable with this method.
Usage
Sound$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.