HTML and CSS Reference
In-Depth Information
You can go ahead and try this iteration by loading CH7EX8.html in your HTML5-
compliant web browser. In this case, it works! You hear every sound, and the browser
doesn't die like it would with iteration #2.
Unfortunately, there are some issues. On some browsers, there is still a pause before a
sound plays, just like with iteration #2. Again, this happens more often when the page
is loaded from an external website than when it is loaded locally in a web browser.
The worst manifestation of this comes in Google Chrome, where the sounds pause
every time they are played. Also, in Firefox, the src doesn't change for all the objects,
making the shoot sound play when the explode sound should play, and vice versa.
Uh-oh, it looks like we need another iteration. Figure 7-9 shows Space Raiders playing
with a pool size governed by MAX_SOUNDS .
Figure 7-9. Space Raiders with a sound pool
Search WWH ::

Custom Search