HTML and CSS Reference
In-Depth Information
Supported Media Formats
Not all media formats will work on Android. Table 3-2 shows the formats that
should work with most, if not all, Android handsets.
Table 3-2. Supported HTML5 Audio Formats
Mime Type
File Name Extension
OGG Vorbis Audio
MP4 Audio
.m4a, .mp4, .3gp, .aac
WMA Audio
MP3 Audio
<canvas />
The <canvas /> element provides a context/stage in HTML for you to draw
shapes within. You will learn how to draw with the canvas JavaScript API in
Chapter 7.
The canvas API will give you an alternative to using DOM elements for graphic-
intensive animation or drawing. The <canvas /> element supports width and
height attributes. Any text within the <canvas /> element will be shown to
browsers that do not support it.
Listing 3-6 shows how to draw a simple semitransparent square using canvas.
Listing 3-6. Drawing a Simple Square in HTML5 Canvas
<canvas id="test-canvas" width="400" height="400">
<p>Your browser does not support HTML5 Canvas :(</p>
<script type="text/javascript">
var canvas = document.getElementById("test-canvas");
var context = canvas.getContext("2d");
context.fillStyle = "rgba(0, 0, 0, 0.5)"
context.fillRect(0, 0, 400, 400);
Search WWH ::

Custom Search