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

Warn if options / ready function are passed to a previously created player instance #1730

Closed
wants to merge 1 commit into from
Closed

Warn if options / ready function are passed to a previously created player instance #1730

wants to merge 1 commit into from

Conversation

mister-ben
Copy link
Contributor

There are questions fairly regularly on Stack Overflow that come down to confusion over using both data-setup and passing options and/or a ready function to videojs().

This change logs a message with vjs.log if options or a ready function are passed as arguments, if a previously created player is returned. It also adds note in the setup doc.

@heff
Copy link
Member

heff commented Dec 9, 2014

Nice! Handling this is much needed.


// If options or ready funtion are passed, warn
if (options) {
vjs.log.warn ('Player "' + id + '" is already initialised. Options will not be applied.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we couldn't still handle options and update the values in this case. Though handling options like children after init would get super complicated, so probably not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep merging is hard. But otherwise, yes, it could happen.

@heff
Copy link
Member

heff commented Dec 16, 2014

@mister-ben can I get you to make the player.ready(ready); change mentioned?

@heff heff closed this in f0d500a Dec 22, 2014
@heff
Copy link
Member

heff commented Dec 22, 2014

Merged into master. Thanks Ben!

@mister-ben
Copy link
Contributor Author

Thanks! I've been away with no internet for a couple of weeks, so hadn't been able to get around to that last change.

@heff
Copy link
Member

heff commented Dec 23, 2014

No problem. Thanks for the help!

@mister-ben mister-ben deleted the initialised-player-warning branch December 30, 2014 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants