-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Apply aspect ratio from video #211
Comments
Assuming you are using <ReactPlayer
url='http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
playing
width='auto'
height='auto'
fileConfig={{ attributes: { style: {
display: 'block',
width: 'auto',
height: 'auto'
}}}}
/> This does seems a bit hacky so perhaps the width and height of the |
@jjperezaguinaga Yeah all React fiddles made from the old base fiddle (before Here's an updated fiddle (note how the |
Great, looks really nice! And if I had one dollar for every jsfiddle that I've broken over the past years 🙈 |
I tried this with |
@sedubois The If you know the aspect ratio you want for the video, you can use a responsive wrapper as described here. The jsFiddle example there is also broken thanks to |
Thanks for the quick reply! CSS is dark magic for me, but I got something working: export default ({ url }) => (
<div
css={{
display: `flex`,
minHeight: `100vh`,
background: `black`,
}}
>
<div
css={{
width: `90%`,
maxWidth: 1000,
margin: `auto`,
}}
>
<div
css={{
position: `relative`,
paddingTop: `56.25%`,
}}
>
<ReactPlayer
url={url}
width="100%"
height="100%"
css={{
position: `absolute`,
top: 0,
left: 0,
}}
/>
</div>
</div>
</div>
) |
Related to #145: It would be nice if you could tell the player to use the native video aspect ratio.
Once the video is available, it seems that the readonly props
videoHeight
andvideoWidth
should be there, and then by measuring the ReactPlayer's parent element dimensions, the<video>
can be sized, or for smooth responsiveness thepadding-top
trick could be used to force a height if the width is a css-fixed value.The text was updated successfully, but these errors were encountered: