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

Supporting automatic width and height like EmbedVideo 2.X did #26

Closed
D3nnis3n opened this issue Jun 26, 2022 · 12 comments
Closed

Supporting automatic width and height like EmbedVideo 2.X did #26

D3nnis3n opened this issue Jun 26, 2022 · 12 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@D3nnis3n
Copy link

D3nnis3n commented Jun 26, 2022

Hello,
EmbedVideo 2.0 supported the following:
<youtube alignment="center" width="100%" height="auto">ud_refZuQoA</youtube>
(or: {{#ev:youtube|id=ud_refZuQoA|alignment=center|width=100%|height=auto}})

This automatically centered the video and sized it fittingly to maximum width of its container, keeping a height that made sense for aspect ratio - unfortunately I have not found an equivalent that works in your cool updated version, hence putting this as feature request. Using the same ways in EmbedVideo 3.0 will lead to a extremely small video that ignores it is supposed to extend to full width and adjust its height.

image

Unfortunatley I can no longer use the older EmbedVideo, as it broke with some Update, throwing a Error: invalid magic word 'evt'.

For now I have manually set width to 1200, which unfortunately leads to weird height aspect ratios when using different sized screens, as width doesn't variably adjust.

image

^ This view it did via the instructions mentioned at the start by default, adjusting perfectly on mobile or changing the screen.

@D3nnis3n D3nnis3n added the enhancement New feature or request label Jun 26, 2022
@D3nnis3n D3nnis3n changed the title Supporting Centering like EmbedVideo 2.X did Supporting automatic width and height like EmbedVideo 2.X did Jun 26, 2022
@octfx
Copy link
Member

octfx commented Jun 26, 2022

I'll look into it! :)
Do you have a link to a live version?

@D3nnis3n
Copy link
Author

Hey,
that was a bit extremely fast response, I was still editing things.

Here you go:
https://wiki.play.eco/en/

@octfx
Copy link
Member

octfx commented Jun 26, 2022

So, I've checked the code and found the following:
Setting the width to 100% results in EmbedVideo using the value stored in $wgEmbedVideoDefaultWidth.
The check for is_numeric evaluates to false (this code part is taken verbatim from the original extension)

Since EmbedVideo v3, the global default width is changed to 320 from 640.
My first idea would be to try setting $wgEmbedVideoDefaultWidth = 640; and see if this helps.

But I'll check further if something is not working as intended!

@D3nnis3n
Copy link
Author

D3nnis3n commented Jun 26, 2022

I think the more interesting part is height="auto" - the width seems to be the expected 320, but height is not adjusting to fit.

I don't really know what's different, but width="100%" did actually lead to the container width being used (in my case 1200 on my screen size) and height="auto" made a good aspect ratio out of it. V3 just seems to default to the default width and probably a default height as well, as it does not try to make a viewable aspect ratio out of it. Weird. Not sure what magic V2 had hidden.

@octfx
Copy link
Member

octfx commented Jul 2, 2022

I can't fully re-create your issue on a local mediawiki installation.

Would you be able to create a test page on your wiki with the config mentioned in the first post?
(I've tried to create a page myself, but VE throws a captcha error for anonymous users)

@D3nnis3n
Copy link
Author

D3nnis3n commented Jul 5, 2022

Hey,
I'll be setting up such a page as soon as I get to it and inform you,

The captcha issue is indeed pretty problematic, but seems to be a MediaWiki bug. Unfortunately we can't turn it off, as that led to massive spam roll before: https://phabricator.wikimedia.org/T311449

@D3nnis3n
Copy link
Author

D3nnis3n commented Jul 11, 2022

Hey,
sorry it took so long, I added a test page here:
https://wiki.play.eco/de/EmbedVideoTest

image

As stated before, the top two implementations led to a video autosized for maximum width of the container it is in with a fitting height to keep a viewable height to width ratio instead of a really small bar, but I've never tested it outside of the front page box with limited width. So it may not have been working on normal pages that have no container with limited width.

If you want I can temporarily remove the captcha for you. We are currently hoping for a fix of the captcha, as without it we get around a hundred automated spam pages a day. Once I get time I'll probably disable the editing for unregistered people until a fix is available, but I need to get some minutes to get myself familiar with the configuration for that again.

@D3nnis3n
Copy link
Author

Have you been able to find anything new?

@octfx octfx added the help wanted Extra attention is needed label Aug 4, 2022
@octfx
Copy link
Member

octfx commented Aug 4, 2022

Sorry for the late reply! I'm somewhat time constrained atm.😕

This seems to be an issue with the auto resizer:
https://github.com/StarCitizenWiki/mediawiki-extensions-EmbedVideo/blob/master/resources/ext.embedVideo.js#L34

The problem is that I cant replicate the error using a local environment. I'll try to look at this in the following days, but if some other kind soul wants to take this on, I'd be more than happy!

@octfx
Copy link
Member

octfx commented Jan 27, 2023

@D3nnis3n this should be fixed in the upcoming release :)

@alistair3149
Copy link
Collaborator

In 3.2.0, you can use |autoresize=true to enable automatic sizing :) Closing the issue now.

@D3nnis3n
Copy link
Author

D3nnis3n commented Mar 26, 2024

Just saw this (way too late, sorry), thanks a lot!

Is there any way to use that in combination with a maximum height / width? Using autoresize=true seems to prevent width=640px to work? That was originally possible with the former extension - it allowed to have a default size that fits the preview image (or just the design) and have it scale down when mobile / small window.

You can again see how it looks like on the URL i posted originally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants