GithubHelp home page GithubHelp logo

Comments (12)

kopepasah avatar kopepasah commented on June 8, 2024

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.

westonruter avatar westonruter commented on June 8, 2024

@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.

kopepasah avatar kopepasah commented on June 8, 2024

@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.

westonruter avatar westonruter commented on June 8, 2024

@kopepasah but I don't think we have the width and height of the embed.

from wp-core-media-widgets.

melchoyce avatar melchoyce commented on June 8, 2024

Related: https://core.trac.wordpress.org/ticket/31139

from wp-core-media-widgets.

melchoyce avatar melchoyce commented on June 8, 2024

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.

westonruter avatar westonruter commented on June 8, 2024

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.

westonruter avatar westonruter commented on June 8, 2024

This is still not working right for external hosted embeds.

Vimeo:

image

YouTube:

image

from wp-core-media-widgets.

kopepasah avatar kopepasah commented on June 8, 2024

@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.

westonruter avatar westonruter commented on June 8, 2024

@kopepasah I'm not getting overflow anymore. Where do you see it?

from wp-core-media-widgets.

westonruter avatar westonruter commented on June 8, 2024

See also padding-bottom hack in WordPress/gutenberg#721

from wp-core-media-widgets.

kopepasah avatar kopepasah commented on June 8, 2024

@westonruter my mistake, this is working as expected.

from wp-core-media-widgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.