3 ms·
The documentation briefly mentioned supporting audio assets [1], but I haven't been able to find obvious examples of how to use them once they've been loaded. O
by portmanteaufu 15y ago
The documentation briefly mentioned supporting audio assets [1], but I haven't been able to find obvious examples of how to use them once they've been loaded. One of the provided sample games [2] had a soundtrack, so I dug through the source [3] a bit and discovered that there is an "Audio" class and some other undocumented functions that can be used with an "Assets" object to achieve playback. Looks like he's just coding to fast to keep everything written down. :)
[1] http://jawsjs.com/docs/symbols/jaws.Assets.html http://jawsjs.com/docs/symbols/jaws.Assets.html
[2] http://ippa.se/webgames/unexpected_outcome/ http://ippa.se/webgames/unexpected_outcome/
[3] http://ippa.se/webgames/unexpected_outcome/game.js http://ippa.se/webgames/unexpected_outcome/game.js
- ippa 15y agoHTML5 audio is kind of weaksauce atm yes. To support all major browsers I need to ship both oggs and mp3s for example. Jaws creates instances of Audio() for each sound, loading them by setting the src-attribute and listening for the canplay event before making the asset as fully loaded. Just google the Audio-tag, you have play(), pause() etc.