Advertisement
Online Test Banks
Score higher
See Online Test Banks
eLearning
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

HTML5 Game Programming: Making Noise with the Sound Object

Part of the HTML5 Game Development For Dummies Cheat Sheet

You use the Sound object to create two sounds per object — an MP3 and an OGG — to ensure the sound effects in your game will work on most HTML5-compliant browsers.

sndElement = new Sound(src) Creates a new Sound object called sndElement based on the src file. This file should be in MP3, OGG, or WAV format.
play() Plays the current sound.
showControls() Displays the HTML5 sound control panel with a volume control and scrubber. Can be useful for iOS devices that require manual sound playback before code-based playback.
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win an iPad Mini. Enter to win now!