Major rewrite to add support for videojs.