#105671youtube shorts width/height landscape, portrait needed (after backend upload)
Description
one of my editors has added a youtube short to his user_upload and the with/height gets wromg: it’s landscape, not portrait. when manually I changed width and height of this video in sys_file_metadata, frontend renders perfect (I render with aspect-ratio in the news single template:
<f:variable name="videowidth">{mediaElement.originalResource.properties.width}</f:variable>
<f:variable name="videoheight">{mediaElement.originalResource.properties.height}</f:variable>
<!-- width:{videowidth},height:{videoheight}-->
<div class="mediaelement-video" style="--aspect-ratio: {videowidth}/{videoheight};">
<f:media file="{mediaElement}" style="max-width:100%;"/>
</div>
Could somebody have a look?
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[BUGFIX] youtube shorts width/height landscape, portrait needed (after backend upload) Resolves: #105671 Releases: main
History 5
-
Riccardo De Contardi commented <span data-processor="relativetime" data-value="2024-11-22T14:24:14+00:00" > 11/22/24, 14:24 </span>
-
Garvin Hicking commented and changed category status
NewNeeds Feedback <span data-processor="relativetime" data-value="2024-12-05T07:38:03+00:00" > 12/05/24, 07:38 </span>Could you maybe give the youtube URL that you used for better reproducing this?
-
Benni Mack commented and changed status
Needs FeedbackClosed <span data-processor="relativetime" data-value="2025-03-23T21:50:40+00:00" > 03/23/25, 21:50 </span>Closing this issue due to lack of feedback after 90 days. If you feel this is the wrong decisiom, let me know, so I will re-open the issue.
-
Philipp Kitzberger commented <span data-processor="relativetime" data-value="2026-01-16T15:28:43+00:00" > 01/16/26, 15:28 </span>
Even though there’s support for shorts since #98600 the dimension data fetched from YouTube is wrong. That’s due to the fact that the non-short-URL is being used to fetch the meta data.
Example-Short: https://www.youtube.com/shorts/NpTFUpMsrMU
TYPO3 uses this URL to fetch its meta data: https://www.youtube.com/oembed?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DNpTFUpMsrMU&format=json&maxwidth=2048&maxheight=2048
{ "title": "Those who bought a Tesla before they knew", "author_name": "Josh Johnson", "author_url": "https://www.youtube.com/@JoshJohnsonComedy", "type": "video", "height": 1152, "width": 2048, "version": "1.0", "provider_name": "YouTube", "provider_url": "https://www.youtube.com/", "thumbnail_height": 360, "thumbnail_width": 480, "thumbnail_url": "https://i.ytimg.com/vi/NpTFUpMsrMU/hqdefault.jpg", "html": "<iframe width=\"2048\" height=\"1152\" src=\"https://www.youtube.com/embed/NpTFUpMsrMU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen title=\"Those who bought a Tesla before they knew\"></iframe>" }That’s a weird ratio for a portrait video.
But when we tweak that URL and use the “short URL” instead (https://www.youtube.com/oembed?url=https://www.youtube.com/shorts/NpTFUpMsrMU) we get this response:
{ "title": "Those who bought a Tesla before they knew", "author_name": "Josh Johnson", "author_url": "https://www.youtube.com/@JoshJohnsonComedy", "type": "video", "height": 200, "width": 113, "version": "1.0", "provider_name": "YouTube", "provider_url": "https://www.youtube.com/", "thumbnail_height": 360, "thumbnail_width": 480, "thumbnail_url": "https://i.ytimg.com/vi/NpTFUpMsrMU/hq2.jpg", "html": "<iframe width=\"113\" height=\"200\" src=\"https://www.youtube.com/embed/NpTFUpMsrMU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen title=\"Those who bought a Tesla before they knew\"></iframe>" }As you can see this now provides the correct height/width parameters.
I’d say we reopen this issue and tweak YouTubeHelper->getOEmbedUrl() to use different URL parameters for regular and short videos.
-
Garvin Hicking commented and changed status
ClosedAccepted <span data-processor="relativetime" data-value="2026-01-16T16:19:34+00:00" > 01/16/26, 16:19 </span>Thanks for the helpful info. Re-opening!
Is this related? #86950 or a different issue?