Information Technology Reference
In-Depth Information
The reason for the multiple tags is actually an ingenious method of writing one HTML
document that works across many browsers. Your browser, if it supports the HTML5
audio tag, will look through each of those source codec's until it finds one that works for
your browser. If it succeeds in finding an appropriate file (i.e., you provide a version of
the file that can be played on the users' system), it will play it. If it doesn't, it will do
nothing at all. If for some reason you are viewing this page from an older Android device
that does not display the audio tag, then the browser will ignore the element all together
and display the preset error message of " Sorry. Your browser does not support the
audio image " as shown in Figure 11-1.
Figure 11-1. The HTML5 audio element on an Android Gingerbread 2.3 device with the 'controls' the attributes set
Integrating Audio into Who's That Tweet?
In the first application we used in this topic, we asked people to guess which Twitter
account produced a given tweet. Now imagine we want to put in a bit of audio to soothe
the savage mind of those playing our game. We could easily do so with the Audio tag,
using the code in the following Listing 11-2.
 
Search WWH ::




Custom Search