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

AudioVideoLib - Instructions for Desktop Users



When you click on 'Add script', you will see a few new options, one of which will say 'Add audio (NEW)'.



This will bring up this screen, where you can select a sound from your computer, just like the old play sound.




You have a few options here.



- You can choose to show the audio controls, allowing the player to control things.




- You can add an ID to the audio element, which allows you to control that individual sound thereafter.




- You can add backup sources for browser compatibility, and you can enter URLs, as well.




- You can add a script to run once the sound has finished. This was designed to be used with the sync option, but you can use it without syncing, too.




IMPORTANT NOTE:



Using the sync option does NOT actually interrupt play. It only keeps the player from entering commands until the sound has finished, but we can add a script to run once the sound has finished to accomplish our needs.

Here is an example where a sound "interrupts play" in between rooms:




Stopping sounds



You can stop all sounds with DestroyAllAudio. (This even stops sounds played with the old play sound script command.)


You can stop one sound with DestroyAudio(id), but you must know the ID. (An ID can be assigned when adding audio.)




CONCERNING THE MP3 FORMAT



The mp3 format will not work in the desktop player when using these functions. It will, however, play an ogg file. To exacerbate things, I am not sure if the Safari browser will play the ogg format. My solution is to include both formats, as seen in the above example.

To make sure your sound will work in the desktop player, either include an ogg along with an mp3, or use the old play sound script command.


Adding a video is exactly the same as adding a sound, except there is an extra parameter (or option) to use autoplay.




Just like the mp3 format, the desktop version of Quest will not play the mp4 format. (I use ogv as a backup source.)







Stopping videos



This works just like stopping audio. You can use DestroyAllVideo or DestroyVideo(id).