Video.js - HTML5 Video Player

Video.js Blog

David LaPalomento2016-08-10

The End of "HTML-First"

When video.js was first released all the way back in 2010, Flash was the only way to play video in Firefox, IE, and the Android browser. And when you could use HTML video, it was really complicated to get right and broken in all sorts of scenarios (live streaming, anyone?). Those problems were a big part of why we wrote video.js in the first place. The HTML standard provided a simple, powerful, and universal API for video: why use anything else?

The superiority of HTML video is pretty well established these days and browser support for video reflects that. If you have your videos in MP4 format, video.js will play them natively in HTML on every modern desktop and mobile browser out there. In video.js 5.0, we started the process of deprecating the last holdout in our supported browsers: the dreaded Internet Explorer 8. If you're saying to yourself "Wha?! You still support IE8??", I share your shock and horror. It's no fun but we've been holding out for the couple folks who want to use video on their sites and still have to support ancient clients. There's a couple more hoops to jump through however, and you should start emotionally preparing yourself for the end of IE8 support if you're one of the people using it. With IE8 heading out to pasture, including a Flash fallback by default in video.js is starting to look a little silly.

So here's what we're thinking: move Flash support out of the core of video.js and into our legacy-compatiblity shim around the time Chrome begins deprecating Flash this December. We'll keep it around for awhile to support some more complex usage (say, live streaming in IE10) but the heart of video.js will go from "HTML-first" to "HTML-only." That should mean more focus from the core committers on some amazing new stuff like improving our plugin framework, enhancing our support for HLS and DASH, and making advanced features like ads easier to integrate and better for viewers.

How does that sound? Let us know in this issue, ping @videojs on Twitter, or come say "hi" in our Slack channel.

Steve Heffernan2014-07-22

DASH Everywhere-ish (hack project)

A couple of times a year Brightcove has an internal hackweek where engineers work on any project they’d like. In the latest hackweek (2014-07-14) Tom Johnson decided to see if he could get DASH supported in as many places as possible, by combining a few of the existing DASH player implementations with Video.js.

MPEG-DASH (Dynamic Adaptive Streaming over HTTP) is a streaming format similar to Apple’s HTTP Live Streaming (HLS). It allows you to provide multiple versions of a video at different bitrates, and then the player can switch between those versions depending on the user’s bandwidth (which is more complicated than you might think).

The two DASH playback implementations used were Dash.js and Dash.as. They were combined using video.js’s playback tech architecture, which means you can include plugins and custom skins and they’ll work the same with either playback method.

See the results.

Browser/Device Coverage

Using a combination of DASH.AS and DASH.JS will give us the following browser/device coverage:

DASH.JS (media source extensions support)

  • Internet Explorer: 11+
  • Chrome: 23+
  • FireFox: 25+ (upcoming version)
  • Safari (Desktop): 8+ (OSX Yosemite - Fall 2014)
  • iOS: No
  • Android: 4.2+ (Chrome)

DASH.AS

Fallback to any environment that supports Flash Player 10.3

iOS

As you can see, the one remaining holdout is iOS and there’s currently no word when or if that will happen. Seeing media source extensions support in Safari 8 gives some hope, but my understanding is the requirements for getting support built into iOS are much more significant. My guess is it will happen eventually, but not for a while (and hopefully in-line playback + the fullscreen API will be supported at the same time).

Today, to provide adaptive streaming everywhere, you still need either DASH + HLS, or just HLS (you can use the video.js HLS plugin to support HLS in more browsers).

Tom’s Notes

The demo shows that for environments which support Media Source Extensions (MSE) we use a full Javscript implementation via Dash.js and as a fallback we use Flash built around OSMF and Dash.as, an open-source plugin provided by Castlabs.

Tom has been working on videojs-osmf on the side, which helped make this possible.

DASH.AS Requirements

Player

  • Environment must support Flash Player 10.3+
  • Video.js OSMF Tech (videojs-osmf)
  • CastLabs Dash.AS plugin for OSMF (dash.as)

