Video.js generally lays out the player to the dimensions that are set as attributes or via CSS, like other DOM elements. However, we provide a few ways to make the player be more fluid.
Alternatively, because 16:9 and 4:3 aspect ratios are so common, we provided them as classes by default for you to use if you know that your videos are 16:9 or 4:3.
You can specify an aspect ratio for us to use if you don't want to use the intrinsic values from the video element or if you have a specific ratio in mind. It works as either a method call or an option to the player.
This option is in the form of two integers separated by a colon like so `16:9` or `4:3`.
Fill mode will make the player fit and fill out its container. This is often useful if you have a responsive website and already have a container for Video.js that resizes properly to your design. It can be set either via a class or an option.
If fill is enabled, it'll turn off fluid mode. If the player is configured with both fluid and fill options, fluid mode takes precedence.
Responsive mode will make the player's UI customize itself based on the size of the player. This is useful if you have embeds of varying sizes - or if you want a fluid/fill player to adjust its UI based on its size.
Responsive mode is independent of fluid mode or fill mode - it only deals with the arrangements of the UI within the player, not with the size of the player. However, it is often useful to use responsive mode in conjunction with either fluid mode or fill mode!
### Class
A player in responsive mode will add and remove classes based on its size breakpoints. The default breakpoints, classes, and sizes are outlined below:
You can enable responsive mode by passing the `responsive` option or by calling `player.responsive(true)`.
```js
var player = videojs('vid1', {
responsive: true
});
```
```js
var player = videojs('vid2');
player.responsive(true);
```
### Disabling Responsive Mode
You can disable responsive mode by passing `false` to the method.
```js
player.responsive(false);
```
### Customizing Breakpoints
The default breakpoints can be customized by passing the `breakpoints` option or by calling `player.breakpoints({...})`.
```js
var player = videojs('vid1', {
breakpoints: {
medium: 500
}
});
```
```js
var player = videojs('vid2');
player.breakpoints({
medium: 500
});
```
The breakpoints object should have keys matching the **Name** from the table above and values matching the **Max. Width** from the table above. The **Min. Width** is calculated by adding one to the previous breakpoint's **Max. Width**.
Anytime breakpoints are customized, previous customizations are discarded.
### Restoring Default Breakpoints
The default breakpoints can be restored by calling `player.breakpoints(true)`.
```js
var player = videojs('vid1');
player.breakpoints(true);
```
This is only useful if breakpoints had previously been customized.