HTML and CSS Reference
There have been teething troubles with HTML5 and audio. The situation has improved drastically in recent times,
with more browsers implementing Web Audio API. On most mobile devices it was the case that sound sprites would
need to be used—a single audio file containing all the game sounds. The sprite is constantly played, with the playhead
being moved to the relevant time point, enabling playback of the required sound. This works to a degree, but when
you have put your all into making a great game, the last thing you want is to settle for single-channel audio.
The logical decision path for which audio method to deliver to a user has to favor multiple-channel audio above
all else. Funfair Freak-Out implements all three methods, as described in Figure 14-7 .
Figure 14-7. Audio rendering decision tree
In addition to sound sprites and Web Audio API, a third option is available for desktop: Flash playback. Okay, this
sounds like it is going against the grain of open standards, but we are building user-facing products here. The primary
concern should be the quality of the final outcome. So, on desktop the ubiquity of Flash and its audio capabilities
means that it has to come ahead of sound sprites on the priority list.
It is easy to get carried away with adding more and more graphics to a multiplatform HTML5 project. Who is going
to argue with a little eye candy? On desktop we arespoiled—the browsers all have a pretty high memory allocation
per page. This isn't the case on most mobile devices. Across the many projects that I have seen, problems have
begun when the asset set starts to clock in at more than 10MB. The issues range from full browser crashes to