Bug #86950
openstyles.content.textmedia.maxW TypoScript constant not valid for Youtube videos
Added by Sergio Catalá over 5 years ago. Updated almost 2 years ago.
0%
Description
Using TYPO3 8.7 core.
It seems TypoScript constant styles.content.mediatext.maxW is respected for Text+Media content elements that attach images, but not for Youtube videos. A large image is scaled to that maximum width. However, a Youtube video has always maximum width 480px for the frame, even if you set the maximum width larger. Has anyone experienced this issue?
I tested it over TYPO3 9.5 and 8.7 cores.
Updated by Sergio Catalá over 5 years ago
- Subject changed from maxWInText TypoScript setting not valid for Youtube videos to styles.content.textmedia.maxW TypoScript constant not valid for Youtube videos
Updated by Riccardo De Contardi over 5 years ago
I performed tests on TYPO3 8.7.22, 9.5.3 and latest master
My tests:
Test 1¶
1) put on TS Constants:
styles.content.textmedia.maxW = 300 styles.content.textmedia.maxWInText = 150
2) Create a CE Text and Media
3) put in it a "media by URL (e.g. https://www.youtube.com/watch?v=HmZKgaHa3Fg)
4) set Number of Columns = 1
Results¶
On both the cases:
- Position and Alignment: Above,center [0]
- Position and Alignment: Intext, Left [18]
the video box is resized to the dimensions specified in the constants.
Test 2¶
1) put on TS Constants:
styles.content.textmedia.maxW = 600 styles.content.textmedia.maxWInText = 600
2) Create a CE Text and Media
3) put in it a "media by URL (e.g. https://www.youtube.com/watch?v=HmZKgaHa3Fg)
4) set Number of Columns = 1
Results¶
On both the cases:
- Position and Alignment: Above,center [0]
- Position and Alignment: Intext, Left [18]
The video is resized with a width= 480px
Test 3¶
Same as test 2, but I set Width of each element (px) = 900px
Results:¶
Now the video box is resized to the dimensions specified in the constants.
It seems that 480px is a kind of "standard" dimension that is set if no width is specified on the media element field (imagewidth
).
Updated by Sergio Catalá over 5 years ago
I have the same results as you, Riccardo, except test 3.
I think you made a mistake there with the test?
Even if setup the constant as 900, the youtube video width is still 480px.
So that's a TYPO3 bug, or being a standard, we cannot keep the width larger?
Updated by Riccardo De Contardi over 5 years ago
@Sergio I repeated my last test on a different TYPO3 installation, brand new.
TS Constants:
styles.content.textmedia.maxW = 600 styles.content.textmedia.maxWInText = 600
- Add media element
- Add media by URL (e.g. https://www.youtube.com/watch?v=4voI_kMl8gs)
- [imagewidth] = 900px
- [imageorient] = above, Center (18)
Maybe I explained myself badly: 900px is a value set in the content element created (Media Adjustments >
Width of each element (px)[imagewidth])
Results:¶
The video box is resized with a width of 600px
About the "magic" 480px value I don't know... I was not able to find where it comes from so far.
Updated by Sergio Catalá over 5 years ago
Ok, I misunderstood.
I never do my tests setting up the width over the content element. I only change the TypoScript constant.
This is precisely what I'm interested in: where this 480px comes from. It seems that if we setup the constant larger than '480', it doesn't take any effect.
Updated by Riccardo De Contardi over 5 years ago
As far as I have seen, the dimensions 480x270 (which are the default dimensions for youtube videos) are written in the database sys_file_metadata table when you create a youtube record.
Updated by Sergio Catalá over 5 years ago
And is that ok, Riccardo? Or a bug from core?
As far as I can see, dimensions cannot be changed inside metadata of .youtube file through Filelist module in BE.
Updated by Riccardo De Contardi over 5 years ago
Honestly, I don't know... sorry
Updated by Christian Eßl almost 5 years ago
- Category set to Fluid Styled Content
Updated by Alexander Vogt over 4 years ago
This issue occurs because of the youtube default dimensions in sys_file_metadata. The dimesions are fetched through the youtube oEmbed api (e.g. https://www.youtube.com/oembed?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIy3AoaEQoyQ&format=json). This api always returns a width of 480px and a height of 270px. So the sys_file_metadata record of a youtube sys_file has always this dimensions.
Online media metadata extractor:
https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.13/typo3/sysext/core/Classes/Resource/OnlineMedia/Metadata/Extractor.php#L87-L92
YouTube helper oembed api call:
https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.13/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/YouTubeHelper.php#L100-L107
The rendering of a textmedia content element is based on the sys_file_metadata dimensions. The GalleryProcessor will never calculate bigger dimensions than 480x270px.
GalleryProcessor (used for textmedia content rendering):
https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.13/typo3/sysext/frontend/Classes/DataProcessing/GalleryProcessor.php#L453
Updated by Michael Sollmann almost 3 years ago
Can confirm this with TYPO3 10. The dimensions of a video should not be fetched or should be editable in the BE.
Updated by Susanne Moog about 2 years ago
- Sprint Focus set to On Location Sprint
Updated by Oliver Hader almost 2 years ago
- Sprint Focus deleted (
On Location Sprint)