Skip to content

Audio Methods

GodDragoner edited this page Apr 14, 2018 · 2 revisions

playAudio(String path)

Plays an audio file that matches the given path.

Parameters:

path - The path you want to play an audio file from

Alias: playSound

Example:

playAudio("Sounds/SomeSounds/run.mp3");

playAudio("Sounds/SomeSounds/run*.mp3"); -> Selects file at random from all files that start with run and end with .mp3

playAudio("Sounds/SomeSounds/*.mp3");

playAudio("Sounds/SomeSounds/*.{mp3,wav}");


playAudio(String path, boolean wait)

Plays an audio file that matches the given path and if wait is true waits for the audio file to end before continuing.

Parameters:

path - The path you want to play an audio file from

wait - Whether you want to wait for the audio file to end

Alias: playSound

Example:

playAudio("Sounds/SomeSounds/run.mp3", true);


stopAudio()

Stops all audio that is being played right now.

Example:

stopAudio();


stopAudio(String path)

Stops the specific audio file if it is being played right now.

Parameters:

path - The path to the audio file that you want to stop playing

Example:

stopAudio("Sounds/SomeSounds/run.mp3");


Clone this wiki locally