<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mozilla Hacks - the Web developer blog &#187; Video</title>
	<atom:link href="http://hacks.mozilla.org/category/video/feed/" rel="self" type="application/rss+xml" />
	<link>http://hacks.mozilla.org</link>
	<description>hacks.mozilla.org</description>
	<lastBuildDate>Wed, 08 Feb 2012 22:52:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>New features for HTML5 video playback in Firefox</title>
		<link>http://hacks.mozilla.org/2011/12/new-features-for-html5-video-playback-in-firefox/</link>
		<comments>http://hacks.mozilla.org/2011/12/new-features-for-html5-video-playback-in-firefox/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 12:55:54 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[aurora]]></category>
		<category><![CDATA[nightly]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=10562</guid>
		<description><![CDATA[As explained in this blog post by Jared Wein of the Firefox team there are quite a few new features in Firefox when it comes to playing HTML5 video. As an Aurora user, I am most excited about the option to go full-screen, the ability to overlay video statistics and to save a snapshot of [...]]]></description>
			<content:encoded><![CDATA[<p>As <a href="http://msujaws.wordpress.com/2011/12/16/more-enhancements-for-html5-video-and-audio-in-firefox/">explained in this blog post by Jared Wein of the Firefox team</a> there are quite a few new features in Firefox when it comes to playing HTML5 video. As an Aurora user, I am most excited about the option to go full-screen, the ability to overlay video statistics and to save a snapshot of the current frame as a JPG. You can see me talking about and showing them in <a href="http://vid.ly/3d8j8w">this short video</a>:</p>
<p><video width="100%" controls preload="none" poster="http://cf.cdn.vid.ly/3d8j8w/poster.jpg"><source src="http://cf.cdn.vid.ly/3d8j8w/mp4.mp4" type="video/mp4"><source src="http://cf.cdn.vid.ly/3d8j8w/webm.webm" type="video/webm"><source src="http://cf.cdn.vid.ly/3d8j8w/ogv.ogv" type="video/ogg"><a target="_blank" href="http://vid.ly/3d8j8w"><img src="http://cf.cdn.vid.ly/3d8j8w/poster.jpg" width="500"></a></video> </p>
<p>Firefox has a few features up its sleeve when it comes to HTML5 video playback you might not be aware of:</p>
<ul>
<li><strong>Firefox</strong>&#8216;s seeking is now accurate to <del>milliseconds</del><ins>microseconds</del>, there is visual feedback when the video has stalled and clicking the whole video pauses and plays it</li>
<li><strong>Firefox Beta</strong> has specialised controls when you watch video on small devices and watching HTML5 video shows a pleasing background rather than a brutal grey</li>
<li><strong>Firefox Aurora</strong> has fullscreen, statistics overlay, saving of snapshots and controls appearing when the video ended</li>
<li><strong>Firefox Nightly</strong> has a full-screen button, fading video controls after 2 seconds of non-interaction, no loading throbber on audio, error reporting <ins>when a video could not be loaded</ins> on the video, loop attribute support, and resizing of videos <ins>larger than the</ins> browser window when you watch them directly</li>
</ul>
<p>Planned features for Firefox are an overlay play button like YouTube when the video is not set to autoplay and turning off screensavers during fullscreen playback.</p>
<p>Check out <a href="http://msujaws.wordpress.com/2011/12/16/more-enhancements-for-html5-video-and-audio-in-firefox/">Jared&#8217;s post</a> for more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/12/new-features-for-html5-video-playback-in-firefox/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
<enclosure url="http://cf.cdn.vid.ly/3d8j8w/mp4.mp4" length="13914118" type="video/mp4" />
<enclosure url="http://cf.cdn.vid.ly/3d8j8w/webm.webm" length="14732072" type="video/webm" />
<enclosure url="http://cf.cdn.vid.ly/3d8j8w/ogv.ogv" length="11578918" type="video/ogg" />
		</item>
		<item>
		<title>Congrats to our July Dev Derby winners on their amazing HTML5 video demos!</title>
		<link>http://hacks.mozilla.org/2011/08/congrats-to-our-july-dev-derby-winners-on-their-amazing-html5-video-demos/</link>
		<comments>http://hacks.mozilla.org/2011/08/congrats-to-our-july-dev-derby-winners-on-their-amazing-html5-video-demos/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 20:38:11 +0000</pubDate>
		<dc:creator>Jay Patel</dc:creator>
				<category><![CDATA[Challenge]]></category>
		<category><![CDATA[Demo Studio]]></category>
		<category><![CDATA[Dev Derby]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[MDN]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Web Developers]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=9327</guid>
		<description><![CDATA[We shifted gears for July and invited Web developers to have some fun with HTML5 video for Dev Derby. We had 15 awesome demos submitted and while there was a lot of entertainment and innovation happening, we had to narrow them down to 5 finalists: Facial Recognition and Analytics with HTML5&#8242;s Video Tag HTML5 Video [...]]]></description>
			<content:encoded><![CDATA[<p>We shifted gears for July and invited Web developers to have some fun with <a href="https://developer.mozilla.org/En/HTML/Element/Video">HTML5 video</a> for Dev Derby.<br />
<img alt="" src="http://hacks.mozilla.org/wp-content/uploads/2011/07/logo-devderby.png" title="Mozilla Demo Studio presents Dev Derby on MDN" class="aligncenter" width="335" height="96" /></p>
<p>We had <a href="https://developer.mozilla.org/en-US/demos/devderby/tag/challenge%3A2011%3Ajuly/" title="MDN July Dev Derby - HTML5 video">15 awesome demos submitted</a> and while there was a lot of entertainment and innovation happening, we had to narrow them down to 5 finalists:</p>
<p><a href="https://developer.mozilla.org/en-US/demos/detail/facial-recognition-and-analytics-with-html5s-video">Facial Recognition and Analytics with HTML5&#8242;s Video Tag</a><br />
<a href="https://developer.mozilla.org/en-US/demos/detail/html5-video-voting">HTML5 Video Voting</a><br />
<a href="https://developer.mozilla.org/en-US/demos/detail/html5-vjing-tool">HTML5 VJing Tool</a><br />
<a href="https://developer.mozilla.org/en-US/demos/detail/jquery-videobg">jQuery VideoBG</a><br />
<a href="https://developer.mozilla.org/en-US/demos/detail/punch-the-tv">Punch the TV!</a></p>
<p>There are so many cool things you can do with HTML5 video on the Web, and our winners circle definitely reflects the possibilities.  So join us in congratulating our <a href="https://developer.mozilla.org/en-US/demos/devderby/tag/challenge%3A2011%3Ajuly/" title="MDN July Dev Derby - HTML5 video">July Dev Derby winners</a>!</p>
<p><a href="https://developer.mozilla.org/en-US/demos/devderby/tag/challenge%3A2011%3Ajuly/" title="MDN July Dev Derby - HTML5 video"><img src="http://hacks.mozilla.org/wp-content/uploads/2011/08/julyderbywinners2-500x175.png" alt="MDN July Dev Derby winners for HTML5 video" title="julyderbywinners2" width="500" height="175" class="aligncenter size-large wp-image-9362" /></a></p>
<p><strong>1st Place:</strong> <a href="https://developer.mozilla.org/en-US/demos/detail/html5-video-voting">HTML5 Video Voting</a> by <a href="https://developer.mozilla.org/en-US/profiles/jordan/">Jordan Humphreys</a><br />
<strong>2nd Place:</strong> <a href="https://developer.mozilla.org/en-US/demos/detail/html5-vjing-tool">HTML5 VJing Tool</a> by <a href="https://developer.mozilla.org/en-US/profiles/spite/">spite</a><br />
<strong>3rd Place:</strong> <a href="https://developer.mozilla.org/en-US/demos/detail/facial-recognition-and-analytics-with-html5s-video">Facial Recognition and Analytics with HTML5&#8242;s Video Tag</a> by <a href="https://developer.mozilla.org/en-US/profiles/dsg/">dsg</a> <strong><em>(@dsg: Please update your profile with an email address so we can contact you!  Thanks.)</em></strong></p>
<p><strong>Runners-up:</strong><br />
<a href="https://developer.mozilla.org/en-US/demos/detail/jquery-videobg">jQuery VideoBG</a><br />
<a href="https://developer.mozilla.org/en-US/demos/detail/punch-the-tv">Punch the TV!</a></p>
<p>Thanks to everyone that submitted their HTML5 video demos for the July Dev Derby. On to the next race!</p>
<p>Right now, there are only a few days left to submit your <a href="https://developer.mozilla.org/en-US/demos/devderby" title="Mozilla Demo Studio present the Dev Derby on MDN">History API demo for August</a>.  And coming up next we have <strong>Geolocation for September</strong> and <strong>CSS Media Queries for October</strong>.  So start experimenting and hack on.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/08/congrats-to-our-july-dev-derby-winners-on-their-amazing-html5-video-demos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 APIs &#8211; Where No Man Has Gone Before! &#8211; Presentation at Gotham JS</title>
		<link>http://hacks.mozilla.org/2011/07/html5-apis-where-no-man-has-gone-before-presentation-at-gotham-js/</link>
		<comments>http://hacks.mozilla.org/2011/07/html5-apis-where-no-man-has-gone-before-presentation-at-gotham-js/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 13:21:04 +0000</pubDate>
		<dc:creator>Robert Nyman</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[FileAPI]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Web Developers]]></category>
		<category><![CDATA[WebGL]]></category>
		<category><![CDATA[WebSocket]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=8758</guid>
		<description><![CDATA[Last weekend I was in New York City to speak at the GothamJS conference and Mozilla also sponsored it. It was a nice event with about 200 attendees, taking place in the NYIT Auditorium on Broadway. The event was one-track with 8 speakers, and personally I always prefer when it&#8217;s just one track for follow-up [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend I was in New York City to speak at the <a href="http://www.gothamjs.com/">GothamJS conference</a> and Mozilla also sponsored it. It was a nice event with about 200 attendees, taking place in the <a href="http://www.nyit.edu/aob/">NYIT Auditorium on Broadway</a>. </p>
<p>The event was one-track with 8 speakers, and personally I always prefer when it&#8217;s just one track for follow-up discussions and that everyone have seen and heard the same thing. The topics were ranging broadly between script loaders and HTML5 in one end, and voice-controlled telephony applications in the other.</p>
<h3>My presentation</h3>
<p>My talk was about HTML5 APIs in general, to give an introduction to them but also to inspire people to try things out and also give feedback to both working groups and web browser vendors about current implementations.</p>
<p><iframe style="border:none;width:510px;height:425px;" src="http://icant.co.uk/slidesharehtml/embed.php?url=http://www.slideshare.net/robnyman/html5-apis-where-no-man-has-gone-before-gothamjs&amp;width=460&amp;current=1"></iframe></p>
<p><a href="http://www.slideshare.net/robnyman/html5-apis-where-no-man-has-gone-before-gothamjs">Slides can also be downloaded at SlideShare</a>.</p>
<p>Additionally to the APIs covered in my <a href="http://hacks.mozilla.org/2011/07/html5-and-css3-exploring-mobile-possibilities-presentation-at-london-ajax-mobile-event/">London Ajax Mobile Event presentation</a>, I went through <a href="https://developer.mozilla.org/en/WebSockets">Web Sockets</a>, <a href="https://developer.mozilla.org/en/Using_files_from_web_applications">File API</a>, <a href="https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox">HTML5 video</a>, <a href="https://developer.mozilla.org/en/HTML/canvas">canvas</a> and <a href="https://developer.mozilla.org/en/WebGL">WebGL</a>. Also, if you are more interested in the &lt;canvas&gt; element, my colleague Rob Hawkes recently released the <a href="http://rawkes.com/foundationcanvas">Foundation HTML5 Canvas book</a>.</p>
<p>What I especially liked talking about is services like <a href="http://vid.ly/">vid.ly</a> which helps you take control over the problem of different video codec support in different web browsers, by storing various formats and then deliver the most suitable one depending on the web browser/device accessing it. </p>
<p>Another favorite is <a href="http://www.universalsubtitles.org/en/">Universal Subtitles</a>, which is an excellent tool for everyone to be able to add subtitles to a video clip, empowering users with varying language skills to take part of a video and its content and sharing it with the world.</p>
<p>An option to make the content of a web site richer, there is <a href="http://popcornjs.org/">Popcorn.js</a> to sync key events in the video playing to what kind of text or other information you want to present to go with that. To complement that, the <a href="http://butterapp.org/">Butterapp</a> is an editor to create that kind of content syncing, currently in alpha.</p>
<p>I also mentioned <a href="https://developer.mozilla.org/en-US/demos/detail/videograbber/launch">videograbber</a> for taking easy video screenshots in the web browser. </p>
<h3>Dev Derby &lt;video&gt; challenge</h3>
<p>I also want to take the opportunity to remind you that <a href="https://developer.mozilla.org/en-US/demos/devderby">Mozilla Dev Derby</a> has a challenge for what you can accomplish with the &lt;video&gt; that goes till the end of July, so please submit anything if you have a good idea!</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/07/html5-apis-where-no-man-has-gone-before-presentation-at-gotham-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lights, Camera, Action! July Dev Derby is all about HTML5 Video!</title>
		<link>http://hacks.mozilla.org/2011/07/lights-camera-action-july-dev-derby-is-all-about-html5-video/</link>
		<comments>http://hacks.mozilla.org/2011/07/lights-camera-action-july-dev-derby-is-all-about-html5-video/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 21:16:04 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[Dev Derby]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[competition]]></category>
		<category><![CDATA[devderby]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=8608</guid>
		<description><![CDATA[Show off your coolest video hack in July&#8217;s Mozilla Dev Derby! Moving pictures have always fascinated people. From the first zoetropes to the multi million dollar blockbusters of today &#8211; seeing things move grabs our attention as humans much better than any clever copy or imagery could. Video was alien to the web for a [...]]]></description>
			<content:encoded><![CDATA[<p>Show off your coolest video hack in July&#8217;s <a href="https://developer.mozilla.org/en-US/demos/devderby">Mozilla Dev Derby</a>!</p>
<p>Moving pictures have always fascinated people. From the first <a href="http://www.youtube.com/watch?v=kN9DD8jtXAo">zoetropes</a> to the multi million dollar blockbusters of today &#8211; seeing things move grabs our attention as humans much better than any clever copy or imagery could. Video was alien to the web for a long time. Well, not alien, but we needed plugins to make them play. With newer browsers and HTML5, we now have the <code>&lt;video&gt;</code> element to natively embed video in a web page. This allows us to, amongst other things:</p>
<ul>
<li>Style video elements with CSS and SVG</li>
<li>Make the video interact with other elements of the document and vice versa</li>
<li>Use Canvas to grab frames from videos and manipulate them</li>
<li>Create accessible video as the controls can be used with a keyboard without us having to write that functionality</li>
</ul>
<p>Using this arsenal, you can do pretty cool things. You can:</p>
<ul>
<li><a href="http://hacks.mozilla.org/2011/01/zooming-and-rotating-for-video-in-html5-and-css3/">write a player that rotates and zooms video</a> (<a href="https://github.com/codepo8/rotatezoomHTML5video">source on GitHub</a>)</li>
<li>Build your own <a href="http://hacks.mozilla.org/2010/12/spirit-of-indiana-jones-syncing-html5-video-with-maps/">Indiana Jones style maps</a> (<a href="https://github.com/codepo8/HTML5---map-and-video-syncing">GitHub</a>)</li>
<li><a href="http://people.mozilla.com/~prouget/demos/round/index.xhtml">Put your colleagues in a washing machine</a></li>
<li><a href="http://people.mozilla.com/~prouget/demos/green/green.xhtml">Simulate a green screen</a></li>
<li><a href="http://people.mozilla.com/~prouget/demos/mashup/video.xhtml">Apply CSS3 and SVG filters and transitions to video</a></li>
<li><a href="http://people.mozilla.com/~prouget/demos/DynamicContentInjection/play.xhtml">Inject other content into videos</a></li>
<li><a href="http://html5doctor.com/video-canvas-magic/">Stretch a video over the whole screen</a></li>
<li><a href="http://www.youtube.com/watch?v=sSLcsHAuiF8">Use video in a 3D environment</a></li>
<li><a href="https://github.com/codepo8/videograbber">Allow users to take screengrabs of videos</a> (<a href="https://github.com/codepo8/videograbber">source on GitHub</a>)</ul>
<p> ..and many more things.</p>
<p>Now it is your turn to show us what you can do with HTML5 video! We don&#8217;t expect you to build another <a href="http://www.thewildernessdowntown.com/">Wilderness Downtown</a> or <a href="http://ro.me">3 Dreams of Black</a>, but we are very excited to offer you the chance to shine in July&#8217;s <a href="https://developer.mozilla.org/en-US/demos/devderby">Mozilla Dev Derby</a>.</p>
<p>Why not use CSS3 and Canvas to redesign the <a href="http://www.youtube.com/watch?v=8CtjhWhw2I8">Outer Limits intro</a>? Why not make the video do the things Diana Ross talks about in <a href="http://www.youtube.com/watch?v=4GtyMeEcPPE">Upside down</a>? Why not build a video cropping tool in Canvas? How about you have a crack at making closed captioning and subtitling work with HTML5 video? There are many ideas floating about &#8211; it just needs a bit of drive and a text editor to go for it. So, show us what you can do! </p>
<p>There are a lot of tools out there to make your life easier with HTML5 video. <a href="http://vid.ly">Vid.ly</a> makes it easy to convert videos, <a href="http://popcornjs.org/">Popcorn.js</a> is a library to sync page content and video and there are many <a href="http://html5doctor.com/tag/video/">tutorials on video</a> available.</p>
<p>To get you into the mood and see some examples in action, we are running an <a href="http://hacks.mozilla.org/2011/06/webinar-deconstructing-html5-video/">HTML5 video webinar</a> on the 14th of July and you can ask some questions you have upfront <a href="https://www.google.com/moderator/#16/e=9ae94">using Google Moderator</a>.</p>
<p>Bring the web screen alive, I dare you! I am off to watch <a href="http://www.imdb.com/title/tt0095765/">Cinema Paradiso</a> again.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/07/lights-camera-action-july-dev-derby-is-all-about-html5-video/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Webinar: Deconstructing HTML5 video (The Spirit of Indiana Jones, Redux)</title>
		<link>http://hacks.mozilla.org/2011/06/webinar-deconstructing-html5-video/</link>
		<comments>http://hacks.mozilla.org/2011/06/webinar-deconstructing-html5-video/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 23:18:12 +0000</pubDate>
		<dc:creator>Janet Swisher</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Webinars]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=8597</guid>
		<description><![CDATA[Update 2011-07-20: The video recording of this webinar is now available: On Thursday, July 14th, at 16:00 UTC, Chris Heilmann will give second in the (so far sporadic) Mozilla Developer Engagement webinar series, discussing syncing HTML5 video with Google maps, using his &#8220;Spirit of Indiana Jones&#8221; demo as an example. Chris has already blogged about [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p><strong>Update 2011-07-20:</strong> The video recording of this webinar is now available:<br />
<video width="500" height="375" controls style="display:block"><br />
<source src="http://cf.cdn.vid.ly/7i5w8q/mp4.mp4" type="video/mp4"><br />
<source src="http://cf.cdn.vid.ly/7i5w8q/webm.webm" type="video/webm"><br />
<source src="http://cf.cdn.vid.ly/7i5w8q/ogv.ogv" type="video/ogg"><br />
<a target='_blank' href='http://vid.ly/7i5w8q'><img src='http://cf.cdn.vid.ly/7i5w8q/poster.jpg' width="500"></a><br />
</video><br />
<br/>
</p></blockquote>
<p>On Thursday, July 14th, at 16:00 UTC, Chris Heilmann will give second in the (so far sporadic) <a href="http://hacks.mozilla.org/category/webinars/">Mozilla Developer Engagement webinar series</a>, discussing syncing HTML5 video with Google maps, using his &#8220;Spirit of Indiana Jones&#8221; demo as an example. Chris has already <a href="http://hacks.mozilla.org/2010/12/spirit-of-indiana-jones-syncing-html5-video-with-maps/">blogged about this demo</a>, so this webinar is a chance for you to take part in a conversation, rather than just receive a broadcast. </p>
<p>Take a look at the <a href="https://github.com/codepo8/HTML5---map-and-video-syncing">demo code</a> and the <a href="http://hacks.mozilla.org/2010/12/spirit-of-indiana-jones-syncing-html5-video-with-maps/">blog post</a>, and then bring your questions to the webinar session. If you have a Google account, you can post questions (or respond to others&#8217;) ahead of time in this <a href="https://www.google.com/moderator/#16/e=9ae94">Google Moderator series</a>; if not, ask your questions in IRC during the session.</p>
<p>The webinar will be broadcast on <a href="http://air.mozilla.org/">Air Mozilla</a>, with text chat on #airmozilla on irc.mozilla.org. (There&#8217;s an IRC widget on the Air Mozilla page if you need it.)</p>
<p>Add this webinar to your calendar:<br />
<a target="_blank" href="https://www.google.com/calendar/event?action=TEMPLATE&#038;tmeid=ZXZvdHUzYTUwYjRncTBzNGVxMnEyb21wYzQgN2F0Z2Qyb3Z0dGRpZWExYThwNmZrc2tzZjhAZw&#038;tmsrc=7atgd2ovttdiea1a8p6fksksf8%40group.calendar.google.com"><img border="0" src="http://www.google.com/calendar/images/ext/gc_button1_en.gif"></a></p>
<p>Oh, by the way, HTML5 video is the theme of the <a href="https://developer.mozilla.org/demos/devderby">Mozilla Dev Derby for July</a>. Whether you&#8217;re new to working with HTML5 video or an &#8220;old pro&#8221; (if there is such a thing), <a href="https://developer.mozilla.org/en-US/demos/submit?tags=challenge%3A2011%3Ajuly">submit a demo during July</a> to show off your stuff and win cool prizes.<br />
<script type="text/javascript" src="http://s3.www.universalsubtitles.org/js/mirosubs-widgetizer.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/06/webinar-deconstructing-html5-video/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://cf.cdn.vid.ly/7i5w8q/mp4.mp4" length="364654617" type="video/mp4" />
<enclosure url="http://cf.cdn.vid.ly/7i5w8q/webm.webm" length="358288045" type="video/webm" />
<enclosure url="http://cf.cdn.vid.ly/7i5w8q/ogv.ogv" length="262435915" type="video/ogg" />
		</item>
		<item>
		<title>Syncing page content with HTML5 video (a different kind of webinar)</title>
		<link>http://hacks.mozilla.org/2011/03/syncing-page-content-with-html5-video/</link>
		<comments>http://hacks.mozilla.org/2011/03/syncing-page-content-with-html5-video/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 19:22:13 +0000</pubDate>
		<dc:creator>Janet Swisher</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Webinars]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=7407</guid>
		<description><![CDATA[If you&#8217;ve been around the software industry for a little while, you&#8217;ve probably attended at least a few &#8220;webinars&#8221;, where someone does an online presentation, which you can watch and listen to in real time. You might be able to ask questions via a chat window, and if you&#8217;re lucky, the presenter will select your [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been around the software industry for a little while, you&#8217;ve probably attended at least a few &#8220;webinars&#8221;, where someone does an online presentation, which you can watch and listen to in real time. You might be able to ask questions via a chat window, and if you&#8217;re lucky, the presenter will select your question to answer in the very limited time allocated for audience questions. If you can&#8217;t make it to the real-time presentation, you can watch a recording later, but you miss out on the Q&#038;A.</p>
<p>The Mozilla Developer Engagement team is experimenting with a slightly different approach to presenting webinars. We&#8217;re decoupling the presentation part from the Q&#038;A part. Instead of a real-time presentation with a little bit of Q&#038;A, we&#8217;re publishing a screencast, and scheduling time for online chat about it later. </p>
<p>You can view the screencast on your own time, as much as you need to, and peruse and play with the code under discussion. Then, for those who have questions, the presenter will be on IRC during scheduled times to discuss them. You&#8217;ll also be able to chat with other participants, which usually isn&#8217;t possible in a typical webinar.</p>
<p>Here is the first in an intended series of pseudo-webinars: Christian Heilmann talking about <strong>syncing page content with HTML5 video</strong>.</p>
<h2>The screencast</h2>
<p><object width="450" height="255" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="true" name="allowfullscreen"/><param value="always" name="allowscriptaccess"/><param value="high" name="quality"/><param value="true" name="cachebusting"/><param value="#000000" name="bgcolor"/><param name="movie" value="http://www.archive.org/flow/flowplayer.commercial-3.2.1.swf" /><param value="config={'key':'#$aa4baff94a9bdcafce8','playlist':['format=Thumbnail?.jpg',{'autoPlay':false,'url':'htmlsync_512kb.mp4'}],'clip':{'autoPlay':true,'baseUrl':'http://www.archive.org/download/SyncingPageContentWithHtml5Video/','scaling':'fit','provider':'h264streaming'},'canvas':{'backgroundColor':'#000000','backgroundGradient':'none'},'plugins':{'controls':{'playlist':false,'fullscreen':true,'height':26,'backgroundColor':'#000000','autoHide':{'fullscreenOnly':true}},'h264streaming':{'url':'http://www.archive.org/flow/flowplayer.pseudostreaming-3.2.1.swf'}},'contextMenu':[{},'-','Flowplayer v3.2.1']}" name="flashvars"/><embed src="http://www.archive.org/flow/flowplayer.commercial-3.2.1.swf" type="application/x-shockwave-flash" width="450" height="255" allowfullscreen="true" allowscriptaccess="always" cachebusting="true" bgcolor="#000000" quality="high" flashvars="config={'key':'#$aa4baff94a9bdcafce8','playlist':['format=Thumbnail?.jpg',{'autoPlay':false,'url':'htmlsync_512kb.mp4'}],'clip':{'autoPlay':true,'baseUrl':'http://www.archive.org/download/SyncingPageContentWithHtml5Video/','scaling':'fit','provider':'h264streaming'},'canvas':{'backgroundColor':'#000000','backgroundGradient':'none'},'plugins':{'controls':{'playlist':false,'fullscreen':true,'height':26,'backgroundColor':'#000000','autoHide':{'fullscreenOnly':true}},'h264streaming':{'url':'http://www.archive.org/flow/flowplayer.pseudostreaming-3.2.1.swf'}},'contextMenu':[{},'-','Flowplayer v3.2.1']}"></embed></object></p>
<h2>The chats</h2>
<p>Discussion of this screencast will take place in the #mdnlearning channel on irc.mozilla.org at the following times:</p>
<ul>
<li>10:00 UTC, Monday, 21 March <a target="_blank" href="https://www.google.com/calendar/event?action=TEMPLATE&#038;tmeid=ZTBnMjNyaWhrMGtuOG52ODFtanM4ZDZzaW8gN2F0Z2Qyb3Z0dGRpZWExYThwNmZrc2tzZjhAZw&#038;tmsrc=7atgd2ovttdiea1a8p6fksksf8%40group.calendar.google.com"><img border="0" src="http://www.google.com/calendar/images/ext/gc_button1_en.gif"></a></li>
<li>19:00 UTC, Monday, 21 March <a target="_blank" href="https://www.google.com/calendar/event?action=TEMPLATE&#038;tmeid=bXBiaGg5bzFzMDNyYXZvMTdoZXMwMjZzazAgN2F0Z2Qyb3Z0dGRpZWExYThwNmZrc2tzZjhAZw&#038;tmsrc=7atgd2ovttdiea1a8p6fksksf8%40group.calendar.google.com"><img border="0" src="http://www.google.com/calendar/images/ext/gc_button1_en.gif"></a></li>
</ul>
<p>If you don&#8217;t have an IRC client installed (such as the <a href="https://addons.mozilla.org/en-US/firefox/addon/chatzilla/">Chatzilla add-on for Firefox</a>), you can access the #mdnlearning channel via this <a href="http://">Mibbit</a> widget.</p>
<div style="clear: both"></div>
<p><iframe width=408 height=300 scrolling=no" style="border:0;padding-left:4px;" src="http://widget.mibbit.com/?settings=0ae7cc3ba98d704cbf6b532c87557873&#038;server=irc.mozilla.org&#038;channel=%23mdnlearning&#038;nick=visitor%3F%3F%3F&#038;noServerNotices=true&#038;noServerMotd=true&#038;autoConnect=true&#038;customprompt=Welcome%20To%20MDN%20Learning"></iframe>
<div style="clear: both"></div>
<p><em>We picked the times for the chat sessions to cover as many time zones as possible. We know they won&#8217;t be ideal for everybody. Please let us know in the comments how much lead time you&#8217;d like between publishing screencasts and the scheduled chats.</em></p>
<h2>The code</h2>
<p>The code that Chris demos in the screencast is available at <a href="https://github.com/codepo8/Syncing-Video">https://github.com/codepo8/Syncing-Video</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/03/syncing-page-content-with-html5-video/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Time to build a better web &#8211; a talk at Heart and Sole</title>
		<link>http://hacks.mozilla.org/2011/02/time-to-build-a-better-web-a-talk-at-heart-and-sole/</link>
		<comments>http://hacks.mozilla.org/2011/02/time-to-build-a-better-web-a-talk-at-heart-and-sole/#comments</comments>
		<pubDate>Sat, 19 Feb 2011 11:47:41 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[heartandsole]]></category>
		<category><![CDATA[inspiration]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=7248</guid>
		<description><![CDATA[A few weeks ago Portsmouth in England hosted the first Heart and Sole conference. This new conference had quite some appeal to me because of its nature: it was organised by local people who want to boost the web development market, it had rather unknown speakers who show a lot of great stuff online (and [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago Portsmouth in England hosted the first <a href="http://www.heartandsole.org.uk/">Heart and Sole</a> conference. This new conference had quite some appeal to me because of its nature: it was organised by local people who want to boost the web development market, it had rather unknown speakers who show a lot of great stuff online (and I wanted to see how they perform in front of an audience) and it was incredible affordable for the price of a sandwich lunch in London. </p>
<p>Seeing that the audience consisted almost exclusively of students and small agencies I thought I write a talk about HTML5 explaining that is not only a plaything of large companies and &#8220;web development rockstars&#8221; but that everybody can be part of the cause and that we really need people&#8217;s input and real life implementations to make the new open tech revolution a reality. </p>
<p>Here are the video recording and slides of my talk. You can also find the <a href="http://www.wait-till-i.com/2011/01/29/time-to-build-a-better-web-my-talk-at-heart-and-sole-slides-and-notes/">detailed notes of the slides here</a>. </p>
<h2>Video</h2>
<p>You can <a href="http://vid.ly/3l4e0q">see &#8220;Multimedia on the web&#8221; on any HTML5 enabled device here</a> (courtesy of vid.ly) or embedded here:</p>
<p><video src="http://vid.ly/3l4e0q?content=video" controls width="500"><a href="http://vidly.s3.amazonaws.com/3l4e0q/mp4.mp4">Download &#8220;Multimedia on the web&#8221; as MP4</a></video></p>
<h2>Slides</h2>
<p>The slides <a href="http://www.slideshare.net/cheilmann/time-to-build-a-better-web">are available on Slideshare</a>:</p>
<p><iframe src="http://icant.co.uk/slidesharehtml/embed.php?url=http://www.slideshare.net/cheilmann/time-to-build-a-better-web&#038;width=480" style="border:none;width:500px;height:410px"></iframe></p>
<h2>More videos of Heart and Sole</h2>
<p>You can see the <a href="http://www.vimeo.com/album/1532901">other videos of Heart and Sole on Vimeo</a> including a great Introduction to Canvas by Rob Hawkes, musings on Designing WordPress by John O&#8217;Nolan and Making Ajax userfriendly with the History API by Syd Lawrence.</p>
<p>There will be another Heart and Sole, so keep your eyes open.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/02/time-to-build-a-better-web-a-talk-at-heart-and-sole/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://vidly.s3.amazonaws.com/3l4e0q/mp4.mp4" length="270951446" type="video/mp4" />
		</item>
		<item>
		<title>Simple HTML5 video encoding with vid.ly &#8211; interview, first impressions and invite code</title>
		<link>http://hacks.mozilla.org/2011/01/simple-html5-video-encoding-with-vid-ly-interview-first-impressions-and-invite-code/</link>
		<comments>http://hacks.mozilla.org/2011/01/simple-html5-video-encoding-with-vid-ly-interview-first-impressions-and-invite-code/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 20:24:45 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[Video]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=7098</guid>
		<description><![CDATA[Today encoding.com released a new service called vid.ly which is not yet another URL shortener, but actually a very impressive service for converting video. One of the biggest annoyance of using HTML5 video is to convert your movie to various formats supported by different browsers. Vid.ly does this job for you: it converts the video [...]]]></description>
			<content:encoded><![CDATA[<p>Today encoding.com released a new service called <a href="http://vid.ly">vid.ly</a> which is not yet another URL shortener, but actually a very impressive service for converting video. </p>
<p>One of the biggest annoyance of using HTML5 video is to convert your movie to various formats supported by different browsers. Vid.ly does this job for you: it converts the video you upload into 14 different formats for different browsers and, more importantly, devices. The interface is very intuitive and you can stand by and watch the conversion happen or simply let it run whilst you go offline or do other things. Once the service finished creating the different formats for you, you get an email. You then can visit the vid.ly URL on different devices and you get the video in the correct format.</p>
<h2>Interview with Jeff Malkin about vid.ly</h2>
<p>To learn more about the service, I got Jeff Malkin, president of Encoding.com on the phone and asked him a few things about the service. You can <a href="http://www.archive.org/download/InterviewWithJeffMalkinOfEncoding.comAboutVid.ly/InterviewWithJeffMalkinAboutVid.ly.mp3">listen to the interview</a>:</p>
<p><audio controls="true" style="display:block;margin:1em;"><source src="http://www.archive.org/download/InterviewWithJeffMalkinOfEncoding.comAboutVid.ly/InterviewWithJeffMalkinAboutVid.ly.mp3" type="audio/mp3"><source src="http://www.archive.org/download/InterviewWithJeffMalkinOfEncoding.comAboutVid.ly/InterviewWithJeffMalkinAboutVid.ly.ogg" type="audio/ogg">Your browser doesn&#8217;t support <span class="caps">HTML5</span> audio and probably hates puppies &#8211; please <a href="http://www.archive.org/download/InterviewWithJeffMalkinOfEncoding.comAboutVid.ly/">download the audio at archive.org</a></audio></p>
<p>In the interview Jeff answered a few questions and explained a few of my concerns:</p>
<ul>
<li>Vid.ly uses the same cloud backend as encoding.com, consisting of Amazon&#8217;s EC2 and S3 services and fallbacks</li>
<li>The conversion happens with ffmpeg and a few other, commercial products as vid.ly also creates a high quality FLV for you</li>
<li>The videos are tested on the real devices and they are also using services that give them access to more exotic physical devices on demand</li>
<li>In addition to simply converting the videos to MP4 and Ogg (which can be done using <a href="http://archive.org">Archive.org</a>), vid.ly also creates iOS versions that support adaptive streaming and webm versions.</li>
<li>There is no API to make part of a build process in the free version but they are working on a pro version that will allow you to batch process videos and have more granular access to the encoding parameters</li>
<li>Right now, you can&#8217;t send the converted videos back to a hosting platform of your own choice but this is also in the making.</li>
</ul>
<h2>First impressions</h2>
<p>When trying out the service with a video, I was very impressed with the interface. After entering your code you get a video URL. Pressing start asks you for an email (to notify you once the conversion is done) and offers you an interface to upload your video, either from FTP, HTTP, S3 or your hard drive. A log on the page tells you at any time what is happening:</p>
<p><video controls="true" height="295" width="480"><source src="http://www.archive.org/download/UsingVid.lyToConvertVideoOnTheWeb/screencast3_512kb.mp4" type="video/mp4"><source src="http://videos.mozilla.org/serv/mozhacks/video-encoding.webm" type="video/webm"><source src="http://www.archive.org/download/UsingVid.lyToConvertVideoOnTheWeb/screencast3.ogv" type="video/ogg">Your browser does not support the video tag, <a href="http://www.archive.org/download/UsingVid.lyToConvertVideoOnTheWeb/">check the video on Archive.org</a>.</video> </p>
<p>The whole page is a progress bar. Once you uploaded the video the progress starts from left to right and tells you in the log box what is going on. You can stand by or close the page &#8211; vid.ly emails you once the conversion is done.</p>
<h2>Under the hood</h2>
<p>Once the conversion is done, you get the email with your URL and you can try it on different devices. I checked it on my Nexus One and my iPod and got working videos on each without any redirect, ad display or other annoyances. </p>
<p>The embed code vid.ly sends you can be improved a bit but was built for ease of use:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;video</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;vidly-video&quot;</span> <span style="color: #000066;">controls</span>=<span style="color: #ff0000;">&quot;controls&quot;</span> </span>
<span style="color: #009900;"><span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;640&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;390&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span></span>
<span style="color: #009900;"><span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://vid.ly/{ID}?content=video&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;vidjs&quot;</span> <span style="color: #000066;">language</span>=<span style="color: #ff0000;">&quot;javascript&quot;</span> </span>
<span style="color: #009900;"><span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://m.vid.ly/js/html5.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/video<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Instead of linking the different sources, vid.ly adds a JavaScript that re-writes the source accordingly. If you check <a href="http://m.vid.ly/js/html5.js">the script</a> you see that it includes the <a href="https://github.com/zencoder/video-js">VideoJS player by Zencoder</a> and that there is a lot of detection going on &#8211; both using the HTML5 Video API and browser sniffing for Quicktime support or to fall back to Flash.</p>
<p>This seems a bit overkill and could be improved. The other annoyance are IDs on the video and script as that prevents you from using several vid.ly videos in the same document. But then again, the power of open tech is that you can work around that:</p>
<p>The email is that it tells you that there is a high quality FLV file created for you at <code>http://vidly.s3.amazonaws.com/{ID}/flv.flv</code>. This means that your videos are stored in Amazon&#8217;s S3 with a bucket with the ID of your video. If you rename the <code>flv.flv</code> to <code>ogv.ogv</code>, <code>webm.webm</code> and <code>mp4/mp4</code> accordingly you use these URLs to create your own video embed without JavaScript or you can download the different versions.</p>
<h2>Try it out yourself</h2>
<p>You can try vid.ly yourself using the <strong>HNY2011</strong> code. What do you think?</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/01/simple-html5-video-encoding-with-vid-ly-interview-first-impressions-and-invite-code/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
<enclosure url="http://www.archive.org/download/InterviewWithJeffMalkinOfEncoding.comAboutVid.ly/InterviewWithJeffMalkinAboutVid.ly.mp3" length="0" type="audio/mpeg" />
<enclosure url="http://www.archive.org/download/InterviewWithJeffMalkinOfEncoding.comAboutVid.ly/InterviewWithJeffMalkinAboutVid.ly.ogg" length="0" type="audio/ogg" />
<enclosure url="http://www.archive.org/download/UsingVid.lyToConvertVideoOnTheWeb/screencast3_512kb.mp4" length="0" type="video/mp4" />
<enclosure url="http://videos.mozilla.org/serv/mozhacks/video-encoding.webm" length="5281837" type="video/webm" />
<enclosure url="http://www.archive.org/download/UsingVid.lyToConvertVideoOnTheWeb/screencast3.ogv" length="0" type="video/ogg" />
		</item>
		<item>
		<title>Zooming and rotating for video in HTML5 and CSS3</title>
		<link>http://hacks.mozilla.org/2011/01/zooming-and-rotating-for-video-in-html5-and-css3/</link>
		<comments>http://hacks.mozilla.org/2011/01/zooming-and-rotating-for-video-in-html5-and-css3/#comments</comments>
		<pubDate>Wed, 19 Jan 2011 09:52:38 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=7064</guid>
		<description><![CDATA[The source of the code examples in this post is available on GitHub and you can see the demo in action. There are dozens of video players that allow you to do all the normal things with videos: play, pause, jump to a certain time and so on. More advanced ones also allow you to [...]]]></description>
			<content:encoded><![CDATA[<p>The source of the code examples in this post <a href="http://github.com/codepo8/rotatezoomHTML5video">is available on GitHub</a> and you can <a href="http://isithackday.com/hacks/videozoomandrotate">see the demo in action</a>.</p>
<p>There are <a href="http://praegnanz.de/html5video/">dozens of video players</a> that allow you to do all the normal things with videos: play, pause, jump to a certain time and so on. More advanced ones also allow you to fast forward and reverse the video and support subtitles.</p>
<p>One thing I haven&#8217;t found yet though is zooming and rotation of a video. Granted, an edge use case, but sometimes it is cool to be able to zoom into a detail like a blooper (boom mic in the background) or an easter egg (check for the term &#8220;A 113&#8243; in every Pixar movie &#8211; an homage to the classroom most of the original Pixar cast learned their trade in).</p>
<p>Rotation might come in handy when you recorded your video in portrait instead of landscape on your camera and you don&#8217;t want to re-encode it before you put it on the web. </p>
<p>The HTML5 video tag allows you to style the video with CSS and CSS3 transforms allow both for scaling and for rotation. So let&#8217;s put those together.</p>
<p>Embedding a video is as simple as this (see this in action on <a href="http://isithackday.com/hacks/videozoomandrotate/rotate.html">the demo page</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;video</span> controls<span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://www.archive.org/download/AnimatedMechanicalArtPiecesAtMit/P1120973_512kb.mp4&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;video/mp4&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>         
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://www.archive.org/download/AnimatedMechanicalArtPiecesAtMit/P1120973.ogv&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;video/ogg&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Your browser doesn't support the HTML5 video tag it seems. 
     You can see this video as part of a collection <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://www.archive.org/download/AnimatedMechanicalArtPiecesAtMit/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>at archive.org<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>         
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/video<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Now, to scale this video you can use CSS3 <code>transform:scale</code>:</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2011/01/scale.png" width="498" height="694" alt="Scaling a video with CSS3 transformations"></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">video<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
video.scale2<span style="color: #00AA00;">&#123;</span>
  -moz-transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -webkit-transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -o-transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -ms-transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>You can rotate with CSS3 <code>transform:rotate</code>:</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2011/01/rotate.png" width="398" height="676" alt="Rotate a video with CSS3 transformations"></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">video<span style="color: #00AA00;">&#123;</span>
  -moz-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -webkit-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -o-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -ms-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>And you can do both:</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2011/01/scaledandrotated.png" width="493" height="690" alt="Rotate and scale a video with CSS3 transformations"></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">video<span style="color: #00AA00;">&#123;</span>
  -moz-transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -webkit-transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -o-transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -ms-transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  transform<span style="color: #00AA00;">:</span>scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Now, this doesn&#8217;t make much sense though as it changes the dimension of the video (in the demo page I needed to change the margin for each video accordingly). To really provide a &#8220;zoom&#8221; functionality, we&#8217;d need to keep the original size and cut off the parts we don&#8217;t need. We could do this using a CANVAS element, but why go that far when a simple DIV does the job for us?</p>
<p>All we need to do to keep the space is nest our videos in a DIV with the class <code>stage</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;stage&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;video</span> controls<span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://www.archive.org/download/AnimatedMechanicalArtPiecesAtMit/P1120973_512kb.mp4&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;video/mp4&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>         
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://www.archive.org/download/AnimatedMechanicalArtPiecesAtMit/P1120973.ogv&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;video/ogg&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>         
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Your browser doesn't support the HTML5 video tag it seems. 
     You can see this video as part of a collection <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://www.archive.org/download/AnimatedMechanicalArtPiecesAtMit/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>at archive.org<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>         
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/video<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>The CSS to make the cropping work is the following:</p>
<pre class="css">.stage{
  width:400px;
  height:300px;
  position:relative;
}
video{
  width:400px;
  height:300px;
  position:absolute;
  top:0;
  left:0;
}</pre>
<p>Absolutely positioned elements are taken out of the normal flow of the document. If you <a href="http://stopdesign.com/archive/2003/09/03/absolute.html">put an absolutely positioned element inside one that is relatively positioned</a>, its top and left values are relative to the other element. In other words: the video now covers the stage completely.</p>
<p>If we rotate the video we still have triangular spaces showing like in this example:</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2011/01/stage.png" width="490" height="426" alt="Positioning a video absolutely in a relative container"></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.demostage<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
.demovideo<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  -moz-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -webkit-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -o-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -ms-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>To work around this, we must add a <code>overflow:hidden</code> to the stage DIV:</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2011/01/stageoverflow.png" width="418" height="316" alt="Setting overflow:hidden on the stage hides the overlapping parts of the video"></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.demostage<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
.demovideo<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  -moz-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -webkit-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -o-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -ms-transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  transform<span style="color: #00AA00;">:</span>rotate<span style="color: #00AA00;">&#40;</span>20deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>In order to provide a zoom and rotate functionality, we need to use JavaScript and buttons for the end user. The first hurdle here is &#8211; as you probably already realised from the CSS &#8211; browser differences in the syntax. Therefore we need to detect which of the transformations the current browser supports. The safest way is to ask the browser:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> properties <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'transform'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'WebkitTransform'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'MozTransform'</span><span style="color: #339933;">,</span>
                  <span style="color: #3366CC;">'msTransform'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'OTransform'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> prop <span style="color: #339933;">=</span> properties<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>j<span style="color: #339933;">=</span>properties.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>j<span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> v.<span style="color: #660066;">style</span><span style="color: #009900;">&#91;</span>properties<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!==</span> <span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    prop <span style="color: #339933;">=</span> properties<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Once this runs we can set a transformation with the following JavaScript syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> zoom <span style="color: #339933;">=</span> <span style="color: #CC0000;">1.5</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> rotate <span style="color: #339933;">=</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">;</span>
v.<span style="color: #660066;">style</span><span style="color: #009900;">&#91;</span>prop<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'rotate('</span><span style="color: #339933;">+</span>rotate<span style="color: #339933;">+</span><span style="color: #3366CC;">'deg) scale('</span><span style="color: #339933;">+</span>zoom<span style="color: #339933;">+</span><span style="color: #3366CC;">')'</span><span style="color: #339933;">;</span></pre></div></div>

<p>Of course it doesn&#8217;t make much sense to rotate the controls with the video. Therefore you need to provide your own. You can use any of the aforementioned players for that or roll your own. To demonstrate, I just built one with a single button allowing you to play and pause the video:</p>
<p><video controls><source src="http://www.archive.org/download/RotatingAndZoomingHtml5VideoWithCss3/screencast2.mp4" type="video/mp4"><source src="http://www.archive.org/download/RotatingAndZoomingHtml5VideoWithCss3/screencast2.ogv" type="video/ogg">You can see this video<a href="http://www.archive.org/details/RotatingAndZoomingHtml5VideoWithCss3">at archive.org</a>.</video></p>
<p>The full <a href="https://github.com/codepo8/rotatezoomHTML5video/blob/master/transformvideo.js">source is available on GitHub</a>, read the comments to see what is going on here.</p>
<p><script src="https://gist.github.com/784635.js"> </script></p>
<p>Just a quick example of what you can do with open technologies.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/01/zooming-and-rotating-for-video-in-html5-and-css3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
<enclosure url="http://www.archive.org/download/AnimatedMechanicalArtPiecesAtMit/P1120973_512kb.mp4" length="0" type="video/mp4" />
<enclosure url="http://www.archive.org/download/AnimatedMechanicalArtPiecesAtMit/P1120973.ogv" length="0" type="video/ogg" />
<enclosure url="http://www.archive.org/download/RotatingAndZoomingHtml5VideoWithCss3/screencast2.mp4" length="0" type="video/mp4" />
<enclosure url="http://www.archive.org/download/RotatingAndZoomingHtml5VideoWithCss3/screencast2.ogv" length="0" type="video/ogg" />
		</item>
		<item>
		<title>Talking about HTML5 games development at MIT in Boston</title>
		<link>http://hacks.mozilla.org/2011/01/talking-about-html5-games-development-at-mit-in-boston/</link>
		<comments>http://hacks.mozilla.org/2011/01/talking-about-html5-games-development-at-mit-in-boston/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 12:40:02 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Challenge]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[competition]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[MIT]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=7060</guid>
		<description><![CDATA[As part of our university outreach programme, a few Mozilla people and volunteers went to Boston last week to give a series of lectures on web technologies for games development. During the week we covered topics like WebGL for 3D development, basics of JavaScript, debugging and performance, canvas development, offline development and local storage and [...]]]></description>
			<content:encoded><![CDATA[<p>As part of our university outreach programme, a few Mozilla people and volunteers went to Boston last week to give a series of lectures on web technologies for games development. </p>
<p>During the week we covered topics like WebGL for 3D development, basics of JavaScript, debugging and performance, canvas development, offline development and local storage and multimedia on the web. We&#8217;ll make these slides available in the comments to this blog post.</p>
<p>The <a href="http://www.slideshare.net/cheilmann/multimedia-on-the-web-html5-video-and-audio">slides of the multimedia talk</a> are available here: </p>
<p><iframe style="border:none;width:550px;height:458px;" src="http://icant.co.uk/slidesharehtml/embed.php?url=http://www.slideshare.net/cheilmann/multimedia-on-the-web-html5-video-and-audio&#038;width=500"></iframe></p>
<p>The topics covered were:</p>
<ul>
<li>Quick history of Multimedia on the web</li>
<li>Annoyances with Flash</li>
<li>HTML5 audio and video</li>
<li>Codecs and conversion</li>
<li>Embedding video and audio</li>
<li>Controlling video</li>
<li>Transforming video</li>
<li>Making realtime changes</li>
<li>Awesome new audio possibilities</li>
</ul>
<p>We showed and explained a few demos like:</p>
<ul>
<li>The <a href="http://www.w3.org/2010/05/video/mediaevents.html">Media events demo page at the W3C web site</a></li>
<li> The <a href="http://isithackday.com/spirit-of-indiana/">Spirit of Indiana demo</a> syncing a Google Maps animation with a video</li>
<li><a href="http://isithackday.com/mit/transforming-video.html">Transforming Video</a> to create a player that allows you to zoom inside a video and rotate it using CSS transformations</li>
<li><a href="http://people.mozilla.com/~prouget/demos/round/index.xhtml">Paul Rouget&#8217;s round video demo</a> showing how to create a play/pause button in SVG, greyscale a video and rotate it using CSS transformations</li>
<li><a href="http://people.mozilla.com/~prouget/demos/mashup/video.xhtml">Paul&#8217;s Video Mashup demo</a> showing how to apply SVG filters like Gaussian Blur, masking and how to apply CSS transforms to a running video</li>
<li><a href="http://introducinghtml5.com/examples/ch05/animate-with-video.html">Remy Sharp&#8217;s round video demo</a> showing how to create a rotating, bouncing circle that contains a video</li>
<li><a href="http://people.mozilla.com/~prouget/demos/green/green.xhtml">Paul Rouget&#8217;s Green demo</a> showing how to simulate a green screen effect with open web technologies.</li>
<li><a href="http://people.mozilla.com/~prouget/demos/DynamicContentInjection/play.xhtml">The dynamic content injection</a> demo showing how to embed content into a video after analysing it for injection hotspots.</li>
<li>The <a href="http://people.mozilla.com/~prouget/demos/tracker/tracker.xhtml">Tracker demo</a> showing how to detect human shapes and movement in a video</li>
<li>The <a href="http://nerget.com/edgeDetection/">edge detection</a> demo shows how to detect edges in a live video using JavaScript</li>
<li>The <a href="http://hacks.mozilla.org/2011/01/html5guitar/">HTML5 Guitar Tab generator</a></li>
<li>The <a href="http://audioscene.org/scene-files/humph/sfxr/">sfxr</a> sound effect library</li>
</ul>
<p>I also provided <a href="http://www.wait-till-i.com/2011/01/16/lecturing-at-mit-about-html5-video-slides-and-lots-of-notes/">extensive notes for the whole talk with code examples</a> on my own blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/01/talking-about-html5-games-development-at-mit-in-boston/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>People of HTML5 &#8211; Remy Sharp</title>
		<link>http://hacks.mozilla.org/2011/01/people-of-html5-remy-sharp/</link>
		<comments>http://hacks.mozilla.org/2011/01/people-of-html5-remy-sharp/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 10:27:25 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[IndexedDB]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Offline]]></category>
		<category><![CDATA[People of HTML5]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Web Developers]]></category>
		<category><![CDATA[chrisheilmann]]></category>
		<category><![CDATA[peopleofhtml5]]></category>
		<category><![CDATA[remysharp]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=7009</guid>
		<description><![CDATA[HTML5 needs spokespeople to work. There are a lot of people out there who took on this role, and here at Mozilla we thought it is a good idea to introduce some of them to you with a series of interviews and short videos. The format is simple &#8211; we send the experts 10 questions [...]]]></description>
			<content:encoded><![CDATA[<p>HTML5 needs spokespeople to work. There are a lot of people out there who took on this role, and here at Mozilla we thought it is a good idea to introduce some of them to you with a series of interviews and short videos. The format is simple &#8211; we send the experts 10 questions to answer and then do a quick video interview to let them introduce themselves and ask for more detail on some of their answers.</p>
<p><a href="http://www.html5today.it/news/people-of-html5-chris-heilmann-intervista-remy-sharp">Leggi la traduzione in italiano</a></p>
<p><a href="http://www.flickr.com/photos/remysharp/5176768276/" title="Remy Sharp by Remy Sharp, on Flickr"><img src="http://farm5.static.flickr.com/4125/5176768276_b1934d74a9_m.jpg" width="159" height="240" alt="Remy Sharp" style="float:left;margin:5px"></a>Today we are featuring <a href="http://remysharp.com">Remy Sharp</a> co-author of <a href="http://introducinghtml5.com/">Introducing HTML5</a> and organiser of the <a href="http://2010.full-frontal.org/">Full Frontal</a> conference in Brighton, England. </p>
<p>Remy is one of those ubiquitous people of HTML5. Whenever something needed fixing, there is probably something on GitHub that Remy wrote that helps you. He is also very English and doesn&#8217;t mince his words much.  </p>
<p>You can find Remy on Twitter as <a href="http://twitter.com/rem">@rem</a>. </p>
<h2 style="clear:both">The video interview</h2>
<p><video controls="true" height="295" width="480"><source src="http://www.archive.org/download/PeopleOfHtml5-RemySharp/remy_512kb.mp4" type="video/mp4"><source src="http://www.archive.org/download/PeopleOfHtml5-RemySharp/remy.webm" type="video/webm"><source src="http://www.archive.org/download/PeopleOfHtml5-RemySharp/remy.ogv" type="video/ogg">Your browser does not support the video tag, <a href="http://www.youtube.com/watch?v=fWwTv_AhFgw">check the video on YouTube</a>.</video></p>
<p><a href="http://www.youtube.com/watch?v=fWwTv_AhFgw">Watch the video on YouTube</a> or Download it from <a href="http://www.archive.org/details/PeopleOfHtml5-RemySharp">Archive.org</a> as <a href="http://www.archive.org/download/PeopleOfHtml5-RemySharp/remy_512kb.mp4">MP4 (98 MB)</a>, <a href="http://www.archive.org/download/PeopleOfHtml5-RemySharp/remy.ogv">OGG (70 MB)</a> or <a href="http://www.archive.org/download/PeopleOfHtml5-RemySharp/remy.webm">WebM (68MB)</a></p>
<h2>Ten questions about HTML5 for Remy Sharp</h2>
<h3>1) Reading &#8220;Introducing HTML5&#8243; it seems to me that you were more of the API &#8211; focused person and Bruce the markup guy. Is that a fair assumption? What is your background and passion?</h3>
<p>That&#8217;s spot on.  Bruce asked me to join the project as the &#8220;JavaScript guy&#8221; &#8211; which is the slogan I wear under my clothes and frequently reveal in a superman &#8216;spinning around&#8217; fashion (often at the surprise of clients).</p>
<p>My background has always been coding &#8211; even from a young age, my dad had me copying out listings from old spectrum magazines only to result in hours of typing and some random error that I could never debug.</p>
<p>As I got older I graduated to coding in C but those were the days the SDKs were 10Mb downloaded over a 14kb modem, and compile in to some really odd environment.  Suffice to say I didn&#8217;t get very far.</p>
<p>Then along came JavaScript.  A programming language that didn&#8217;t require any special development environment.  I could write the code in Notepad on my dodgy Window 95 box, and every machine came with the runtime: the browser.  Score!</p>
<p>From that point on the idea of instant gratification from the browser meant that I was converted &#8211; JavaScript was the way for me.</p>
<p>Since then I&#8217;ve worked on backend environments too (yep, I&#8217;m a Perl guy, sorry!), but always worked and played in the front end in some way or another.  However, since started on my own in 2006, it&#8217;s allowed me to move focus almost entirely on the front end, and specialise in JavaScript.  Basically, work-wise: I&#8217;m a pig in shit <strong>[Ed: for our non-native English readers, he means "happy")]</strong>.</p>
<h3>2) From a programmer&#8217;s point of view, what are the most exciting bits about the HTML5 standard? What would you say is something every aspiring developer should get their head around first?</h3>
<p>For me, the most exciting aspects of HTML5 is the depth of the JavaScript APIs.  It&#8217;s pretty tricky to explain to Joe Bloggs that actually this newly spec&#8217;ed version of HTML isn&#8217;t mostly HTML; it&#8217;s mostly JavaScript.  </p>
<p>I couldn&#8217;t put my finger on one single part of the spec, only because it&#8217;s like saying which is your favourite part of CSS (the :target selector &#8211; okay, so I can, but that&#8217;s not the point!).  What&#8217;s most exciting to me is that HTML5 is saying that the browser is the platform that we can deliver real applications &#8211; take this technology seriously.</p>
<p>If an aspiring developer wanted something quick and impressive, I&#8217;d say play around with the video API &#8211; by no means is this the best API, just an easy one. </p>
<p>If they really wanted to blow people away with something amazing using HTML5, I&#8217;d say learn JavaScript (I&#8217;m assuming they&#8217;re already happy with HTML and CSS). Get a book like JavaScript: The Good Parts and then get JavaScript Patterns and master the language. Maybe, just maybe, then go buy Introducing HTML5, it&#8217;s written by two /really/ good looking (naked) guys: <a href="http://flic.kr/p/8iyQTE">http://flic.kr/p/8iyQTE</a> and <a href="http://flic.kr/p/8iy6Z1">http://flic.kr/p/8iy6Z1</a> <strong>[Ed: maybe NSFW, definitely disturbing]</strong>.</p>
<h3>3) In your book you wrote a nice step-by-step video player for HTML5 video. What do you think works well with the Video APIs and what are still problems that need solving?</h3>
<p>The media API is dirt simple, so it means working with video and audio is a doddle. For me, most of it works really well (so long as you understand the loading process and the events). </p>
<p>Otherwise what&#8217;s really quite neat, is the fact I can capture the video frames and mess with them in a canvas element &#8211; there&#8217;s lots of fun that can be had there (see some of <a href="http://people.mozilla.com/~prouget/demos/">Paul Rouget&#8217;s demos</a> for that!).</p>
<p>What sucks, and sucks hard, is the spec asks vendors, ie. browser makers, *not* to implement full screen mode. It uses security concerns as the reason (which I can understand), but Flash solved this long ago &#8211; so why not follow their lead on this particular problem? If native video won&#8217;t go full screen, it will never be a competitive alternative to Flash for video. </p>
<p>That all said, I do like that the folks behind WebKit went and ignored the spec, and implemented full screen. The specs are just guidelines, and personally, I think browsers should be adding this feature. </p>
<h3>4) Let&#8217;s talk a bit about non-HTML5 standards, like Geolocation. I understand you did some work with that and found that some parts of the spec work well whilst others less so. Can you give us some insight?</h3>
<p>On top of HTML5 specification there&#8217;s a bunch more specs that make the browser really, really exciting. If we focus on the browser being released today (IE9 included) there&#8217;s a massive amount that can be done that we couldn&#8217;t do 10 years ago. </p>
<p>There&#8217;s the &#8220;non-HTML5&#8243; specs that actually were part of HTML5, but split out for good reason (so they can be better managed), like web storage, 2D canvas API and Web Sockets, but there&#8217;s also the /really/ &#8220;nothing-to-do-with-HTML5&#8243; APIs (NTDWH5API!) like querySelector, XHR2 and the Device APIs. I&#8217;m super keen to try all of these out even if they&#8217;re not fully there in all the browsers. </p>
<p>Geolocation is a great example of cherry picking technology. Playing against the idea that the technology isn&#8217;t fully implemented. Something I find myself ranting on and on about when it comes to the question of whether a developer should use HTML5.  Only 50% of Geolocation is implemented in the browsers supporting it, in that they don&#8217;t have altitude, heading or speed &#8211; all of which are part of the spec. Does that stop mainstream apps like Google Maps from using the API? (clue: no).</p>
<p>The guys writting the specs have done a pretty amazing job, and in particular there are few cases where the specs have been retrospectively written.  XHR is one of these and now we&#8217;ve got a stable API being added in new browsers (i.e. IE6 sucks, yes, we all know that).  Which leads us to drag and drop.  The black sheep of the APIs.  In theory a really powerful API that could make our applications rip, but the technical implementation is a shambles.  <a href="http://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html">PPK (Peter-Paul Koch) tore the spec a bit of a &#8216;new one&#8217;</a>.  It&#8217;s usable, but it&#8217;s confusing, and lacking.</p>
<p>Generally, I&#8217;ve found the &#8220;non-HTML5&#8243; specs to be a bit of mixed bag.  Some are well supported in new browsers, some not at all.  SVG is an oldie and now really viable with the help of JavaScript libraries such as <a href="http://raphaeljs.com">Raphaël.js</a> or <a href="http://code.google.com/p/svgweb/">SVGWeb</a> (a Flash based solution). All in all, there&#8217;s lots of options available in JavaScript API nowadays compared to back in the dark ages. </p>
<h3>5) Let&#8217;s talk Canvas vs. SVG for a bit. Isn&#8217;t Canvas just having another pixel-based rectangle in the page much like Java Applets used to be? SVG, on the other hand is Vector based and thus would be a more natural tool to do something with open standards that we do in Flash now. When would you pick SVG instead of Canvas and vice versa?</h3>
<p>Canvas, in a lot of ways is just like the Flash drawing APIs.  It&#8217;s not accessible and a total black box.  The thing is, in the West, there&#8217;s a lot of businesses, rightly or wrongly, that want their fancy animation thingy to work on iOS.  Since Flash doesn&#8217;t work there, canvas is a superb solution.</p>
<p>However, you must, MUST, decide which technology to use.  Don&#8217;t just use canvas because you saw a <a href="http://blog.nihilogic.dk/2008/05/javascript-super-mario-kart.html">Mario Kart demo</a> using it.  Look at the pros and cons of each.  SVG and the canvas API are not competitive technologies, they&#8217;re specially shaped hammers for specific jobs.</p>
<p>Brad Neuberg did a superb job of summarising the pros and cons of each, and I&#8217;m constantly referring people to it (here&#8217;s the <a href="http://www.youtube.com/watch?v=siOHh0uzcuY#t=17m00s">video</a>).</p>
<p>So it really boils down to:</p>
<ul>
<li>Canvas: pixel manipulation, non-interactive and high animation</li>
<li>SVG: interactive, vector based</li>
</ul>
<p>Choose wisely young padawan!</p>
<h3>6) What about performance? Aren&#8217;t large Canvas solutions very slow, especially on mobile devices? Isn&#8217;t that a problem for gaming? What can be done to work around that?</h3>
<p>Well&#8230;yes and no.  I&#8217;m finishing a project that has a large canvas animation going on, and it&#8217;s not slow on mobile devices (not that it was designed for those).  The reason it&#8217;s not slow is because of the way the canvas animates.  It doesn&#8217;t need to be constantly updating at 60fps.</p>
<p>Performance depends on your application.  Evaluate the environment, the technologies and make a good decision.  I personally don&#8217;t think using a canvas for a really high performance game on a mobile is quite ready.  I don&#8217;t think the devices have the ommph to get the job done &#8211; but there&#8217;s a hidden problem &#8211; the browser in the device isn&#8217;t quite up to it.  Hardware acceleration is going to help, a lot, but today, right now, I don&#8217;t think we&#8217;ll see games like Angry Birds written in JavaScript.  </p>
<p>That said&hellip; I&#8217;ve seriously considered how you could replicate a game like <a href="http://www.adamatomic.com/canabalt/">Canabalt</a> using a mix of canvas, DIVs and CSS.  I think it might be doable ::throws gauntlet::</p>
<p>I think our community could actually learn a lot from the Flash community.  They&#8217;ve been through all of this already.  Trying to make old versions of Flash from years back do things that were pushing the boundaries.  People like Seb Lee-Delisle (<a href="http://twitter.com/seb_ly">@seb_ly</a> / <a href="http://seb.ly">http://seb.ly</a>) are doing an amazing job of teaching both the Flash and JavaScript community.</p>
<h3>7) A feature that used to be HTML5 and is now an own spec is LocalStorage and its derivatives Session Storage or the full-fledged WebSQL and IndexedDB. Another thing is offline storage. There seems to be a huge discussion in developer circles about what to use when and if NoSQL solutions client side are the future or not. What are your thoughts? When can you use what and what are the drawbacks?</h3>
<p>Personally I love seeing server-less applications. Looking at the storage solutions I often find it difficult to see why you wouldn&#8217;t use WebStorage every time. </p>
<p>In a way it acts like (in my limited experience of) NoSQL, in that you lookup a key and get a result. </p>
<p>Equally, I think SQL in the browser is over the top. Like you&#8217;re trying to use the storage method *you* understand and forcing it into the browser. Seems like too much work for too little win.</p>
<p>Offline Apps, API-wise, ie. the application cache is /really/ sexy. Like sexy with chocolate on top sexy. The idea that our applications can run without the web, or switch when it detects it&#8217;s offline is really powerful. The only problem is that the events are screwed. The event to say your app is now offline requires the user to intervene via the browser menu, telling the browser to &#8220;work in offline mode&#8221;. A total failure of experience. What&#8217;s worse is that, as far as I know, there&#8217;s no plan to make offline event fire properly :-(</p>
<p>That all said, cookies are definitely dead for me. I&#8217;ve yet to find a real solution for cookies since I found the Web Storage API &#8211; and there&#8217;s a good decent number of polyfills for Web Storage &#8211; so there&#8217;s really no fear of using the API. </p>
<h3>8) Changing the track a bit, you&#8217;ve built the HTML5shiv to make HTML5elements styleable in IE. This idea sparked quite a lot of other solutions to make IE6 work with the new technologies (or actually simulate them). Where does this end? Do you think it is worth while to write much more code just to have full IE6 support?</h3>
<p>There&#8217;s two things here:</p>
<ol>
<li>Supporting IE6 (clue: don&#8217;t)</li>
<li>Polyfills</li>
</ol>
<p>IE6, seriously, and for the umpteenth time, look at your users.  Seriously.  I know the project manager is going to say they don&#8217;t know what the figures are, in that case: find out!  Then, once you&#8217;ve got the usage stats in hand, you know your audience and you know what technology they support.</p>
<p>If they&#8217;re mostly IE6 users, then adding native video with spinning and dancing canvas effect isn&#8217;t going to work &#8211; not even with shims and polyfills.  IE6 is an old dog that just isn&#8217;t up to doing the mileage he used to be able to do back in his prime.  But enough on this subject &#8211; the old &#8216;do I, or don&#8217;t I developer for IE6&#8242; is long in the tooth.</p>
<p>Polyfills &#8211; that&#8217;s a different matter.  They&#8217;re not there to support IE6, they&#8217;re there to bring browsers up to your expectations as a developer.  However, I&#8217;d ask that you carefully consider them before pulling them in.  The point of these scripts is they plug missing APIs in those older browsers.  &#8220;Old browsers&#8221; doesn&#8217;t particularly mean IE6.  For example, the Web Sockets API has a polyfill by way of Flash.  If native Web Sockets aren&#8217;t there, Flash fills the gap, but the API is exposed in exactly the same manner, meaning that you don&#8217;t have to fork your code.</p>
<p>I don&#8217;t think people should be pulling in scripts just for the hell of it.  You should consider what you&#8217;re trying to achieve and decide whether X technology is the right fit.  If it is, and you know (or expect) your users have browsers that don&#8217;t support X technology &#8211; should you plug it with JavaScript or perhaps should you consider a different technology?</p>
<p>This exact same argument rings true for when someone adds jQuery just to add or remove a class from an element.  It&#8217;s simply not worth it &#8211; but clearly that particular developer didn&#8217;t really understand what they needed to do.  So is education the solution?  I should hope so.</p>
<h3>9) Where would you send people if they want to learn about HTML5? What are tutorials that taught you a lot? Where should interested people hang out?</h3>
<p><a href="http://html5doctor.com">HTML5 Doctor</a> &#8211; fo sho&#8217;.  :)</p>
<p>I tend to also direct people to my <a href="http://html5demos.com">http://html5demos.com</a> simply to encourage viewing source, and hacking away.  </p>
<p>Regarding what tutorials taught me &#8211; if I&#8217;m totally honest, the place I&#8217;ve learnt the most from is actually HTML5Doctor.com. There&#8217;s some pretty good JavaScript / API tutorials coming from the chaps at <a href="http://bocoup.com">http://bocoup.com</a>.  Otherwise, I actually spend a lot of time just snooping through the specifications, looking for bits that I&#8217;ve not seen before and generally poking them with a stick.</p>
<h3>10) You have announced that you are concentrating on building a framework to make Websockets easy to work with. How is that getting on and what do you see Websockets being used for in the future? In other words, why the fascination?</h3>
<p>Concentrating is a strong word ;-) but it is true, I&#8217;ve started working on a product that abstracts Web Sockets to a service. Not the API alone, since it&#8217;s so damn simple, but the server setup: creating sessions, user control flow, waiting for users and more. </p>
<p>The service is called Förbind. Swedish for &#8220;connect&#8221;, ie. to connect your users.  It&#8217;s still early days, but I hope to release alpha access to <a href="http://forbind.net/">forbind.net</a> this month. </p>
<p>I used to work in finance web sites and real-time was the golden egg: to get that data as soon as it was published. So now that it&#8217;s available in a native form in the browser, I&#8217;m all over it!</p>
<p>What&#8217;s more, I love the idea of anonymous users. I created a bunch of demos where the user can contribute to something without ever really revealing themselves, and when the users come, you start to see how creative people are without really trying. Sure, you get a lot of cocks being drawn, but you also see some impressive ideas &#8211; my business 404 page for example allows people to leave a drawing, one of the most impressive is a Super Mario in all his glory. Anonymous users really interest me because as grey as things can seem sometimes, a stranger can easily inspire you.</p>
<p>Do you know anyone I should interview for &#8220;People of HTML5&#8243;? Tell me on Twitter: <a href="http://twitter.com/codepo8">@codepo8</a></p>
<p><script type="text/javascript" src="http://s3.www.universalsubtitles.org/js/mirosubs-widgetizer.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/01/people-of-html5-remy-sharp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
<enclosure url="http://www.archive.org/download/PeopleOfHtml5-RemySharp/remy_512kb.mp4" length="0" type="video/mp4" />
<enclosure url="http://www.archive.org/download/PeopleOfHtml5-RemySharp/remy.ogv" length="0" type="video/ogg" />
		</item>
		<item>
		<title>Spirit of Indiana (Jones) &#8211; syncing HTML5 Video with Maps</title>
		<link>http://hacks.mozilla.org/2010/12/spirit-of-indiana-jones-syncing-html5-video-with-maps/</link>
		<comments>http://hacks.mozilla.org/2010/12/spirit-of-indiana-jones-syncing-html5-video-with-maps/#comments</comments>
		<pubDate>Thu, 16 Dec 2010 14:24:16 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Firefox 3.5]]></category>
		<category><![CDATA[Firefox 3.6]]></category>
		<category><![CDATA[Firefox 4]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[googlemaps]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[indianajones]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=6815</guid>
		<description><![CDATA[I&#8217;ve always been a big fan of the travel/flight sequences in the Indiana Jones movies and judging by the amount of copy attempts on YouTube I am not alone in this. As I don&#8217;t own any video editing software I thought it should be possible to create the same effect with web technologies and Google [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been a big fan of the travel/flight sequences in the Indiana Jones movies and judging by the amount of <a href="http://www.youtube.com/results?search_query=indiana+jones+map+animation&#038;aq=f">copy attempts on YouTube</a> I am not alone in this.  As I don&#8217;t own any video editing software I thought it should be possible to create the same effect with web technologies and Google Maps and lo and behold it is:</p>
<p><iframe title="YouTube video player" class="youtube-player" type="text/html" width="480" height="390" src="http://www.youtube.com/embed/KNNzP6fyOyQ?rel=0" frameborder="0"></iframe></p>
<p><a href="http://isithackday.com/spirit-of-indiana/">See the demo online</a></p>
<p>You can <a href="https://github.com/codepo8/HTML5---map-and-video-syncing">download the animation demo</a> for yourself and try it out locally &#8211; all you need is a browser that supports HTML5 video. I know &#8211; the music is not quite the same as in the movies, but at least this one is not copyright infringing and it came from the heart (5 minutes in a meeting room in the Mozilla office). </p>
<p>So how was this done and what are problems that needed solving? Here&#8217;s how and what.</p>
<h2>Step 1: Find the movie and get it to the right format</h2>
<p>That was the easy part. <a href="http://www.archive.org/">Archive.org</a> has a lot of awesome public domain movies available for you and they are already in the formats needed to use in an HTML5 video element. In this case, I took the short <a href="http://www.archive.org/details/CharlesLindbergTakesOff">movie of Charles Lindbergh</a> taking off for <a href="http://en.wikipedia.org/wiki/Charles_Lindbergh">his record breaking flight from New York to fly to Paris in 1927</a>.</p>
<h2>Step 2: Displaying the video</h2>
<p>Using the video <a href="http://isithackday.com/spirit-of-indiana/video.html">is pretty simple</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;stage&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;video<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://www.archive.org/download/</span>
<span style="color: #009900;">CharlesLindbergTakesOff/CharlesLindbergTakesOff_512kb.mp4&quot;</span> </span>
<span style="color: #009900;"><span style="color: #000066;">type</span>=<span style="color: #ff0000;">'video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://www.archive.org/download/</span>
<span style="color: #009900;">CharlesLindbergTakesOff/CharlesLindbergTakesOff.ogv&quot;</span></span>
<span style="color: #009900;"> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'video/ogg; codecs=&quot;theora, vorbis&quot;'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> 
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/video<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>The MP4 format will be used by Webkit based browsers and the Ogg version by Firefox and others. As we want to control the video we omit the <code>controls</code> attribute on the <code>video</code> element &#8211; instead we create a button to play the video with JavaScript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'load'</span><span style="color: #339933;">,</span> 
  <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> stage <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'stage'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> v <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'video'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    but <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'button'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    but.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'Click to see Lindbergh<span style="color: #000099; font-weight: bold;">\'</span>s flight'</span><span style="color: #339933;">;</span>
    stage.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>but<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    but.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      v.<span style="color: #660066;">play</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
<span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As the video is markup we can do whatever we please with it &#8211; the power of open technologies. For example as we will do here we can set its opacity in CSS and put in on top of a map.</p>
<h2>Step 3: Create the map path animation</h2>
<p>Talking of which, let&#8217;s get that moving path done. Google Earth has an API to do that, but it needs a special plugin. Google Maps allows you to paint paths on maps (which actually are SVG, another open standard). Put that in a recursive function and you <a href="http://isithackday.com/spirit-of-indiana/map.html">get the desired effect</a>: </p>
<p><a href="http://isithackday.com/spirit-of-indiana/map.html" title="Animated Google Maps path synced with HTML5 video by codepo8, on Flickr"><img src="http://farm6.static.flickr.com/5169/5264317406_20886eefb9.jpg" width="500" height="444" alt="Animated Google Maps path synced with HTML5 video" /></a></p>
<p>In essence, what I did was take the latitude and longitude of the start and end points and calculate as many points in between the two as I need for the duration of the animation. I store the points in an array called <code>pos</code> and then paint a path from the start to the current point and move the map centre to this point on every iteration.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">spirit.<span style="color: #660066;">draw</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> path <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> google.<span style="color: #660066;">maps</span>.<span style="color: #660066;">Polyline</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        path<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>startpos<span style="color: #339933;">,</span>pos<span style="color: #009900;">&#91;</span>now<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        strokeColor<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;#c00&quot;</span><span style="color: #339933;">,</span>
        strokeOpacity<span style="color: #339933;">:</span> .7<span style="color: #339933;">,</span>
        strokeWeight<span style="color: #339933;">:</span> <span style="color: #CC0000;">10</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  path.<span style="color: #660066;">setMap</span><span style="color: #009900;">&#40;</span>map<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  map.<span style="color: #660066;">panTo</span><span style="color: #009900;">&#40;</span>pos<span style="color: #009900;">&#91;</span>now<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
  now <span style="color: #339933;">=</span> now <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>now <span style="color: #339933;">&lt;</span> animationend<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    setTimeout<span style="color: #009900;">&#40;</span>spirit.<span style="color: #660066;">draw</span><span style="color: #339933;">,</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Check the <a href="https://github.com/codepo8/HTML5---map-and-video-syncing/blob/master/map.js">highly commented source of the map example</a> for the details. Now, we could use this kind of animation and play the video over it &#8211; the problem though is that they may get out of sync. When the movie stalls (as it frequently does on this hotel wireless connection) we don&#8217;t want the animation to keep moving, right?</p>
<h2>Step 4: Syncing video and the map movement</h2>
<p>Instead of having two sources of timing information we have to limit ourselves to one source of truth. This is the time stamp of the currently playing movie. </p>
<p>By the way &#8211; you might have noticed that I wrapped the map code in a <code>tilesloaded</code> event handler. This is another safeguard for keeping things in sync. I found that on slow connections the tile loading can delay the whole interface immensely (because of all the subdomain lookups), so I make the whole interface dependent on the loading of the map and only proceed when the tiles have finished loading. As the <code>tilesloaded</code> event also fires when the map pans we need to use a boolean to stop it from starting the effect several times:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">google.<span style="color: #660066;">maps</span>.<span style="color: #660066;">event</span>.<span style="color: #660066;">addListener</span><span style="color: #009900;">&#40;</span>map<span style="color: #339933;">,</span><span style="color: #3366CC;">'tilesloaded'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>played <span style="color: #339933;">===</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// [...other code...]</span>
    played <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>You can read the current timestamp of a video with <code>video.currentTime</code> and whilst the movie is playing it constantly fires an event called <code>timeupdate</code>. As the event fires a lot we need to throttle it somehow. The trick here is to only take the full seconds and increase a counter when a new second is reached. You can see the timestamp and the second interval firing in <a href="http://isithackday.com/spirit-of-indiana/video-sync.html">the video syncing demo</a>:</p>
<p><a href="http://isithackday.com/spirit-of-indiana/video-sync.html" title="HTML5 video with timestamp by codepo8, on Flickr"><img src="http://farm6.static.flickr.com/5289/5264312358_59392bd2f9.jpg" width="500" height="491" alt="HTML5 video with timestamp" /></a></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> now <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
v.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'timeupdate'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  log.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> v.<span style="color: #660066;">currentTime</span><span style="color: #339933;">;</span> <span style="color: #009966; font-style: italic;">/* logging the real timestamp */</span>
  <span style="color: #003366; font-weight: bold;">var</span> full <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>v.<span style="color: #660066;">currentTime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>full <span style="color: #339933;">&gt;=</span> now<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    seqlog.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> now<span style="color: #339933;">;</span>  <span style="color: #009966; font-style: italic;">/* logging the seconds firing */</span>
    now <span style="color: #339933;">=</span> now <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That way the movie can lag in between and the sequence still stays in sync. Check the <a href="https://github.com/codepo8/HTML5---map-and-video-syncing/blob/master/video-sync.html">source of this demo on Github</a>.</p>
<h2>Putting it all together</h2>
<p>And that was about it &#8211; all I had to do is to set the movie&#8217;s opacity at a certain time stamp, start the sound at another and show and hide the copyright complaint at another. As we rely on the timestamp for the other effects we needed a boolean switch to avoid repeated firing:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">v.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'timeupdate'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  full <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>v.<span style="color: #660066;">currentTime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>full <span style="color: #339933;">===</span> now<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    mapelm.<span style="color: #660066;">style</span>.<span style="color: #660066;">opacity</span> <span style="color: #339933;">=</span> .8<span style="color: #339933;">;</span>
    v.<span style="color: #660066;">style</span>.<span style="color: #660066;">opacity</span> <span style="color: #339933;">=</span> .4<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>full <span style="color: #339933;">===</span> animationstart<span style="color: #339933;">+</span><span style="color: #CC0000;">1</span> <span style="color: #339933;">&amp;&amp;</span> audioplay <span style="color: #339933;">===</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    a.<span style="color: #660066;">play</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    audioplay <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>full <span style="color: #339933;">===</span> animationstart<span style="color: #339933;">+</span><span style="color: #CC0000;">2</span> <span style="color: #339933;">&amp;&amp;</span> hidden <span style="color: #339933;">===</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    drmbedamned.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'block'</span><span style="color: #339933;">;</span>
    hidden <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>full <span style="color: #339933;">===</span> animationstart<span style="color: #339933;">+</span><span style="color: #CC0000;">3</span> <span style="color: #339933;">&amp;&amp;</span> hidden <span style="color: #339933;">===</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    drmbedamned.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'none'</span><span style="color: #339933;">;</span>
    hidden <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>full <span style="color: #339933;">&gt;=</span> now<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    path <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> google.<span style="color: #660066;">maps</span>.<span style="color: #660066;">Polyline</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        path<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>startpos<span style="color: #339933;">,</span>pos<span style="color: #009900;">&#91;</span>full<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        strokeColor<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;#c00&quot;</span><span style="color: #339933;">,</span>
        strokeOpacity<span style="color: #339933;">:</span> .7<span style="color: #339933;">,</span>
        strokeWeight<span style="color: #339933;">:</span> <span style="color: #CC0000;">10</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    path.<span style="color: #660066;">setMap</span><span style="color: #009900;">&#40;</span>map<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    map.<span style="color: #660066;">panTo</span><span style="color: #009900;">&#40;</span>pos<span style="color: #009900;">&#91;</span>full<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
    now <span style="color: #339933;">=</span> now <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Another event we needed to subscribe to was the movie ending so we can stop the music and start to roll the credits:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">v.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ended'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  a.<span style="color: #660066;">pause</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  spirit.<span style="color: #660066;">credslist</span>.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'block'</span><span style="color: #339933;">;</span>
  spirit.<span style="color: #660066;">creds</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>As the theme is too short for the whole animation we need to loop it. This can be done by testing for the <code>ended</code> event and rolling back the time to 0:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">a.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ended'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  a.<span style="color: #660066;">currentTime</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Summary</h2>
<p>And there you have it &#8211; Indiana Jones style maps using open services and open technologies. A workaround for the copyrighted audio (recorded, edited and converted with the free <a href="http://audacity.sourceforge.net/">Audacity</a> sound editor) and using <a href="http://code.google.com/webfonts/">Google&#8217;s Web Fonts</a> as graphics. </p>
<p>You can now take this and change it for even more awesome:</p>
<ul>
<li>Replace Google Maps with Openstreetmap to avoid going over the limit</li>
<li>Add a slight curve to the path from NYC to Paris to make it more accurate (but then again the time is not accurate either &#8211; it took charles a tad longer)</li>
<li>Use a static map and paint the path with Canvas to speed up and smoothen the animation</li>
</ul>
<p>Why not have a go &#8211; it is free and fun to play.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/12/spirit-of-indiana-jones-syncing-html5-video-with-maps/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>HTML5 Video preload attribute supported in Firefox 4, autobuffer attribute removed</title>
		<link>http://hacks.mozilla.org/2010/08/video_preload_attribute/</link>
		<comments>http://hacks.mozilla.org/2010/08/video_preload_attribute/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 14:22:49 +0000</pubDate>
		<dc:creator>Paul Rouget</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Firefox 4]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=5673</guid>
		<description><![CDATA[This is a re-post from Chris Pearce’s blog. To comply with the HTML5 specification, we replaced the autobuffer attribute with the tri-state preload attribute. We encourage you to update your code. See the documention on MDC. Late last week I landed support on Firefox trunk for the HTML5 video &#8216;preload&#8217; attribute. This replaces the &#8216;autobuffer&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is a re-post from <a href="http://blog.pearce.org.nz/2010/08/html4-video-preload-attribute-supported.html">Chris Pearce’s blog</a>. To comply with the HTML5 specification, we replaced the <code>autobuffer</code> attribute with the tri-state <code>preload</code> attribute. We encourage you to update your code. See the <a href="https://developer.mozilla.org/En/HTML/Element/Video#Attributes">documention on MDC</a>.</em></p>
<p>Late last week I landed support on Firefox trunk for the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#attr-media-preload">HTML5 video &#8216;preload&#8217; attribute</a>. This replaces the &#8216;autobuffer&#8217; attribute, which we previously supported. If you were previously using the autobuffer attribute on your HTLM5 videos, you need to update to using the preload attribute as well.</p>
<p>The preload attribute provides a hint to the browser as to how much downloading is sensible for a given media. The preload attribute can have three values:</p>
<ol>
<li>&#8220;<b>none</b>&#8221; &#8211; suggests to the browser that it doesn&#8217;t need to load this media at all until the user plays the resource. The browser will delay any network traffic required to load the media until the users tries to play the resource, or explicitly loads the resource. I suggest using this preload value, along with the poster attribute, when it&#8217;s unlikely that the user will play the resource. This is probably most useful in a mobile environment, where data can be expensive.</li>
<li>&#8220;<b>metadata</b>&#8221; &#8211; suggests to the browser that it isn&#8217;t necessary to load the entire resource in advance. The browser will suspend the load after loading metadata, displaying the first video frame (if there&#8217;s no poster image), and ensuring it can play the media. This is the default behaviour, and prevents excess network traffic when the web developer isn&#8217;t certain the video will definitely be played. If you don&#8217;t specify a preload value, Firefox will automatically do this. This was also the default behaviour in Firefox 3.5 and 3.6 in the absence of the autobuffer attribute. This default behaviour is a suitable compromise between bandwidth saving and user convenience.</li>
<li>&#8220;<b>auto</b>&#8221; &#8211; suggests to the browser that it should load as much of the resource as possible. As long as the browser&#8217;s own media cache isn&#8217;t full, it will keep on downloading. I suggest this is most useful in the &#8220;YouTube&#8221; case, when you&#8217;ve got a media which the user is almost certainly going to watch, and so having the user download the media is not likely to be wasting server bandwidth. This behaviour is the same as using the autobuffer attribute in Firefox 3.5 and 3.6</li>
</ol>
<p>Since the autobuffer attribute is no longer present in Firefox 4, and the preload attribute is not present in Firefox 3.5 and 3.6, <b>if you want a media to download completely, you should include both preload=&#8221;auto&#8221; and autobuffer in the video element</b>, <i>e.g.</i>:</p>
<p><span style="font-family: &quot;Courier New&quot;,Courier,monospace;">&lt;video autobuffer preload=&#8221;auto&#8221; src=&#8221;video.ogg&#8221;&gt;&lt;/video&gt;</span></p>
<p><b>If you want the video to only be downloaded if the user actually plays the video, you should not include either the preload or the autobuffer attribute.</b> The default behaviour in Firefox 3.5, 3.6, and the upcoming Firefox 4 is to only load up to the first frame and then suspend the download.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/08/video_preload_attribute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 video &#8216;buffered&#8217; property available in Firefox 4</title>
		<link>http://hacks.mozilla.org/2010/08/html5-video-buffered-property-available-in-firefox-4/</link>
		<comments>http://hacks.mozilla.org/2010/08/html5-video-buffered-property-available-in-firefox-4/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 22:00:08 +0000</pubDate>
		<dc:creator>cpearce</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Firefox 4]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=5634</guid>
		<description><![CDATA[Support for the HTML5 video 'buffered' property has landed in Firefox, we can now accurately determine which time-segments of a video we can play and seek into without needing to pause playback to download more data. ]]></description>
			<content:encoded><![CDATA[<p><em>This is a repost from <a title="Chris Pearce's blog" href="http://blog.pearce.org.nz/2010/08/buffered-attribute-landed-for-html5.html">Chris Pearce&#8217;s blog</a>.</em></p>
<p>Recently I landed support for the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-buffered">HTML5 video &#8216;</a><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-buffered">buffered&#8217; </a><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-buffered">property</a> in Firefox. This is cool because we can now accurately determine which time-segments of a video we can play and seek into without needing to pause playback to download more data. Previously you could only get the byte position the download had reached, which often doesn&#8217;t map to the time ranges which are playable very well, especially in a variable bit rate video. This also can&#8217;t tell you if there are chunks which we skipped downloading before the downloaded byte position. Once the video controls UI is updated, users will be able to know exactly which segments of their video are downloaded and playable and can be seeked into without pausing playback to download more data.</p>
<p>To see this in action, download a current <a href="http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-central/">Firefox nightly build </a>, and point your browser at my <a href="http://people.mozilla.com/%7Ecpearce/buffered-demo.html">video &#8216;buffered&#8217; property demo</a>. You&#8217;ll see something like the screenshot below, including an extra progress bar (implemented using canvas) showing the time ranges which are buffered.</p>
<div class="separator" style="clear: both; text-align: center;"><a style="margin-left: 1em; margin-right: 1em;" href="http://2.bp.blogspot.com/_lMYNOr9XEaA/TFtWCewX9TI/AAAAAAAAABk/XdPjAkSqGE8/s1600/buffered-demo.jpg"><img src="http://2.bp.blogspot.com/_lMYNOr9XEaA/TFtWCewX9TI/AAAAAAAAABk/XdPjAkSqGE8/s320/buffered-demo.jpg" border="0" alt="" /></a></div>
<p>I&#8217;ve implemented the &#8216;buffered&#8217; property for the Ogg and WAV backends. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=570904">Support for the &#8216;buffered&#8217; property for WebM</a> is being worked on by <a href="http://blog.mjg.im/">Matthew Gregan</a>, and is well underway. At the moment we return empty ranges for the &#8216;buffered&#8217; property on video elements playing WebM and raw video.</p>
<p>My checkin just missed the cutoff for Firefox 4 Beta 3, so the first beta release that the video &#8216;buffered&#8217; property will appear in is Firefox 4 Beta 4.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/08/html5-video-buffered-property-available-in-firefox-4/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Fun With Fast JavaScript</title>
		<link>http://hacks.mozilla.org/2010/08/fun-with-fast-javascript/</link>
		<comments>http://hacks.mozilla.org/2010/08/fun-with-fast-javascript/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 19:07:47 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Demo]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JägerMonkey]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[TraceMonkey]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=5509</guid>
		<description><![CDATA[This post is by Vladimir Vukićević and is a re-post from his personal weblog. Fast JavaScript is a cornerstone of the modern web. In the past, application authors had to wait for browser developers to implement any complex functionality in the browser itself, so that they could access it from script code. Today, many of [...]]]></description>
			<content:encoded><![CDATA[<p><em>This post is by Vladimir Vukićević and is a <a href="http://blog.vlad1.com/2010/07/30/fun-with-fast-javascript/">re-post from his personal weblog.</a></em></p>
<p>Fast JavaScript is a cornerstone of the modern web.  In the past, application authors had to wait for browser developers to implement any complex functionality in the browser itself, so that they could access it from script code.  Today, many of those functions can move straight into JavaScript itself.  This has many advantages for application authors: there&#8217;s no need to wait for a new version of a browser before you can develop or ship your app, you can tailor the functionality to exactly what you need, and you can improve it directly (make it faster, higher quality, more precise, etc.).</p>
<p><a href="http://blog.vlad1.com/wp-content/uploads/2010/07/2010-06-24_1353.png" ><img class="alignleft size-full wp-image-316" title="JavaScript Darkroom" src="http://blog.vlad1.com/wp-content/uploads/2010/07/2010-06-24_1353.png" alt="" width="300" height="238" /></a>Here are two examples that show off what can be done with the improved JS engine and capabilities that will be present in Firefox 4.  The first example shows <a href="http://people.mozilla.com/~vladimir/demos/darkroom/darkroom.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/people.mozilla.com');">a simple web-based Darkroom</a><a></a> that allows you to perform color correction on an image.  The HTML+JS is around 700 lines of code, not counting jQuery.  This is based on a demo that&#8217;s included with Google&#8217;s Native Client (NaCl) SDK; in that demo, the color correction work is done inside native code going through NaCl.  That demo (originally presented as &#8220;too slow to run in JavaScript&#8221;) is a few thousand lines of code, and involves downloading and installing platform-specific compilers, multiple steps to test/deploy code, and installing a plugin on the browser side.</p>
<p>I get about 15-16 frames per second with the default zoomed out image (around 5 million pixels per second &#8212; that number won&#8217;t be affected by image size) on my MacBook Pro, which is definitely fast enough for live manipulation.  The algorithm could be tightened up to make this faster still.  Further optimizations to the JS engine could help here as well; for example, I noticed that we spend a lot of time doing floating point to integer conversions for writing the computed pixels back to the display canvas, due to how the canvas API specifies image data handling.</p>
<p>The Web Darkroom tool also supports drag &amp; drop, so you can take any image from your computer and drop it onto the canvas to load it.  A long (long!) time ago, back in 2006, I wrote <a href="http://people.mozilla.com/~vladimir/corppr/" onclick="javascript:pageTracker._trackPageview('/outbound/article/people.mozilla.com');">an addon called &#8220;Croppr!&#8221;</a>.  It was intended to be used with Flickr, allowing users to play around with custom crops of any image, and then leave crop suggestions in comments to be viewed using Croppr.  It almost certainly doesn&#8217;t work any more, but it would be neat to update it: this time with both cropping and color correction.  Someone with the addon (perhaps a <a href="https://jetpack.mozillalabs.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/jetpack.mozillalabs.com');">Jetpack</a> now!) could then visit a Flickr photo and experiment, and leave suggestions for the photographer.</p>
<p><a href="http://blog.vlad1.com/wp-content/uploads/2010/07/2010-06-24_1352.png" ><img class="alignright size-full wp-image-318" title="JavaScript Video FFT" src="http://blog.vlad1.com/wp-content/uploads/2010/07/2010-06-24_1352.png" alt="" width="350" height="425" /></a>The <a href="http://people.mozilla.com/~vladimir/demos/jsfft/jsfft.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/people.mozilla.com');">second example</a> is based on some work that Dave Humphrey and others have been doing to bring audio manipulation to the web platform.  Originally, their spec included a pre-computed FFT with each audio frame delivered to the web app.  I suggested that there&#8217;s no need for this &#8212; while a FFT is useful for some applications, for others it would be wasted work.  Those apps that want a FFT could implement one in JS.  Some benchmark numbers backed this up &#8212; using the <a href="https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/TypedArray-spec.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/cvs.khronos.org');">typed arrays</a> originally created for <a href="http://webgl.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/webgl.org');">WebGL</a>, computing an FFT in JS was approaching the speed of native code.  Again, both could be sped up (perhaps using SSE2 or something like Mono.Simd on the JS side), but it&#8217;s fast enough to be useful already.</p>
<p>The demo shows this in action.  A numeric benchmark isn&#8217;t really all that interesting, so instead I take a video clip, and as it&#8217;s playing, I extract a portion of the green channel of each frame and compute its 2D FFT, which is then displayed.  The original clip plays at 24 frames per second, so that&#8217;s the upper bound of this demo.  Using Float32 typed arrays, the computation and playback proceeds at around 22-24fps for me.</p>
<p>You can grab the video controls and scrub to a specific frame.  (The frame rate calculation is only correct while the video is playing normally, not while you&#8217;re scrubbing.)  The video source uses Theora, so you&#8217;ll need a browser that can play Theora content.  (I didn&#8217;t have a similar clip that uses WebM, or I could have used that.)</p>
<p>These examples are demonstrating the strength of the trace-based JIT technique that Firefox has used for accelerating JavaScript since Firefox 3.5.  However, not all code can see such dramatic speedups from that type of acceleration.  Because of that, we&#8217;ll be including a full method-based JIT for Firefox 4 (for more details, see <a href="http://www.bailopan.net/blog/?p=683" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.bailopan.net');">David Anderson&#8217;s blog</a>, as well as <a href="http://blog.mozilla.com/dmandelin/2010/05/10/jm-halfway/" onclick="javascript:pageTracker._trackPageview('/outbound/article/blog.mozilla.com');">David Mandelin&#8217;s blog</a>).  This will provide significantly faster baseline JS performance, with the trace JIT becoming a turbocharger for code that it would naturally apply to.</p>
<p>Combining fast JavaScript performance alongside new web platform technologies such as WebGL and Audio will make for some pretty exciting web apps, and I&#8217;m looking forward to seeing what developers do with them!</p>
<p><i>Edit: Made some last-minute changes to the demos, which ended up pulling in a slightly broken version of jQuery UI that wasn&#8217;t all that happy with Safari.  Should be fixed now!</i></p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/08/fun-with-fast-javascript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Firefox, YouTube and WebM</title>
		<link>http://hacks.mozilla.org/2010/05/firefox-youtube-and-webm/</link>
		<comments>http://hacks.mozilla.org/2010/05/firefox-youtube-and-webm/#comments</comments>
		<pubDate>Wed, 19 May 2010 16:24:23 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Firefox 4]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=4817</guid>
		<description><![CDATA[Five important items of note today relating to Mozilla&#8217;s support for the VP8 codec: 1. Google will be releasing VP8 under an open source and royalty-free basis. VP8 is a high-quality video codec that Google acquired when they purchased the company On2. The VP8 codec represents a vast improvement in quality-per-bit over Theora and is [...]]]></description>
			<content:encoded><![CDATA[<p>Five important items of note today relating to <a href="http://blog.mozilla.com/blog/2010/05/19/open-web-open-video-and-webm/">Mozilla&#8217;s support for the VP8 codec</a>:</p>
<p>1. <strong>Google will be releasing VP8 under an open source and royalty-free basis.</strong>  VP8 is a high-quality video codec that Google acquired when they purchased the company <a href="http://www.on2.com">On2</a>.  The VP8 codec represents a vast improvement in quality-per-bit over Theora and is comparable in quality to H.264.</p>
<p>2. <strong>The VP8 codec will be combined with the Vorbis audio codec and a subset of the Matroska container format to build a new standard for Open Video on the web called WebM.</strong>  You can find out more about the project at its new site: <a href="http://www.webmproject.org/">http://www.webmproject.org/</a>.</p>
<p>3. <strong>We will include support for WebM in Firefox.</strong>  You can get super-early <a href="http://nightly.mozilla.org/webm">WebM</a> builds of Firefox 4 pre-alpha today.  WebM will also be included in Google Chrome and Opera.</p>
<p>4. <strong>Every video on YouTube will be transcoded into WebM.</strong>  They have about 1.2 million videos available today and will be working through their back catalog over time.  But they have committed to supporting everything.</p>
<p>5. <strong>This is something that is supported by many partners, not just Google and others.</strong>  Content providers like Brightcove have signed up to support WebM as part of a full HTML5 video solution.  Hardware companies, encoding providers and other parts of the video stack are all part of the list of companies backing WebM.  Even Adobe will be supporting WebM in Flash.  Firefox, with its market share and principled leadership and YouTube, with its video reach are the most important partners in this solution, but we are only a small part of the larger ecosystem of video.</p>
<p>We&#8217;re extremely excited to see Google joining us to support Open Video.  They are making technology available on terms consistent with the Open Web and the W3C Royalty-Free licensing terms.  And &#8211; most importantly &#8211; they are committing to support a full open video stack on the world&#8217;s largest video site.  This changes the landscape for video and moves the baseline for what other sites have to do to maintain parity and keep up with upcoming advances in video technology, not to mention compatibility with the set of browsers that are growing their userbase and advancing technology on the web.</p>
<p>At Mozilla, we&#8217;ve wanted video on the web to move as fast as the rest of the web.  That has required a baseline of open technology to build on.  Theora was a good start, but VP8 is better.  Expect us to start pushing on video innovation with vigor.  We&#8217;ll innovate like the web has, moving from the edges in, with dozens of small revolutions that add up to something larger than the sum of those parts.  VP8 is one of those pieces, <a href="http://caniuse.com/#agents=All&#038;eras=All&#038;cats=HTML5&#038;statuses=rec,pr,cr,wd,ietf">HTML5 </a>is another.  If you watch this weblog, you can start to see those <a href="http://hacks.mozilla.org/2010/04/beyond-html5-experiments-with-interactive-audio/">other pieces starting to emerge as well</a>.  The web is creeping into more and more technologies, with Firefox leading the way.  We intend to keep leading the web beyond HTML5 to the next place it needs to be.</p>
<p>Today is a day of great change.  Tomorrow will be another.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/05/firefox-youtube-and-webm/feed/</wfw:commentRss>
		<slash:comments>96</slash:comments>
		</item>
		<item>
		<title>Beyond HTML5: experiments with interactive audio</title>
		<link>http://hacks.mozilla.org/2010/04/beyond-html5-experiments-with-interactive-audio/</link>
		<comments>http://hacks.mozilla.org/2010/04/beyond-html5-experiments-with-interactive-audio/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 18:57:33 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Device APIs]]></category>
		<category><![CDATA[Featured Demo]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Multi-touch]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[WebGL]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=4659</guid>
		<description><![CDATA[This is a re-post of an important post from David Humphrey who has been doing a lot of experiments on top of Mozilla&#8217;s extensible platform and doing experiments with multi-touch, sound, video, WebGL and all sorts of other goodies. It&#8217;s worth going through all of the demos below. You&#8217;ll find some stuff that will amaze [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is a <a href="http://vocamus.net/dave/?p=1074">re-post of an important post from David Humphrey</a> who has been doing a lot of experiments on top of Mozilla&#8217;s extensible platform and doing experiments with multi-touch, sound, video, WebGL and all sorts of other goodies.  It&#8217;s worth going through all of the demos below.  You&#8217;ll find some stuff that will amaze and inspire you.</em></p>
<p><em>David&#8217;s work is important because it&#8217;s showing where the web is going, and where Mozilla is helping to take it.  It&#8217;s not enough that we&#8217;re working on HTML5, which we&#8217;re about finished with, but we&#8217;re trying to figure out what&#8217;s next.  Mozilla&#8217;s platform, Gecko, is a huge part of why we&#8217;re able to experiment and learn as fast as we can.  And that&#8217;s reflected with what&#8217;s possible here.  It&#8217;s a web you can see, touch and interact with in new ways.</em></p>
<p><em>David&#8217;s post follows:</em></p>
<p>I’m working with an ever growing group of web, audio, and Mozilla  developers on <a href="http://vocamus.net/dave/?p=974">a project</a> to expose audio  spectrum data to JavaScript from Firefox’s audio and video elements.  Today we show what we did at www2010.</p>
<p>I&#8217;m in Raleigh, North Carolina, with <a href="https://twitter.com/F1LT3R/">Al MacDonald</a> for the <a href="http://www2010.org/www/">www2010</a> conference.  We&#8217;re here to present our work on exposing audio data in the browser.  Over the past month <a href="https://twitter.com/corban">Corban</a>, <a href="https://twitter.com/ccliffe">Charles</a>, and a bunch of other friends have been working with us to refine the API and get new types of demos ready.  We ended-up with 11 demos, some of which I&#8217;ve shown here before.  Here are the others.</p>
<p>The first was done by <a href="http://twitter.com/jseidelin">Jacob Seidelin</a>, and shows many cool 2D visualizations of audio using our API.  You can see the <a href="http://blog.nihilogic.dk/2010/04/html5-audio-visualizations.html">live version</a> on his site, or check out <a href="http://vimeo.com/11355121">this video</a>:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11355121&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11355121&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The second and third demos where done by <a href="https://twitter.com/ccliffe">Charles Cliffe</a>, and show 3D visualizations using WebGL and his <a href="http://www.cubicvr.org/">CubicVR engine</a>.  These also show off his JavaScript beat detection code.  Is JavaScript fast enough to do real-time analysis of audio and synchronized 3D graphics?  Yes, yes it is.  The live versions are <a href="http://cubicvr.org/CubicVR.js/BeatDetektor2HD.html">here</a> and <a href="http://cubicvr.org/CubicVR.js/BeatDetektor1HD.html">here</a>, and here are <a href="http://vimeo.com/11345262">some</a> <a href="http://vimeo.com/11345685">videos</a>:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11345262&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11345262&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11345685&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11345685&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The fourth demo was done by <a href="https://twitter.com/corban">Corban Brook</a> and shows how audio data can be mixed live using script.  Here he mutes the main audio, plays it, passes the data through a low pass filter written in JavaScript, then dumps the modified frames into a second audio element to be played.  It&#8217;s a technique we need to apply more widely, as it holds a lot of potential.  Here&#8217;s the <a href="http://weare.buildingsky.net/processing/dsp.js/examples/filter.html">live version</a>, and here&#8217;s a <a href="http://vimeo.com/11335434">video</a> (check out his updated <a href="http://weare.buildingsky.net/processing/dsp.js/examples/synthesizer.html">JavaScript synthesizer</a>, which we also presented):</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11335434&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11335434&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The fifth and sixth demos were done by Al (with the help of many).  When I was last in Boston, for the Processing.js meetup at Bocoup, we met with <a href="http://twitter.com/shepazu">Doug Schepers</a> from the W3C.  He loved our stuff, and was talking to us about ideas that would be cool to build.  He pulled out his iPhone and showed us <a href="http://vimeo.com/2184392">Brian Eno&#8217;s Bloom</a> audio app.  &#8220;It would be cool to do this in the browser.&#8221;  Yeah, it is cool, and here it is, written in a <a href="http://code.bocoup.com/bloop/color/bloop.html">few hundred lines of JavaScript and Processing.js</a> (<a href="http://vimeo.com/11346141">video 1</a>, <a href="http://vimeo.com/11345133">video 2</a>):</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11346141&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11346141&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11345133&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=11345133&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>This demo also showcases the awesome work of <a href="http://felipe.wordpress.com/">Felipe Gomes</a>, who has a patch to add <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=508906">multi-touch DOM events to Firefox</a>.  The method we&#8217;ve used here can be taken a lot further.  Imagine being able to connect multiple browsers together for collaborative music creation, layering other audio underneath, mixing fragments vs. just oscillators, etc.  We built this one in a week, and the web is capable of a lot more.</p>
<p>One of the main points of our talk was to emphasize that what we&#8217;re talking about here isn&#8217;t just a concept, and it isn&#8217;t some far away future.  This is real code, running in a real browser, and it&#8217;s all being done in HTML5 and JavaScript.  The web is fast enough to do real-time audio processing now, powerful enough and expressive enough to create music.  And the community of digital music and audio hackers, visualizers, etc. are hungry for it.  So hungry that they are seeking us out, downloading our hacked builds and creating gorgeous web audio applications.</p>
<p>We want to keep going, and we need help.  We need help from those within Mozilla, the W3C, and other browsers to get this stuff into shipping browsers.  We need the audio, digital music, accessibility, and web communities to come together in order to help us build js audio libraries and more sample applications.  Yesterday <a href="http://twitter.com/joehewitt/status/13090747143">Joe Hewitt was talking on twitter</a> about how web browser vendors need to experiment more with non-standard APIs.  I couldn&#8217;t agree more, and here&#8217;s a chance for people to put their money where their mouth is.  Let&#8217;s make audio a scriptable part of the open web.</p>
<p>I&#8217;m currently creating new builds of our updated patch for Firefox, and will post links to them here when I&#8217;m done.  You can read more about the technical details of our work <a href="https://wiki.mozilla.org/Audio_Data_API">here</a>, and get involved in the bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=490705">here</a>.  You can talk more with me on irc in the <a href="irc://irc.mozilla.org/processing.js">processing.js channel</a> (I&#8217;m <em>humph</em> on moznet), or talk to me on twitter (<a href="http://twitter.com/humphd">@humphd</a>) or by <a href="mailto:david.humphrey@senecac.on.ca">email</a>.  One way or another, get in touch so you can help us push this forward.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/04/beyond-html5-experiments-with-interactive-audio/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Theora on N900</title>
		<link>http://hacks.mozilla.org/2010/04/theora-on-n900/</link>
		<comments>http://hacks.mozilla.org/2010/04/theora-on-n900/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 17:00:41 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=4383</guid>
		<description><![CDATA[This is a re-post from Matthew Gregan&#8217;s personal weblog on the work that he&#8217;s been doing to bring HTML5 open video to mobile devices. Google recently announced funding for some work to bring Theora to ARM devices via a CPU-driven code path. Mozilla has been funding similar work over the last year or so to [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is a re-post from <a href="http://blog.mjg.im/2010/04/16/theora-on-n900.html">Matthew Gregan&#8217;s personal weblog</a> on the work that he&#8217;s been doing to bring HTML5 open video to mobile devices.  Google <a href="http://google-opensource.blogspot.com/2010/04/interesting-times-for-video-on-web.html">recently announced</a> funding for some work to bring Theora to ARM devices via a CPU-driven code path.  Mozilla has been funding <a href="http://www.schleef.org/blog/2009/11/11/theora-on-ti-c64x-dsp-and-omap3/">similar work over the last year or so to do video decoding on DSPs</a> found in mobile devices, leaving the CPU largely idle.</em></p>
<p><em>We realize this post isn&#8217;t strictly web developer-facing, but it&#8217;s interesting enough for those who want to know how this stuff works under the covers.</em></p>
<p><strong>Theora on N900: Or, how to play full-screen Theora video on the N900 with 80% idle CPU.</strong>
<p>The C64x+ DSP is often found in systems built upon TI&#8217;s OMAP3 <abbr title='System On A Chip'>SoC</abbr>, such as the Palm Pre, Motorola Droid, and Nokia N900. Last year, Mozilla funded a port, named Leonora, of Xiph&#8217;s Theora video codec to the TI C64x+ <abbr title='Digital Signal Processor'>DSP</abbr>. David Schleef conducted the port impressively quickly and <a href='http://www.schleef.org/blog/2009/11/11/theora-on-ti-c64x-dsp-and-omap3/'>published his results</a>. The intention of this project was to provide a high quality set of royalty free media codecs for a common mobile computing platform. The initial focus is Firefox Mobile on the N900, so I am working on integrating David&#8217;s work into Firefox. To experiment with other facilities Firefox could use to accelerate video playback and test integration, I&#8217;ve been hacking on a <a href='http://github.com/kinetiknz/plogg'>branch</a> of a stand-alone Ogg Theora and Vorbis player originally written by Chris Double called <a href='http://www.bluishcoder.co.nz/2009/06/27/playing-ogg-files-with-audio-and-video.html'>plogg</a>.</p>
<p>Decoding and playing video can be a CPU intensive process, especially when all of the steps are fighting for time on a single CPU. The expensive parts of the playback process can be broken down into a few coarse pieces, in approximate descending order of cost:</p>
<ol>
<li>Video frame decode</li>
<li>Video colour-space conversion (Y&#8217;CbCr to RGB)</li>
<li>Video frame display</li>
<li>Audio block decode</li>
<li>Audio block playback</li>
</ol>
<p>David&#8217;s DSP work enables item 1 to be off-loaded from the CPU completely, effectively providing &#8220;hardware accelerated&#8221; video decoding. Most devices have some way to off-load items 2 and 3 to the graphics hardware, but it can be difficult to make use of this while integrating with an existing graphics rendering pipeline.</p>
<p>The N900 has a 800&#215;480 pixel display, so my hope was to play a 800&#215;480 video full-screen at 30 frames per second with low CPU use and good battery life.</p>
<p>The ARM CPU in the N900 is quite fast. Doing a pure video-decode-only test, the original Theora library, which currently does not have ARM specific optimizations, is able to decode a 640&#215;360 video at 76 frames per second, and it can even decode an 800&#215;480 video at 32 frames per second. With the <a href='http://google-opensource.blogspot.com/2010/04/interesting-times-for-video-on-web.html'>ARM optimized port by Robin Watts</a>, those numbers become 110 FPS and 47 FPS. David&#8217;s DSP port produces 78 FPS and 39 FPS, and it leaves the CPU completely idle because the entire decode is off-loaded to the DSP. With these numbers, it&#8217;s clear that the N900 is up to the task of playing back video smoothly if we can get the bits on the screen fast enough.</p>
<p>I am using plogg as a basis for experimentation using techniques applicable in the Firefox rendering engine. This requirement immediately excludes some techniques. For example, using hardware Y&#8217;CbCr overlays to display the video frames is excluded because it is not possible for Firefox to render arbitrary HTML content over the top of the overlay.</p>
<p>Chris&#8217;s original version of plogg used SDL&#8217;s Y&#8217;CbCr overlay API, which uses a fast direct overlay path on most systems. This provided a baseline for playback performance. Decoding my 800&#215;480 test video with the DSP, it was possible to play back at 33 FPS with around 20% CPU idle. Unlike the decode-only benchmarks mentioned above, the plogg benchmarks are playing both audio and video with correct A/V synchronisation. With 44.1kHz stereo audio, I observed that 10-15% of the device&#8217;s CPU is used by PulseAudio. This indicates that audio playback may constitute a significant amount of processor time with some configurations.</p>
<p>Because there was already work underway to provide OpenGL accelerated compositing in Firefox with the newly conceived <a href='http://weblogs.mozillazine.org/roc/archives/2010/04/layers.html'>Layers API</a>, it seemed logical to try using a <abbr title='GL Shading Language'>GLSL</abbr> fragment shader to off-load colour-space conversion to the GPU. This turned out to be too slow to play back a full-screen video.</p>
<p>Looking at the list of vendor-specific OpenGL extensions available on the N900, I discovered the <a href='http://www.tiexpressdsp.com/index.php/OpenGLES_Texture_Streaming_-_bc-cat_User_Guide'>texture streaming API</a>. This allows a program to directly map texture memory and copy Y&#8217;CbCr data into that memory without having to perform an expensive texture upload or colour-space conversion. The colour-space conversion is off-loaded to dedicated graphics hardware inaccessible via the standard OpenGL APIs. Using this and the modified bc-cat kernel module from the <a href='http://gitorious.org/gst-plugin-bc/gst-plugin-bc/trees/master'>gst-bc-cat</a> project, it&#8217;s possible to play back at 26 FPS with 81% CPU idle.</p>
<p>One drawback of the current bc-cat kernel driver is that there is a very limited set of texture formats supported (NV12, UYVY, RGB565, and YUYV), and none of them are the same as what Theora produces. To work around this, a format conversion is required to convert planar Y&#8217;CbCr to packed 4:2:2 UYVY. Fortunately, this conversion is much simpler than a full colour-space conversion. Timothy Terriberry sent me a <a href='http://github.com/kinetiknz/plogg/tree/master/patches/'>couple of patches</a> to off-load this conversion work to the DSP. If it&#8217;s possible to extend the bc-cat driver to support texture formats compatible with Theora&#8217;s output, performance can be further improved.</p>
<p>The test files used for benchmarking were: Big Buck Bunny (video: 640&#215;360 @ 500 kbps 24 FPS, audio: 64 kbps 48kHz stereo, 9m 56s, 40MB) and the movie trailer for 9 (video: 800&#215;480 @ 2 Mbps 23.98 FPS, audio: 44.1kHz stereo, 2m 30s, 30MB). Benchmarks were run with the CPU frequency fixed at 600MHz.</p>
<p>In summary, it&#8217;s possible to play full-screen Ogg Theora videos on the N900 at full frame rates with low CPU use by off-loading video decoding to the DSP and colour-space conversion and painting to the GPU. There are opportunities for optimization left, tuning for battery life needs to be investigated, and the integration into Firefox still needs to be done.</p>
<p><em>Video decode-only:</em><br />
<table width='70%'>
<tr>
<th>Decoder</th>
<th>FPS (800&#215;480)</th>
<th>Idle CPU</th>
</tr>
<tr>
<td>libtheora 1.1</td>
<td>32</td>
<td>0.7%</td>
</tr>
<tr>
<td>TheorARM 0.04</td>
<td>47</td>
<td>0.4%</td>
</tr>
<tr>
<td>leonora (DSP)</td>
<td>39</td>
<td>99.0%</td>
</tr>
</table>
<p><em>Playback (video decode + paint, audio decode + not played). DSP decoding video:</em><br />
<table width='70%'>
<tr>
<th>Method</th>
<th>FPS (800&#215;480)</th>
<th>Idle CPU</th>
</tr>
<tr>
<td>SDL/overlay</td>
<td>33</td>
<td>20.0%</td>
</tr>
<tr>
<td>OpenGL/bc-cat</td>
<td>26</td>
<td>81.4%</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/04/theora-on-n900/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>autobuffering video in Firefox</title>
		<link>http://hacks.mozilla.org/2009/12/autobuffering-video-in-firefox/</link>
		<comments>http://hacks.mozilla.org/2009/12/autobuffering-video-in-firefox/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 00:56:05 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=3103</guid>
		<description><![CDATA[John Gruber recently wrote up an article titled Why the HTML5 ‘Video’ Element Is Effectively Unusable, Even in the Browsers Which Support It He&#8217;s mostly upset that browsers don&#8217;t respect the autobuffer attribute. Or, really, that browsers autobuffer by default. Safari and Chrome do apparently autobuffer by default, but he incorrectly says that Firefox does [...]]]></description>
			<content:encoded><![CDATA[<p>John Gruber recently wrote up an article titled <em><a href="http://daringfireball.net/2009/12/html5_video_unusable">Why the HTML5 ‘Video’ Element Is Effectively Unusable, Even in the Browsers Which Support It</a></em></p>
<p>He&#8217;s mostly upset that browsers don&#8217;t respect the autobuffer attribute.  Or, really, that browsers autobuffer by default.  Safari and Chrome do apparently autobuffer by default, but he incorrectly says that Firefox does as well.  Just to be clear: <em>Firefox does not autobuffer by default, nor does it autoplay by default.</em>  I&#8217;m not sure how his testing led him to believe that it does, but I wrote up some examples to show that it does not.  Here are three examples:</p>
<ul>
<li><a href="http://people.mozilla.org/~blizzard/gruber-test/test_noautobuffer.html">Video test without the autobuffer attribute.</a>  (Load this first to avoid caching issues!)</li>
<li><a href="http://people.mozilla.org/~blizzard/gruber-test/test_autobuffer.html">Video test with the autobuffer attibute.</a></li>
<li><a href="http://people.mozilla.org/~blizzard/gruber-test/test_both.html">Video test with one of each.</a></li>
</ul>
<p>The best way to test this is to load your favorite browser and clear its cache.  Then load your favorite network monitor.  Then load the <a href="http://people.mozilla.org/~blizzard/gruber-test/test_noautobuffer.html">page without the autobuffer attribute set.</a>  You can see how much bandwidth the browser is actually using via your external tool.</p>
<p>Of the browsers I tried, only Firefox gives useful feedback on how much is actually buffered as part of its native control set so you have to go to external tools to be able to tell what&#8217;s going on with anything else.  If you load the <a href="http://people.mozilla.org/~blizzard/gruber-test/test_both.html">page with two videos &#8211; one with autobuffer set and one without -</a> you can mouse over them in Firefox and see how one has buffered and one hasn&#8217;t.</p>
<p>The video on that test page is pretty big &#8211; around 115mb &#8211; so you can really tell when it&#8217;s buffering even on a fast network.</p>
<p>Here&#8217;s what my testing shows:</p>
<ul>
<li>Safari for desktops downloads a lot of data.  (<a href="http://joehewitt.com/post/on-middle-men/">I don&#8217;t have an iPhone</a> so I can&#8217;t test that.)</li>
<li>Chrome downloads a lot of data.</li>
<li>Firefox loads a small amount of data and then stops.</li>
<li><b>Update:</b> According to <a href="http://twitter.com/foolip/status/6923376494">Philip Jägenstedt, Opera will also do what Firefox does</a> when they include open video support.
</ul>
<p>This is consistent with what I know about Safari.  I talked with one of the Apple WebKit engineers a few months ago and he said that Safari for desktops buffered by default and said that Safari for mobile does not.</p>
<p>There might be some confusion because Firefox does make a couple of network requests when you include a video tag.  This is done for two reasons:</p>
<ul>
<li>To get the first frame of the video and it&#8217;s size.  It will only download a small part of the beginning of the video to get the first frame and then stop downloading.</li>
<li>If your server supports byte range requests, it seeks to the end of the video to try and determine the duration of the video.  If your server doesn&#8217;t support byterange requests, we don&#8217;t get the duration.  (Ogg was originally designed as a format for streaming, not static files and as such doesn&#8217;t include duration information in the header of the file, although there is work underway to add this functionality.)</li>
</ul>
<p>If you want to get a sense of how Firefox uses bandwidth, try <a href="http://people.mozilla.org/~blizzard/vprogress/test.html">this bandwidth test</a> I wrote a few months ago.  It uses a Firefox-only feature to read progress information on a video as it&#8217;s downloaded and give you a rough sense of the amount of bandwidth that particular video element is using.  It shows a little traffic when you load the video and then shows how it starts using bandwidth once you press the play button.</p>
<p>But this shows that we understand John&#8217;s point of view and we made the decision not to auto buffer by default for the very reasons he points out.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/12/autobuffering-video-in-firefox/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>theora 1.1 is released &#8211; what you should know</title>
		<link>http://hacks.mozilla.org/2009/09/theora-1-1-released/</link>
		<comments>http://hacks.mozilla.org/2009/09/theora-1-1-released/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 17:03:27 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=1646</guid>
		<description><![CDATA[Less than a year after the release of Theora 1.0, the wonderful people at Xiph have released Theora 1.1. The 1.1 release is a software-only release of the Theora encoder and decoder. It does not include any changes to the Theora format. Existing Theora videos should continue to play with the new decoder and the [...]]]></description>
			<content:encoded><![CDATA[<p>Less than a year after the release of <a href="http://www.xiph.org/press/2008/theora-release-1.0/">Theora 1.0</a>, the wonderful people at Xiph have <a href="http://theora.org/news/">released Theora 1.1</a>.  The 1.1 release is a software-only release of the <a href="http://www.theora.org/">Theora encoder and decoder</a>.  It does not include any changes to the Theora format.  Existing Theora videos should continue to play with the new decoder and the new Theora encoder generates bitstreams that will work in existing players that can play Theora content.</p>
<p>The 1.1 release is largely an improvement to the Theora encoder.  This post will attempt to give people a high-level overview of the changes and what they mean to web developers and people who are thinking of deploying Theora to support HTML5 video.  Theora is an important technology to web developers &#8211; it&#8217;s the only competitive codec that currently complies with the <a href="http://lockshot.wordpress.com/2009/07/30/whats-the-problem-with-ogg-theora/">W3C patent policy</a>.</p>
<p>Here&#8217;s a quick list of important things that have changed in this release.  We&#8217;ll go into more detail on each of these items.</p>
<ul>
<li>Video quality between Theora 1.0 and Theora 1.1 has been improved.</li>
<li>Rate control for live streaming now works well.</li>
<li>A two-pass mode has been added to the encoder that can create rate controlled videos with very predictable bandwidth requirements.</li>
<li>CPU usage during encoding is much more consistent.</li>
<li>Decoder performance has been improved.</li>
</ul>
<p><b>Video quality between Theora 1.0 and Theora 1.1 has been improved.</b></p>
<p>One issue that people had with the Theora 1.0 encoder was that it produced video that appeared fuzzy.  The 1.1 improvements are clear in these two images provided by <a href="http://web.mit.edu/xiphmont/Public/theora/demo7.html">Monty, one of the Xiph Developers</a>.  Open each of these images in new tabs and flip between them.  You can really see the difference.</p>
<p><a target="_blank" href="http://hacks.mozilla.org/wp-content/uploads/2009/09/st-1.0.png"><img src="http://hacks.mozilla.org/wp-content/uploads/2009/09/st-1.0.png"></a></p>
<p><a target="_blank" href="http://hacks.mozilla.org/wp-content/uploads/2009/09/st-1.1.png"><img src="http://hacks.mozilla.org/wp-content/uploads/2009/09/st-1.1.png"></a></p>
<p>This was also very visible at the edges of text.  Here&#8217;s an example taken from one of our <a href="http://www.mozilla.com/en-US/firefox/video/?video=whatnew-3.5">Firefox 3.5 promotional videos</a>.  The first is with the <a href="http://people.mozilla.org/~blizzard/videos/theora-1.0-vs-1.1/fx35_overview-1.0-v-4.ogv">1.0 encoder (9.0MB)</a> and the second is with the <a href="http://people.mozilla.org/~blizzard/videos/theora-1.0-vs-1.1/fx35_overview-1.1-v-6.ogv">1.1 encoder (8.2MB)</a>.  You will notice that not only are the edges more defined but there&#8217;s a lot less noise in the area around the edges of the text.  Once again, if you open them in tabs and flip between them you can see the difference.</p>
<p><a target="_blank" href="http://hacks.mozilla.org/wp-content/uploads/2009/09/fx-1.0.png"><img src="http://hacks.mozilla.org/wp-content/uploads/2009/09/fx-1.0.png"></a></p>
<p><a target="_blank" href="http://hacks.mozilla.org/wp-content/uploads/2009/09/fx-1.1.png"><img src="http://hacks.mozilla.org/wp-content/uploads/2009/09/fx-1.1.png"></a></p>
<p>Note that the original <a href="http://videos.mozilla.org/firefox/3.5/overview/overview.ogv">video</a> is nearly 17MB.  That was done largely to get the text crisp.  With these changes we can likely use a much lower-bandwidth version of the video, probably as small as <a href="http://people.mozilla.org/~blizzard/videos/theora-1.0-vs-1.1/fx35_overview-1.1-v-7.ogv">9.9MB.</a>  That&#8217;s a pretty big difference.</p>
<p>Note that we&#8217;re talking about an improvement of quality <i>at the same video bitrate</i>.  This means that we&#8217;re either able to produce higher quality videos at the same file size or we&#8217;re able to reduce the file size and keep the same quality &#8211; either way it&#8217;s a big win.</p>
<p><b>Rate control for live streaming now works well.</b></p>
<p>Before describing this change, something important must be described.  This is the difference between videos encoded with a <i><a href="http://en.wikipedia.org/wiki/Variable-rate_encoding">variable bitrate (VBR)</a></i> and a <i><a href="http://en.wikipedia.org/wiki/Constant_bitrate">constant bitrate (CBR)</a></i>.</p>
<p>In variable bitrate encoding the amount of data that&#8217;s required to represent the difference between two frames in a video is allowed to grow.  This happens most often when shifting from a scene where there isn&#8217;t much movement to a scene where there&#8217;s a lot of motion.  You could easily go from requiring 40Kb/sec to 400Kb/sec because the entire background moves.</p>
<p>In constant bitrate encoding the amount of data that you&#8217;re allowed to use to represent a change from one frame to the next is pinned at some maximum value.  If you&#8217;ve got a low maximum value and there&#8217;s a set of frames that requires a lot of bits to represent the changes from one to the next you will need to sacrifice something in order to stay inside of that maximum value.  Very often it&#8217;s some amount of video quality or the encoder will start dropping frames in order to keep under the watermark.</p>
<p>This leads to a pretty simple rule: <i>If you want the highest quality video possible, you should be using variable rate encoding.</i>  This means that when you&#8217;re encoding a video you should be using quality settings (0-99, low/medium/high, 1-10) instead of picking bitrates (60Kb/sec, 200Kb/sec.)  For most use cases on the web VBR-encoded videos actually work very well because users are allowed to buffer quite a bit of video out ahead of their current position so these bursts of data don&#8217;t affect the user&#8217;s experience.</p>
<p>But there are some use cases where having a constant bitrate is very important.  These include:</p>
<ol>
<li>Live, low delay streaming over HTTP with a lot of clients.</li>
<li>Streaming large files where a large read-ahead buffer is not desired.</li>
<li>Situations where large bursts of data result in large bursts in CPU to handle them.</li>
</ol>
<p>For live, low-delay streaming over HTTP it&#8217;s important to realize what happens when there&#8217;s a sudden burst of data to handle.  HTTP runs over <a href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP</a>.  In TCP it takes a while for a connection to increase its bandwidth.  (And by &#8220;a while&#8221; I mean &#8220;not that long&#8221; but it&#8217;s long enough to affect the low latency connection that we want for this use case.  This is why many low-latency applications don&#8217;t use TCP.  But we&#8217;re talking about delivering video over HTTP.)  If you&#8217;ve got a big burst of data and the TCP window takes a long time to open up you start building up a big send buffer on the server.  (And remember in this use case you&#8217;ve got a lot of clients connected!)  That requires a lot of memory to hold the send buffers for each client.  What happens then is that servers will start closing connections en masse because it needs to save memory or because it thinks that the client has become somehow unreachable.  This is made worse by the fact that even if the connection scales up and then scales back down it re-settles at the low rate and the process has to be repeated.  The user&#8217;s experience is that the video stream stops and restarts or just stops working altogether when the server hangs up.  The solution?  Using a constant rate that doesn&#8217;t require the TCP window to open up suddenly and doesn&#8217;t require large send buffers for each client.</p>
<p>For the use case where you&#8217;re streaming large files it might not be reasonable for the client to cache a lot of data.  You also might be serving up a lot of data to a lot of clients and you might want to avoid the large send buffer problem as well, just for different reasons.</p>
<p>And for the last use case where you&#8217;re in a CPU-constrained environment the bursting nature of variable bitrate videos means it often takes a large bursts of CPU to handle those bursts.  While CPUs do burst up faster than TCP does, you might be talking to constrained processors (think mobile) or you might be serving up files near HD-sized content, which CPUs often struggle to decode.</p>
<p>In any case there are a number of use cases for constant bitrate encoding.  Back to the question of what&#8217;s improved in Theora 1.1.</p>
<p>In Theora 1.0 the rate controlled encoding mode was very very broken.  This resulted in two things:</p>
<ol>
<li>People trying to do live streaming ran into problems.</li>
<li>People who used rate controlled settings to compare overall Theora quality to the quality of other encoders saw worse results than the format actually represented.</li>
</ol>
<p>The first issue is clear &#8211; it was broken, it should be fixed.  And it has been.  The new encoder does a pretty good job of maintaining bitrates, changes quality on the fly, drops frames and even includes a &#8220;soft-target&#8221; mode so that bitrates can fluctuate a little bit to maintain quality while occasionally breaking the bandwidth rules.</p>
<p>The encoder also has a wonderful new piece of functionality that people will find very useful.  It&#8217;s now possible to specify a maximum rate ceiling for video encoding while also specifying a minimum quality floor.  What this means is that the encoder will try and maintain very crisp video frames within rate constraints.  This means that it will aggressively drop frames instead of creating frame deltas that are fuzzy or low-quality.  While this might sound like a poor trade-off it&#8217;s actually very useful.  If you&#8217;re showing a live video of a presentation you usually want a crisp video of the slides and having a lower frame update rate is very acceptable.</p>
<p>The second issue that was caused by the bad rate control in Theora 1.0 is an issue of marketing.  People would often use the encoder with the fixed bitrate mode instead of the quality mode and dismiss the results as a reflection of the format instead of problems with the encoder.  We hope that people find better results with the new encoder.</p>
<p><b>A two-pass mode has been added to the encoder that can create rate controlled videos with very predictable bandwidth requirements.</b></p>
<p>In addition to fixing the single pass rate controlled encoder in 1.1 a two-pass encoding option has been added.  This means that if you are transcoding a file (as opposed to doing a live stream) you can create a very consistent bitrate in a file if you want.  This is because the encoder can look ahead in the stream to allocate bits efficiently.  <a href="http://web.mit.edu/xiphmont/Public/theora/demo8.html">Monty from Xiph made a graph</a> that shows one example of the bitrate in a file with one pass and two pass.</p>
<p><a href="http://web.mit.edu/xiphmont/Public/theora/demo8.html"><img src="http://web.mit.edu/xiphmont/Public/theora/onepass-twopass.png" width="500"/></a></p>
<blockquote><p>Above: graph of quantizer choice (which roughly corresponds to the encoding quality) when using default two-pass bitrate management as opposed to one-pass (with &#8211;soft-target) when encoding [the Matrix movie clip] at 300kbps. Both encodes resulted in the same bitrate. The quality of a one-pass encode varies considerably as the encoder has no way to plan ahead.</p></blockquote>
<p><b>CPU usage during encoding is much more consistent.</b></p>
<p>People who were doing live streaming often saw huge spikes in CPU usage during high-motion events.  This has been fixed and now CPU usage is much more consistent during single pass rate constrained encoding making it much easier to live stream video.</p>
<p><b>Decoder performance has been improved.</b></p>
<p>And last but not least the decoder has been made faster during the 1.1 release.  How much faster depends quite a bit on the clip, but people are reporting that the new encoder is anywhere from 1.5-2x faster than the 1.0 of release of libtheora.</p>
<p><b>Coming soon to a product near you.</b></p>
<p>This release is a library release.  It&#8217;s not a product in itself, but is instead something that other products include.  So over the next days and weeks we&#8217;ll see other products pick up and start using this as part of their releases.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/09/theora-1-1-released/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
<enclosure url="http://videos.mozilla.org/firefox/3.5/overview/overview.ogv" length="17620460" type="video/ogg" />
		</item>
	</channel>
</rss>

