Video.js Blog

Steve Heffernan2010-11-22

2.0.0 Release - Behaviors, fallback APIs, and more.

Big update. The biggest change for current users is a move back to using DIVs for control bar elements instead of unordered lists. There were a lot of conflicting styles issues when using lists, which shouldnt be an issue with divs. So if you upgrade, dont forget to upgrade your stylesheets as well.

Beyond that, a lot of code was reorganized and modularized to create a platform for further expansion, like custom plugins and controls. The concept of behaviors was added, so you can activate any element on the page to act like a video controls. For instance, the following code snippet will make the specified element act like a play button, and play the video when clicked.

myplayer.activateElement(myElement, "playButton");

The next code snippet will make the element act like a play progress bar, meaning it will grow horizontally as the video plays.

myplayer.activateElement(myElement, "playProgressBar");

More documentation on this is coming.

The code is now prepped for APIs to the fallback flash players. So if you call myPlayer.play(), it will trigger a play in both the HTML5 and the Flash version, whichever is currently being used. A flowplayer API is just about done, and other popular Flash players will follow.

Finally, you can change the fallback order by modifying the playerFallbackOrder option, which is an array of player platforms. So if you want Flash to be dominant, you would pass the following option.

VideoJS.setupAllWhenReady({
  playerFallbackOrder: ["flash", "html5", "links"]
});

This also leaves room for other platforms to be added, like Quicktime.

So coming up is Flash player APIs, and another cool feature I dont want to mention just yet.

Full list:

  • Feature: Created behaviors concept for adding behaviors to elements - Feature: Switched back to divs for controls, for more portable styles
  • Feature: Created playerFallbackOrder array option. [“html5, flash, links”]
  • Feature: Created playerType concept, for initializing different platforms
  • Feature: Added play button for Android
  • Feature: Added spinner for iPad (non-fullscreen)
  • Feature: Split into multiple files for easier development
  • Feature: Combined VideoJS & V into the same variable to reduce confusion
  • Fix: Checking for m3u8 files (Apple HTTP Streaming)
  • Fix: Catching error on localStorage full that safari seems to randomly throw
  • Fix: Scrubbing to end doesnt trigger onEnded

Download version 2.0.0