Youtube "short" videos type embedding/oneboxing not working

Hi!

Youtube video embedding works on my forums, but not short videos (those with /shorts/ in the URL) like this one:

The onebox request returns a 404 error.

Regular youtube video embedding works.
I don’t encounter this issue on try.discourse or meta.
I suppose it comes from a site setting not properly configured.

Any clue?


Youtube oneboxing is something custom we created. Someone needs to submit a #pr-welcome for shorts compatibility. Moving to #feature

In the meantime you can always add the manual iframe URL to the allowed iframes site setting:

It’s a tall one tho :rofl:

2 Likes

Maybe it’s because of the location of the server, like it was/is here Youtube embeddings have stopped working for servers in Europe

1 Like

Thanks for the clarification!

Could you just tell me what URL should I add in allowed iframes in order to have the video shown as you did? It would perfectly do the job for now, even if it’s tall indeed.


As for the video height, it’s possible to make it less tall by setting a max-height with CSS on the iframe. The issue is that the iframe has no attribute of any kind that specify that it’s a short (vertical) vidéo. :confused:

<iframe width="672" height="1194" src="https://www.youtube.com/embed/SWeTMdyv50Q" frameborder="0" allowfullscreen="">

https://www.youtube.com/embed/

Thank you Falco.

I guess I’m going close, but I’m still a bit confused.

So, I’ve added this URL in the allowed iframes.

But then, what should I do in order to make the video appear?

If I write in my post https://www.youtube.com/shorts/SWeTMdyv50Q, it won’t work.
If I write <iframe>https://www.youtube.com/shorts/SWeTMdyv50Q</iframe>, it won’t work.
If I write https://www.youtube.com/embed/SWeTMdyv50Q, it will work, but will display the short video with standard youtube video width/height ratio (which is OK for me, though I’d prefer having another ratio and not having to manually write “embed” in the URL):

Right click a shorts video and select “Copy embed code”. That is what I meant by “manual embed code”, sorry I wasn’t clear.

2 Likes

Also, replacing /shorts/ by watch?v=, the default URL of a Youtube video, works.

So, in youtube, on https://www.youtube.com/shorts/SWeTMdyv50Q, doing right click → Copy video URL will work since it returns https://youtu.be/SWeTMdyv50Q which is correctly displayed on Discourse (with the regular wide ratio though).

1 Like