Browsing Posts tagged video

Update - Feb 2015

After implementing Scroll n' Scrub on one of our own websites here's a few things I learnt along the way. In the end we opted for a video piece that was exported into single images as "frames", we reduced the frame rate and heavily optimized the images for decreased image count and faster load times. Very similar concept to animated "flick books". Different frame on each page, as you flick through the book the illusion of animation is created. In this analogy, scrolling is our paradigm to flicking through the pages.

The hardest part was seamlessly getting the images to load in the background as the user scrolled/animated. We didn't want to pre-load all 320 images upfront with more traditional Javascript, it kind of defeated the purpose of a seamless animation. In the end we opted for a "double buffering (Slide #25)" technique using the canvas tag. Two canvases are created, one hidden/off-screen; the other being the actual canvas the animation takes place in. Loading images into canvas is surprisingly easy.

Animation was handled through Javascript's requestAnimationFrame(); (rAF) method, but a polyfill was used for cross browser compatibility. rAF has the advantage of leveraging GPU instead of regular client-side processing/CPU.

Some simple Javascript scroll calculation was used to compute user scroll as a % of total scroll, based on total number of frames. As the user scrolled images were preloaded into the canvas off screen and painted onto the main canvas once they were loaded. This had the benefit of reducing "black-outs" or "tearing". These were issues we came across using regular JS preload techniques and then injecting to DOM. If an image (frame) had only half-loaded as the (user) scroll requested it, it resulted in some undesirable flickering or "blacking out". With the canvas technique, the image was only rendered once fully loaded creating a much more seamless animation.

We also added in some gravity to the scroll "Kinetic Scroll" for good measure based on this work by Ariya Hidayat, it uses the same computation as the iOS kinetic scroll.


Scroll n' Scrub™. A phrase I feel sums up this technique beautifully, a technique I'm noticing a lot more on the Internet that introduces some really stunning and immersive front-end presentations.

With numbers for IE8 slowly dwindling and front-end support for this browser falling, front-end developers can now really begin to look forward to some true cross-browser HTML5. IE9, the lethargic example of modern browsers, finally allows front-end developers to introduce some of the more exciting features of HTML5.

This particular technique focuses on the ability to "scrub" HTML5 video using Javascript events such as defaultPlaybackRate(), playbackRate(), and currentTime(). (

The concept is simple. Take a well directed, orchestrated video. Hide the controls and turn the vertical scroll-bar into the play seek bar. As a user scrolls the video plays forwards or backwards to create a truly immersive experience.

Combine that with some well-timed and placed div overlays, some parallax action and you have some really compelling webpages.

Since June 2004 and it's subsequent first working draft in Jan 2008 HTML5 has, and still is, in flux with a stable recommendation finally slated for the end of 2014, but even as I write HTML5.1 is now being drafted.

One of the many great components of HTML5 was the promise of ubiquitous video and audio content. However due to patent issues, mainly H.264 decoding (licensed through MPEG LA acting as a consortium to these majority stake MPEG Patent holders: Apple, Microsoft, Panasonic, Sony, Dolby, Thomson, and Toshiba (*B)), we've been left with somewhat of a pseudo mash-up of native HTML5 video and Flash Video wrappers unless you wanted to support multiple formats in addition to H.264, namely OGG/Theora.

For a while now Flash has offered a TRULY ubiquitous platform for delivering video and audio content. Gone were the days of having to support .mov for Mac and .wmv for PC

Due to costly patents and the Open Source ethos of projects like Firefox and Opera, these projects have had to, until now, leverage open-source video codecs. Which has led to a slower adoption of video / audio tags in HTML5 across the web.

Spurred on largely by it's Mobile efforts (FirefoxOS) Brendan Eich at Mozilla wrote (Mar 2012) a rather lengthy blog post about their decision to finally, now, adopt H.264.

Instead of building software H.264 decoding directly into the browser they've avoided costly patent fees by relying on H.264 decoding at a hardware level.

What I do know for certain is this: H.264 is absolutely required right now to compete on mobile. I do not believe that we can reject H.264 content in Firefox on Android or in B2G (*A) and survive the shift to mobile.

Losing a battle is a bitter experience. I won’t sugar-coat this pill. But we must swallow it if we are to succeed in our mobile initiatives. Failure on mobile is too likely to consign Mozilla to decline and irrelevance. So I am fully in favor of Andreas’s proposal.

What this means, in short, is that H.264 decoding is now supported in Firefox on a variety of hardware except for Mac OS X due to this bug

OK. This one took a while. Would like to thank Nicolas Gallagher over at HTML5 Boilerplate whose post put me on the right path.


Using native HTML5 video/source tags in an HTML4 XHTML Transitional (Yes! not semantic, but legacy requires it) !doctype destroys the native video controls on a Samsung S3(SPH-L710) running Android 4.1.2 (and possibly other Android versions).


After a few minutes Googling I found this thread on GitHub where the chaps working on HTML5 Boilerplate were running into similar issues. It turns out that simply declaring a generic: input{[some styling];} in CSS destroys the native HTML5 video controls on Android. The resolution, it turns out, was simple. Prefix the generic input with html html input{[some styling];}. That's it!

Hope this helps some folks out. Took me a while to figure this one out.