Online Book Reader

Home Category

HTML5 Canvas [120]

By Root 6525 0
displayed on the canvas. This is just our first step toward integrating audio with the canvas, but it should give you a good idea of how we will start to use audio elements and manipulate them through JavaScript.

Figure 7-3 shows what this application looks like when it is executed in a web browser.

Figure 7-3. Showing audio properties on the canvas

There are also a few attributes displayed at the bottom of this list that we have not discussed. They all come from calls to the canPlayType() function of HTMLAudioElement. We are only displaying these right now, but in Example 7-3 we will make use of this function to help us decide which sound to dynamically load in JavaScript.

Example 7-3. Audio properties and the canvas

CH7EX3: Audio Properties And The Canvas

Your browser does not support HTML5 Canvas.

0%

Your browser does not support the audio element.

NOTE

This process is explained in detail in Chapter 6, where we warned that some browsers do not fire events for embedded

Playing a Sound

Return Main Page Previous Page Next Page

®Online Book Reader