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

Use default aspect ratio for fluid players if width unknown #3614

Merged
merged 4 commits into from
Nov 3, 2016

Conversation

mister-ben
Copy link
Contributor

Description

If a player is fluid and does not have a width set, and preload is set to none, the height of the player is zero. This includes where preload is forced to none by mobile Chrome as in #3606.

Specific Changes proposed

  • If the player has the .vjs-fluid class when initialised, fluid is set to true, so adding the class behaves the same as {fluid: true} in the setup options.
  • The fluid(bool) setter calls player.updateStyleEl_(). Otherwise it won't be triggered in createEl() if an aspect ratio is not also set.
  • Corrects the test for a set videoWidth() in updateStyleEl_() - videoWidth() returns 0 if the width is unknown. This allows the default 16:9 to kick in rather than using 0:0.

Requirements Checklist

  • Feature implemented / Bug fixed
  • Docs/guides updated
  • Reviewed by Two Core Contributors

@@ -2848,6 +2850,10 @@ class Player extends Component {
const tagOptions = Dom.getElAttributes(tag);
const dataSetup = tagOptions['data-setup'];

if (Dom.hasElClass(tag, 'vjs-fluid')) {
Copy link
Member

Choose a reason for hiding this comment

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

should we add a test that verifies that if vjs-fluid class is available then player.fluid() returns true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that makes sense, added.

@gkatsev
Copy link
Member

gkatsev commented Sep 14, 2016

Sounds like a great idea.

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.

LGTM

@gkatsev
Copy link
Member

gkatsev commented Sep 15, 2016

Trying out the new Projects and reviewing for this PR.

@gkatsev gkatsev added the minor This PR can be added to a minor release. It should not be added to a patch release. label Sep 27, 2016
@gkatsev gkatsev added this to the 5.13 milestone Sep 27, 2016
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.

LGTM.
@mister-ben I think this could probably needs a rebase against master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed minor This PR can be added to a minor release. It should not be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants