Hooray, a new year! Nice article, good to see non-frameworked JavaScript :-)

One regex gotcha:

* “.” means any character except newline, and w is alphanumeric+underscore – so if your source src attribute was “my-cat.mp4”, then the first line that sets the src attribute would end up putting in “bumper-in.cat”. If you don’t know what your filenames will be apart from the extension, plus you only care about the extension, probably better just to use something like /.(w+)$/

And a couple of regex typos:

* The “w” character classes all appear to be missing their “”, unless you only want to match wwwww.www ;)
* The last regex has “([w]+)” which also should presumably be w+

Thanks, Drew. This seems like a great solution. Unfortunately, none of the examples work here on my iPhone 4 running iOS 5.

First few examples don’t play, and the bumper examples play the first bumper, then reload the first bumper and pause. If you press play, it plays a second of the bumper and pauses, an repeats that infinitely. Never loads the main video.

What’s the performance like on loading 2 videos? I know Firefox is quite keen when loading assets. I’m assuming the main video loads in the background as its requested on page load. Any issues with the browser downloading the main video and the front bumper at the same time?

This is great thanks Drew; really interesting approach. I’d worked with bumpers for clients using Brightcove and then tried to replicate similar functionality for another client using the onended event to pass in a second video to the player. I hadn’t however taken the next step as you have here, so thanks for sharing :)

This is awesome!! Thanks Drew. Good example of progressive enhancement.

I am just beginning to dive deeper into JS & jQuery, but I am wondering if we could add fade ins or fade outs or even cross fades. That would improve the transition between the bumper and main video, allowing the bumper to seem baked in.

Also, I use Vimeo for all my video embeds. Can you place an href or external url inside a <source> tag?

Unlike your cat in the video i am very impressed by this tutorial. Works fine on desktop! However as stated above have some issues on iPhone4 IOS5: doesn’t work using opera mini, on chrome for mobile and safari i get only the first bumper. Will try on IOS6 too. Thank you very much for the great opener.

I remember trying different things like this ten years ago using SMIL, sometimes running two or more files concurrently (separate audio/video files), adding interactivity (e.g., nav inside the presentation), etc. Maybe with Flash (mostly) out of the picture now SMIL could find some footing again. If nothing else, it was fun to play with. (Nostalgia.)

With this simple technique we can use the same product movie on each different webshop for the same product, with only a different branding bumper.

When example 2, 3 and 4 I got a 403 error (using Chrome, IE was no problem). Example 1 was no problem. Is this only with my particular computer or can’t it be used with Chrome? Because a lot of people use Chrome these days.

Very impressive thought process with a fantastic suggestion for utopia.
How are you going to sell that to your client? You found a way for them to be able to maintain their branding on their videos forever…. As long as the viewing is part of the percentile that supports technologies your client doesn’t understand.

But why wouldn’t you simply manipulate three separate video elements? This way you will be able to fade the bumpers into the main video for example or use some other effect. But in any case, the main point is, that this will open opportunity for more flexible and smooth transitions. With less javascript.