CommandFusion iViewer
Scripting Documentation

Table of contents

Sound API

The Sound API allows a script to start playing, stop, mute and unmute sound files associated to the GUI.

Functions

CF.playSound(soundName)

Start playing a named sound (use either the sound name defined in the GUI project, or the sound file name). If the same sound is already playing, this will interrupt current play and restart from the beginning.

Example:

// Play a sound named "Welcome"
CF.playSound("Welcome");

CF.stopSound(soundName)

Stops playing a named sound (use either the sound name defined in the GUI project, or the sound file name). If the sound is not currently playing (i.e. playback has completed, or playback never occurred), this function does nothing.

Example:

// Stop playing the sound named "Welcome"
CF.stopSound("Welcome");

CF.muteSound(soundName)

While playing a sound, and without stopping playback, mute the named sound (use either the sound name defined in the GUI project, or the sound file name). If the sound is not currently playing, this function does nothing. Otherwise, this will set playback volume to 0 for this sound only, but will keep playing the sound.

Example:

// Mute (set volume to 0) the sound "Welcome" while playing
CF.muteSound("Welcome");

CF.unmuteSound(soundName)

Un-mute a previously muted sound: if the sound is playing and was previously muted, this will unmute the sound and restore volume at its normal level.

Example:

// Unmute (restore volume)
CF.unmuteSound("Welcome");