There are three ways to check for a player ready event, are we sure that we want to have three ways rather than just 1?
Pass a callback to the videojs() function as a third argument:
// Passing `null` for the options argument.
videojs('my-player', null, function() {
this.addClass('my-example');
});
Pass a callback to a player's ready() method:
var player = videojs('my-player');
player.ready(function() {
this.addClass('my-example');
});
Listen for the player's "ready" event:
var player = videojs('my-player');
player.on('ready', function() {
this.addClass('my-example');
});
I think the only real candidate for removal would be the player.ready function. I can't think of any other event that has a special method to add a listener like that.
player.ready() triggers the function if the player is already ready. on('ready'... does not.
Good point.
Ok with that in mind I guess it does make sense to keep all three of these unless we want to remove the ready function argument from videojs().
... or get rid of ready altogether.
How would that be possible @dmlap?
I think we're not ready to remove ready :D
Maybe we should abstract ready away from users and wrap our own methods in ready calls. We would just need to make sure that ready calls things in order.
Whether we abstract it away, I don't think we want to remove it's functionality.
Most helpful comment
player.ready()triggers the function if the player is already ready.on('ready'...does not.