Information Technology Reference
In-Depth Information
11
Chapter
Pushing the Limits with
Audio and Video
Audio and video are two of the most difficult topics to cover in the mobile web. While
each one individually can do a lot to enhance the visual and audible appeal of a site or
application, more often than not both technologies end up being abused by mobile
content creators. For example, one form of abuse I have noticed becoming more
common in the mobile world is audio based advertisements targeted toward mobile
browsers. While both audio and video technologies can be used incorrectly or just in a
regular plain old annoying manner, they do serve wonderful purposes when used
correctly.
Let's say, for instance, that we're working on a mobile gaming application and we want
to add some relaxing loop of background music to enhance our user's experience. We
can use the built-in HTML5 capabilities of the Android operating system's browser to do
this fairly easily, with only a few lines of code, when using the audio tag. On top of that,
we can even use a little bit of JavaScript to manipulate that audio element as well. We
can do things such as play, stop, or pause the audio on the press of a button.
We also have the ability, though Android's Browser program, to make use of the HTML5
video tag as well to enhance our web applications with video formatted in h.264, MPEG-4,
and WebM format. Both of these tags—the audio and video tag—when used properly,
can create some top-notch user experiences to enhance the applications they are
featured in and make them ooze with excellence.
Throughout this chapter we will take a look at each of these elements, their APIs, and
the pros and cons of using each of these new HTML5 tags in our budding applications.
Audio for Mobile Web Apps
Until a few years ago, if you, as a developer, wanted to include audio in your web
application, your choices were pretty slim to none. Almost every solution out there
involved using an Adobe Flash and would use Flash as a middleman to pipe the audio to
187
 
Search WWH ::




Custom Search