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

fix: ensure the default ID of the first player is 'vjs_video_3' as some people have relied on this #6216

Merged
merged 4 commits into from
Sep 5, 2019

Conversation

misteroneill
Copy link
Member

@misteroneill misteroneill commented Sep 5, 2019

Description

When a player is created without an id on the embed code, Video.js automatically assigns it one based on an auto-incrementing number (a.k.a. a GUID). For the longest time, this has happened to result in the default id of the first player being vjs_video_3.

It was never intended for users to rely on this value being consistent, but users do strange and inadvisable things.

PR #6103 had an unintended side effect in that it changed the default id to vjs_video_2, which we worry could affect some users of Video.js.

Specific Changes proposed

  • Increment the internal starting point of the GUID from 1 to 3.
  • Avoid doing anything that increments the GUID simply by including Video.js on the page.
  • Add a test that simulates the initial player creation by resetting the GUID to its initial value to verify that the first player created has its id assigned as vjs_video_3.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
  • Reviewed by Two Core Contributors

@misteroneill
Copy link
Member Author

This should probably be merged to a branch off of 7.6.4 as that's what I based this branch on.

@misteroneill misteroneill changed the base branch from master to 7.6.x September 5, 2019 16:37
Copy link
Contributor

@brandonocasey brandonocasey left a comment

Choose a reason for hiding this comment

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

Code looks good, and from a test with data-setup and a player with no id this looks good. I wonder if we should have a sandbox page for data-setup so this can more easily be tested in the future

@misteroneill
Copy link
Member Author

Maybe, but data-setup wasn't involved here. The changes to setup.js are there to prevent the incrementing of the GUID before any players are created.

@brandonocasey
Copy link
Contributor

data-setup is just an easy way to force videojs to use a guid for a element with no id attribute.

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

Tested locally, works fine for manually created and data-setup cases.

@gkatsev gkatsev merged commit 5ff5569 into 7.6.x Sep 5, 2019
@gkatsev gkatsev deleted the fix/vjs_video_3 branch September 5, 2019 19:20
gkatsev pushed a commit that referenced this pull request Nov 7, 2019
…me people have relied on this (#6216)

When a player is created without an id on the embed code, Video.js automatically assigns it one based on an auto-incrementing number (a.k.a. a GUID). For the longest time, this has happened to result in the default id of the first player being vjs_video_3.

It was never intended for users to rely on this value being consistent, but users do strange and inadvisable things.

PR #6103 had an unintended side effect in that it changed the default id to vjs_video_2, which we worry could affect some users of Video.js.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants