AudioVideoLib
× Home Adding the Library to Your Game Instructions Documentation WARNINGS
☰ Menu

Documentation






PlayAudio (src)

Plays a sound.




PlayAudioID (src, id)

Plays a sound with an assigned ID.




PlayAudioLooped (src)

Plays a looped sound.




PlayAudioLoopedID (src, id)

Plays a looped sound with an assigned ID.




PlayAudioSynced (src)

Plays a sound which interrupts play until it has finished.




PlayAudioSyncedID (src, id)

Plays a sound with an assigned ID which interrupts play until it has finished.




PlayAudioSyncedWithCallback (src, callback)

Plays a sound which interrupts play until it has finished, upon which time it invokes a callback script.




PlayAudioSyncedIDWithCallback (src, id, callback)

Plays a sound with an assigned ID which interrupts play until it has finished, upon which time it invokes a callback script.




PlayAudioControls (src)

Plays a sound. (The audio element will have controls displayed.)




PlayAudioIDControls (src, id)

Plays a sound with an assigned ID. (The audio element will have controls displayed.)




PlayAudioLoopedControls (src)

Plays a looped sound. (The audio element will have controls displayed.)




PlayAudioLoopedIDControls (src, id)

Plays a looped sound with an assigned ID. (The audio element will have controls displayed.)




PlayAudioSyncedControls (src)

Plays a sound which interrupts play until it has finished. (The audio element will have controls displayed.)




PlayAudioSyncedIDControls (src, id)

Plays a sound with an assigned ID which interrupts play until it has finished.

(The audio element will have controls displayed.)




PlayAudioSyncedWithCallbackControls (src, callback)

Plays a sound which interrupts play until it has finished, upon which time it invokes a callback script.

(The audio element will have controls displayed.)




PlayAudioSyncedIDWithCallbackControls (src, id, callback)

Plays a sound with an assigned ID which interrupts play until it has finished, upon which time it invokes a callback script.

(The audio element will have controls displayed.)




PlaySound (src, sync, loop, id, controls, addscript, callback)

Plays a sound. (This function is for the GUI. It is probably easier to use one of the functions listed above when actually coding.)




AddVideo (src, sync, loop, id, controls, autoplay, addscript, callback)

Plays a video.




HideVideo (id)

Hides a video.




DestroyVideo (id)

Removes a video.




DestroyAllVideos

Removes all videos.




ShowHiddenVideo (id)

Shows a hidden video.




PauseVideo (id)

Pauses a video.




ResumePausedVideo (id)

Resumes a paused video.




RestartPausedVideo (id)

Plays a paused video from the beginning.




SetVideoCurrentTime (id, time)

Plays a video from the specified time.




SetVideoWidth (id, width)

Sets the width of a video.




CreateVideoID

Creates an ID for a video element and returns it as a string.




SetVideoCallback (id, callback)

Adds a script which will be run when the video has finished playing to a dictionary named game.videofinishedcallback.




EndVideoSync (useless)

Called by JS to alert Quest that the video has finished playing.




EndVideoSyncAndInvoke (id)

Called by JS to alert Quest that the video has finished playing and runs the video's callback script.




DoVideoSync

Called internally to keep the player from entering commands during a sync.




CreateAudioID

Internal function

Creates an ID and returns it as a string.




SetAudioCallback

Internal function

Adds an entry to a script dictionary to be run when a sound finishes.




DestroyAllAudio

Stops ALL audio.




DestroyAudio (id)

Stops a sound.




PauseAudio (id)

Pauses a sound.
See ResumePausedAudio and RestartPausedAudio.




ResumePausedAudio (id)

Resumes a paused sound from its saved position.




RestartPausedAudio (id)

Starts a paused sound from the beginning.




PauseAllAudio

Pauses all sounds, saving the current position of each.




RestartAllPausedAudio

Restarts all paused sounds, each from its saved position.




SetAudioVolume (id, vol)

Sets the volume of a sound.
This must be a double, between 0.0 and 1.0.




MuteAudio (id)

Mutes a sound and saves the current level before doing so.
See UnmuteAudio.




UnmuteAudio (id)

Restores muted sound to its saved level.




MuteAllAudio

Mutes all sounds, saving the current level of each before doing so.
See UnmuteAllAudio.




UnmuteAllAudio

Restores all muted sounds, each to its saved level.




SetAllAudioVolume (vol)

Sets the volume of every sound to one level.
This must be a double between 0.0 and 1.0.




SetAudioCurrentTime (id, pos)

Sets the current time (or position) of a sound.




IncreaseVolume (id)

Increases the volume of a sound by .1.




DecreaseVolume (id)

Decreases the volume of a sound by .1.




IncreaseAllVolume

Increases the volume of every sound by .1.




DecreaseAllVolume

Decreases the volume of every sound by .1.




DestroyAudioAndRunScript (id)

Stops a sound and runs its callback script.




DoAudioSync

Internal function

This begins a simulated sync, stopping the player from entering commands.
See EndAudioSync and EndAudioSyncAndInvoke.




EndAudioSync

Internal function

Ends a simulated sync, resuming play.




EndAudioSyncAndInvoke (id)

Ends a simulated sync and runs a sounds callback script.




GetSrc (src)

Internal function

Takes a formatted string fo audio sources and returns the HTML string.




MobileCheck

Internal function

Adds a JS function to check for the mobile player. If it returns true, audio controls are automatically shown.




AddAudio (src)

Internal function

Adds a sound with no ID to the game and plays it.




AddAudioID (src, id)

Internal function

Adds a sound with an assigned ID to the game and plays it.




Debugging Functions






AudioLog (text)

Internal function.




TestAudio (src)

Tests whether a sound loads.




CONCERNING THE DESKTOP PLAYER AND THE MP3 FORMAT

The desktop version of Quest will not play an .mp3 from an HTML audio element (as of version 5.7.2), but it will play an .ogg.

On the other hand, most modern browsers will play .ogg files, but Internet Explorer and Edge will not. (I think Safari will play certain types of .ogg files, if you have the proper plugin, but I'm not certain.)



For more information concerning this:

https://en.wikipedia.org/wiki/HTML5_Audio#Supported_audio_coding_formats




As a "workaround", we can now include both formats.

PlayAudio("my-song.mp3;my-song.ogg")




CONCERNING MOBILE BROWSERS

These new functions automatically add the audio controls to the screen if a check for a mobile browser returns true.

ALSO: The player will have to actually press the play button for the sound to play, but looping and syncing should still work correctly.