Server/Host

  • Since the requests are fired from within Flash, a crossdomain.xml file is required.* Ability to serve byte range requests via query string (myFile.mp4?range=0-1000 || myFile.m4s?bytes=0-1000) is necessary because Flash Player restricts use of the ‘Range’ request header. Castlabs has an .htaccess file which uses mod_rewrite to achieve this. Akamai edge servers accept the bytes query string var as well.

Notes

  • Something we may want to modify is handling the request/response portions of the workload outside of the Flash Player similar to the Video.js HLS solution. This would remove the need for having a crossdomain.xml, which cannot be normally expected to exist in a DASH focused environment.
  • Akamai edgesuite appear to be an exception to the above rule, as those domains do in fact have the crossdomain from it’s use as a serving platform under Akamai HD. The Akamai param syntax is ‘myFile.m4s?bytes=XXXX-YYYY’.
  • In it’s current form the Dash.AS manifest parser is very rigid. We may want to look into implementing a version of the DASH.JS manifest parsing on the AS side, as it is a lot more flexible in terms of structure recognition.
  • Deeper class inspection shows that the Dash.AS plugin is based on using Netstream in data generation mode, similar to our HLS solution. There may be better way to share the codebase between the two to reduce code duplication.

DASH.JS Requirements

Player

Server/Host

  • Open CORS headers: Access-Control-Allow-Origin: *
  • Accept use of the Range request header: Access-Control-Allow-Headers:Range, Options

Notes

  • Dash.js MPD parsing is significantly more robust in comparison to the Dash.AS solution.
  • Most streams tested are Akamai based, we should probably try more local and non-Akamai hosted options moving forward.* In my testing I did see a Youtube DASH/MSE example, and those streams were confirmed to work within Dash.JS as well.
  • Dash.JS streaming lifecycle and segment loading lifecycle tend to be directly coupled and don’t necessarily fire the element media events at the time expected. For example is duration. While known at the parse complete stage of the manifest load cycle, is not reported to the player until the first of the segments is received.

Tech Compatibility

The independant techs work well together. A slight modification had to be made to the Dash.AS library to insure that it only checked for resources which 1. had a URL and 2. url contained the file extension of either ‘mpd’ or ‘m4s’ for DASH manifests/segments.

NOTE: Dash.JS tech should be loaded into DOM prior to OSMF tech to insure the OSMF tech is the fallback scenario for DASH playback.

Steve Heffernan2013-07-15

New Player Skin Designer for Video.js

Last week Brightcove had an internal hack week where everyone could work on any project they wanted. One of the projects that came out of that was a new video.js skin designer.

The designer allows you to watch changes happen to the skin live as you edit the CSS, making it easier to create a custom look.

Check out this familiar looking example that was done in just a few minutes.

Try creating your own and let us know what you think. Better yet, create your own, share it on CodePen.io and post a link in the comments. (It’s probably easiest if you start by forking this unedited example.)

One of my favorite things about video.js is that the skins are built in HTML and CSS, while working across both HTML5 and Flash video. I think this designer does a nice job of showing off how easy that makes it to customize a player’s skin.

Some notes on how we built it…

As a starting point we used Brian Frichette’s awesome LESS2CSS, which gave us a huge head start. Brian has offered to help with the skin designer as well, so that’s great!

We haven’t added a CSS preprocessor to video.js before because we didn’t want the extra layer of abstraction, or the extra step in the build process. When looking at the CSS in the new designer however, it became clear how valuable things like variables can be for helping people understand what’s happening in the CSS. Still, we’re trying to find the balance between using LESS features and keeping the CSS easily readable by anyone who just knows CSS. That means avoiding some of the more advanced LESS features like conditional statements (though we do use one for big play button positioning).

We chose to use LESS because of the ability to parse the LESS markup in javascript in the browser. I’m not aware of any up-to-date in-browser SASS parsers. The completeness of LESS2CSS also influenced that decision. We’re using a small enough subset of features that it doesn’t really matter which one we use otherwise, though I do like the idea of using \$ for variables over @.

It’s hosted on Nodejitsu, and we’re taking advantage of their free hosting for open source. I have to say, it was pretty simple to get the app deployed with their command line tool.

Let us know if you have any thoughts. The code for the designer can be found here: https://github.com/videojs/designer

Cheers,
-heff