(Before You) Background Video
Before jumping-into adding background video to a website, you should review considerations and limitations:
The Just Because Clause
Don’t just use this technique because you can: video content must amplify a site’s message, not just be shown because it’s pretty. Unless it's really-really-really pretty.
Sound Off
The video will likely be set to autoplay, but it should be muted by default; ideally, it should not include sound at all. Please, and for the love of all things holy, MUTE. THAT.
Fallback
The video should display a placeholder image, falling back to a static background image for browsers that do not support HTML5. The placeholder image will also be used a background on mobile devices: most phones and tablets do not support auto-play, for obvious reasons.
Length
If too short, a video can feel repetitive (as most such videos will be set to loop), while too long becomes a narrative unto itself, and therefore deserving to be a separate design element.
A runtime of approximately 12 – 30 seconds will be ideal.
Accessibility & Contrast
Any text or (logo) image placed on top of the video should remain in high contrast throughout the length of the video. Considering that every frame of the video is different, this can be hard to achieve, but it's totally possible to add an "overlay filter" to the browser with CSS code to better add to the contrast. Users should have easy access to a UI control to pause the video*; ideally, the video should play through only once.
* It's an accessibility issue; flashing or strobing content can trigger epilepsy and migraines in susceptible individuals, and some will find it difficult to read content with moving images on the page. Those visitors should not visit the Squareflair 404 page.
Browsers Still Suck at HTML5 Video?
Is it a truth that all other browsers besides the one I use are horrible? OF COURSE! That's one way to look at it, but in reality, we always need to be aware of what users use (what people surf with sounded worser). For this, it's always a good idea to deliver the same video in various formats. The HTML5 <video> element works in the latest versions of all major browsers (IE9+, Firefox 7+, Chrome 14+, Safari 4+, and Opera 11+). But because different browsers prefer different native video formats (of course, why wouldn't they?) — a typical implementation of <video> in HTML5 looks like this:
In horse racing terms:
Frontrunners MP4 and running mate WEBM are on-course to the bank, and washed-out OGV (OGG) is still hanging on.
Another way to remember it:
"WHO DOWN WITH O.G.G.? ... some versions of Firefox, um... homie."
The fallbacks are necessary because not all browsers support MP4 playback. Those that do not will skip to the WEBM format. If the browser doesn’t support MP4 or WEBM, it will default to the OGV format. Between these three formats, you should have compatibility with just about every common browser.
A closer look at the <video> attributes used above:
poster – a link to an image that will be displayed while the video is loading or prior to the visitor clicking on the play button
controls – tells whether or not the visitor can see the video playback controls
muted - this mutes the sound on the video
source – the link to the video file’s location
source type – the video format of the referenced file
fallback text – the text within the <p> tags will display if the browser cannot play any of the three video formats
If the video content is of utmost importance that it must be viewed, well then— don't put it in the background of your page. But seriously, if you want to provide a link for people to play it, then the fallback text could read something like this:
Your browser doesn't support HTML5 video. Here's a <a href="#">link</a> to download the video.
Stepping back out of the Nerd Forest and back to considerations and limitations; there's much more to adding video to the background of a page, like adding CSS styles using javascript, and all the testing. We're only scratching the surface here, people!
Bandwidth is Still a Major Concern
The video needs to be small, and compressed as effectively as possible. Try to keep the video under 5MB; ideally, under 500K. Additionally, the video needs to scale across different devices and their associated screens.
After calculating all the other content that has to load on the page, ask yourself this important question:
"what would it do to the visitor's experience if I added another 8MB to this page?"
What About YouTube?
Meh. Despite the popular belief that YouTube is all you need, it does have some notable downsides. For example, at the end of your YouTube video a series of other recommended videos is displayed, which is hideous. YouTube also adds a small watermark to every video, which isn’t always acceptable (also hideous). There are plenty of other cases where YouTube is not a viable option, so to be safe, go the extra mile and make things awesome by using custom code that's made for the site.