-
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
Use default aspect ratio for fluid players if width unknown #3614
Conversation
@@ -2848,6 +2850,10 @@ class Player extends Component { | |||
const tagOptions = Dom.getElAttributes(tag); | |||
const dataSetup = tagOptions['data-setup']; | |||
|
|||
if (Dom.hasElClass(tag, 'vjs-fluid')) { |
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.
should we add a test that verifies that if vjs-fluid
class is available then player.fluid()
returns true
?
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.
Yes that makes sense, added.
Sounds like a great idea. |
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.
LGTM
Trying out the new Projects and reviewing for this PR. |
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.
LGTM.
@mister-ben I think this could probably needs a rebase against master.
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
.vjs-fluid
class when initialised,fluid
is set totrue
, so adding the class behaves the same as{fluid: true}
in the setup options.fluid(bool)
setter callsplayer.updateStyleEl_()
. Otherwise it won't be triggered increateEl()
if an aspect ratio is not also set.videoWidth()
inupdateStyleEl_()
-videoWidth()
returns0
if the width is unknown. This allows the default16:9
to kick in rather than using0:0
.Requirements Checklist