HTML5 Canvas Book Notes

O’Reilly Forums For HTML5 Canvas

We’ve been answering questions about the book over at the O’Reilly forums.   Come on over and visit. : http://forums.oreilly.com/forum/110-html5-canvas/

Firefox 4 “loop” Missing

Firefox 4 has been giving me fits in the past week as I try to finish my HTML5 Canvas demo game, Brickbasher Infinity.   One of the outstanding issues is fact that the soundtrack does not loop in Firefox 4.

Today, I found out that the “loop” property was inexplicably removed from Firefox 4. It appears that this has been an issue fior a long time, but it was working in Firefox 3. Here is some more information: https://developer.mozilla.org/En/HTML/Element/audio

Code Tweak For Chapters 6 and 7

I noticed today that there are few places in the code examples that could be optimized. In ch. 6 and Ch. 7 you will see lines like this in the eventWindowLoaded() function:

videoElement.setAttribute(“src”, “muirbeach.” + videoType);
videoElement.addEventListener(“canplaythrough”,videoLoaded,false);

To work properly in all browsers, you should really swap these lines:

videoElement.addEventListener(“canplaythrough”,videoLoaded,false);
videoElement.setAttribute(“src”, “muirbeach.” + videoType);

Why? Because as soon as the “src” attribute is set, the video starts to load. Sett the event afterwards could have negative effects. I’ve noticed that this can help with some loading issues in FF4

Leave a Reply