-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Options in data-setup attribute are ignored when the initialization is called before autoSetup #1514
Conversation
Interesting, thanks! I don't think we've run into this before because most people either use autoSetup by itself,
or they don't use the data-setup attribute and pass in the options in the init function
But I could see there potentially being a situation where you have two async scripts, the autoSetup scripts and another script that references the player, and that would cause this issue. Is that the situation you have? |
}; | ||
|
||
tagOptions = vjs.getElementAttributes(tag); | ||
dataSetup = tagOptions['data-setup']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're doing this here now we should also remove it from the autoSetup script. And move the code comments over from there over to this one. Just the "If empty string, make it a parsable json object" one.
Line 31 in b65f2da
options = vjs.JSON.parse(options || '{}'); |
Thank you for your quick response! Yes, that's what exactly my situation is. Because a few of my scripts refer the Player instance, not sure who to be the first. Therefore I am having the option in data-setup. |
Thanks! This looks good to me, so we should pull this into the next release. |
Thanks! |
Good to go for this week's release. |
Merged in. Thank you! |
Thank you! |
Because only
vjs.autoSetup
picks the option fromdata-setup
, this attribute will be ignored if the initialization is called before that. Sometimes I face this issue and options indata-setup
are ignored, so I madePlayer.getTagSetting
pick the option fromdata-setup
as well.