VideoJS Dash & HLS Bitrate Representation Switching

Building many plugins for VideoJS I have a bitrate switching plugin that has been used extensively. The plugin mainly focused on HLS representations and I was accessing the representations with the following code. var player = videojs('my_video_1');'loadedmetadata', function(_event) { var reps = player.vhs.representations(); console.log(reps); }); I then looped through...

How To Get The Width & Height Of VideoJS Player Using getComputedStyle()

Just a quick blog post this is useful when developing VideoJS plugins and it is not widely documented so posting here. var player = videojs('my_video_1', { crossOrigin: 'anonymous', inactivityTimeout: 0 }, function() { // With pixels console.log('width', getComputedStyle(player.el()).width); console.log('height', getComputedStyle(player.el()).height); // Without pixels console.log('width', parseInt(getComputedStyle(player.el()).width)); console.log('height', parseInt(getComputedStyle(player.el()).height)); });