Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we want to support three different ways to watch a ready event in Player? #3782

Closed
brandonocasey opened this issue Nov 14, 2016 · 9 comments

Comments

@brandonocasey
Copy link
Contributor

Description

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');
});
@misteroneill
Copy link
Member

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.

@mister-ben
Copy link
Contributor

mister-ben commented Nov 15, 2016

player.ready() triggers the function if the player is already ready. on('ready'... does not.

@misteroneill
Copy link
Member

Good point.

@brandonocasey
Copy link
Contributor Author

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().

@dmlap
Copy link
Member

dmlap commented Nov 15, 2016

... or get rid of ready altogether.

@misteroneill
Copy link
Member

How would that be possible @dmlap?

@gkatsev
Copy link
Member

gkatsev commented Dec 8, 2016

I think we're not ready to remove ready :D

@gkatsev gkatsev closed this as completed Dec 8, 2016
@brandonocasey brandonocasey reopened this Dec 9, 2016
@brandonocasey
Copy link
Contributor Author

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.

@gkatsev
Copy link
Member

gkatsev commented Dec 9, 2016

Whether we abstract it away, I don't think we want to remove it's functionality.

@gkatsev gkatsev closed this as completed Jan 2, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants