Feature #88442

Allow iframe / video (youtube) javascript loading with "defer"

Added by Christian Hackl about 2 years ago. Updated about 1 year ago.

Needs Feedback
Should have
Fluid Styled Content
Target version:
Start date:
Due date:
% Done:


Estimated time:
PHP Version:
fluid video defer
Sprint Focus:


Allow loading a video through a kind of "defer" loading.
For example, the f:media viewhelper with an additional attribute defer = "true".

This makes it necessary to include additional JavaScript, as described here:

This could potentially improve the load time of the website.


Updated by Christian Hackl about 2 years ago

  • Subject changed from Allow Iframe / Video javascript loading with "defer" to Allow iframe / video (youtube) javascript loading with "defer"

Updated by Christian Eßl over 1 year ago

This would be a very helpful addition.
Just recently I created a very similar solution by overriding the YouTubeRenderer, but other video media types would also benefit from this feature. I will try to create a patch later.


Updated by Christian Hackl over 1 year ago

my current solution is: https://extensions.typo3.org/extension/hh_video_extender/

currently not the best code, but it does what it should


Updated by Georg Ringer about 1 year ago

  • Status changed from New to Needs Feedback

this is already possible by default using

<f:media class="video-embed-item" file="{file}" width="{dimensions.width}" height="{dimensions.height}" alt="{file.alternative}" title="{file.title}" additionalConfig="{additionalAttributes:{defer:'defer'}}" />

is that solution ok for you?


Updated by Christian Eßl about 1 year ago

No, there is no native "defer" attribute for html videos, so the browser wouldn't know from that information alone, that the video needs to be "lazyloaded".
For doing so, you would also need to override the "src" attribute to something like "data-src" and handle the lazyloading logic, that replaces "data-src" with "src" in some custom javascript. Otherwise the src would always be fetched

Question is: Should the core viewhelper support that (to override the attribute name for "src") or should this not be done in the core and better be done by third-party extension code, that implement their own video viewhelper solutions?
Lazy loading videos is still a bit "tricky" to support all browsers and scenarios well enough.


Updated by Christian Hackl about 1 year ago

Yes, unfortunately you're right, especially now with all the privacy data stuff and the needed javascript.
Maybe it's not wise to put something like that into the core - it could be a bit tricky with the CookieConsent plugins, at least for users in the EU.
Hmm stupid... or?!

Also available in: Atom PDF