Comments (12)
Since we have the width and height of the video before it is rendered on the page, we can use PHP to calculate a padding we can add to the top of the .wp-video
class and add a small amount of styles to accommodate for the changes.
We would only want to do this when MediaElement.js
is not used and should not affect the output when it (MediaElement.js
) is enabled again.
Alternatively, we can also do this post-render with JavaScript (but that seems unnecessary since we already have the dimensions).
As a plus, this would also make the video
responsive in the process. 🤓
from wp-core-media-widgets.
@kopepasah do we have the width and height of the video? I don't think we do and that's the root of the problem here. There's no utility in WordPress for obtaining the dimensions of an uploaded video as far as I know. That being said, an oEmbed response will include the width/height so we can actually add the width
/height
to the model props. But, we don't know the dimensions of the resulting destination where the video is going to be placed. This is why in the first screenshot you can see the video is overflowing the sidebar container. So that's why I was thinking of some max-width
style, but this won't preserve the original aspect ratio when a height
is also defined.
from wp-core-media-widgets.
@westonruter I should have wrote, "Since we have the width and height of the embed". We can use those fit the video within its container, as described above.
from wp-core-media-widgets.
@kopepasah but I don't think we have the width and height of the embed.
from wp-core-media-widgets.
Related: https://core.trac.wordpress.org/ticket/31139
from wp-core-media-widgets.
What if the video always had a height of 253 x 142 (scaled down from 512 x 288 to fit the customizer sizebar)? Anything 4:3, or using non-standard dimensions, can have black bars around the edges.
from wp-core-media-widgets.
The problem is fitting a video in the frontend sidebar, not the customizer controls pane. I think the combination of #124 and #116 (changing preload
to metadata
) will resolve the issue mostly.
from wp-core-media-widgets.
This is still not working right for external hosted embeds.
Vimeo:
YouTube:
from wp-core-media-widgets.
@westonruter sorry for the delayed reply.
I am still getting an overflow in the <video>
element. Was your commits supposed to address this element as well?
from wp-core-media-widgets.
@kopepasah I'm not getting overflow anymore. Where do you see it?
from wp-core-media-widgets.
See also padding-bottom
hack in WordPress/gutenberg#721
from wp-core-media-widgets.
@westonruter my mistake, this is working as expected.
from wp-core-media-widgets.
Related Issues (20)
- Update "Change [Media]" button to "Replace [Media]"
- Narrow date inputs in the media library
- Warning on WP_Widget_Media::display_media_state() HOT 2
- VideoPress Uploads Not Functioning HOT 19
- Change "Select [Media] HOT 2
- Change "Select [Media]" to "Add [Media]"
- Widgets added/removed using Appearance > Widgets did not reflect in Customizer HOT 5
- Media widget placeholder box looks like a dropzone HOT 6
- .mov Video doesn't play on frontend HOT 13
- Confirm compatibility with Jetpack's Widget Visibility HOT 2
- Implement playlist widget HOT 1
- How can I add extra buttons to the Text Widget editor. HOT 1
- Add a background behind image widget images if they aren't full width HOT 2
- Default to "custom URL" in the image widget HOT 2
- TypeError: control.syncContainer is undefined HOT 5
- Columns in gallery widget preview do not match the frontend HOT 2
- Ensure core themes have styling compatibilities for gallery widgets HOT 1
- Clicking empty gallery placeholder opens manage frame instead of select frame HOT 7
- Resizing of local video in accordion HOT 2
- Option for post/page/external links? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-core-media-widgets.