-
Notifications
You must be signed in to change notification settings - Fork 7.5k
5.0 Change Details
Notes on changes that are being made as version 5.0 is built. We can use this to inform blog posts and a migration guide.
With Video.js we were previously using Closure Compiler in advanced mode to achieve the smallest possible file size. However, what we found is this requires a lot of overhead and extra knowledge when writing the code that is unfriendly to project contributors, and that the mangled object properties create problems and confusion among developers building on the API (e.g. plugin developers). In 5.0 we're switching to UglifyJS and looking for additional size saving strategies that have less negative impact.
We're using Browserify with a Babelify transform.
We've switched to more standard file naming conventions.
video.js
-> video.min.js
video.dev.js
-> video.js
If a slider is specified as vertical, we'll now actually track Y-axis movement instead of requiring users to rotate with CSS.
The spacer component is simply an empty div that can be used to space elements in the control bar via CSS. This is especially useful since we're moving to a flexbox-based layout where a spacer set to auto
width could be used to essentially "float" elements right.
Also in this change came a more specific CustomControlSpacer
, which is going to be used as the default injection point for custom components in plugins.
The default for browsers is box-sizing: content-box
, but border-box
is more intuitive and easier to work with. We've switched to this for the player and all elements in the player.
The default skin has switched from displaying in an inline volume bar to a volume menu that displays on hover. The inline volume bar will still be created by default however, so you can hide the menu and display the inline version with CSS.
See #2035 and #2078. Component.extend() is being deprecated.
When developing with ES6, use ES6 classes
const VjsButton = videojs.getComponent('Button');
// internal to video.js you would use `import Button from 'button.js'`
class MyNewButton extends VjsButton {
constructor(player, options) {
super(player, options);
} // notice, no comma
otherFunc() {
// do something
}
}
When externally subclassing components (not using ES6), you can use the videojs.extends
function.
var VjsButton = videojs.getComponent('Button');
var MyNewButton = videojs.extends(VjsButton, {
constructor: function() {
VjsButton.call(this, player, options);
}, // notice the comma
otherFunc: function() {
// do something
}
});
Major release may come more quickly now since we're not going to wait for big "press-worthy" changes to do them.
https://github.com/videojs/video.js.wiki.git Page not avaiable now.