My simple solution
$(document).ready(function($) {
videojs('video', {height: 'auto', width: 'auto'}).ready(function() {
var player = this,
aspectRatio = 9/16;
function resizeVideoJS() {
var width = document.getElementById(player.id()).parentElement.clientWidth;
player.width(width).height(width * aspectRatio);
}
resizeVideoJS();
window.onresize = resizeVideoJS;
});
});
When creating your player, you can pass the fluid: true option:
var myPlayer = videojs('my-video', {fluid: true});
Or you can set it after initialization at some point:
myPlayer.fluid(true);
Most helpful comment
When creating your player, you can pass the
fluid: trueoption:Or you can set it after initialization at some point: