Bug #33090

New way to embed youtube videos

Added by Robert Heel over 3 years ago. Updated about 1 month ago.

Status:New Start date:2012-01-10
Priority:Must have Due date:
Assigned To:Benjamin Mack % Done:

0%

Category:HTML5 Spent time: -
Target version:7.4 (Backend)
TYPO3 Version:4.6 Is Regression:No
PHP Version:5.3 Sprint Focus:
Complexity:

Description

youtube has a new way to embed videos:

http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html

It automatically uses html5 if the device can't use flash. But it's not easy to integrate this in the current TYPO3 media element.

media_iframe.diff Magnifier (859 Bytes) Robert Heel, 2012-01-10 13:51

33090_media_iframe.diff Magnifier (872 Bytes) Robert Heel, 2012-01-12 13:08

youtube-video_forge-33090.patch Magnifier (1.3 kB) Stefan Neufeind, 2014-05-30 14:49

youtube-video_forge-33090_4.5.34.patch Magnifier - Youtube via iframe, against 4.5.34 (1.5 kB) Stefan Neufeind, 2014-08-08 08:14


Related issues

related to Core - Feature #25718: Support <iframe> inclusion for Media Content Element New 2011-04-01
related to Core - Bug #58569: Content element "media" does not render Youtube videos Resolved 2014-05-06
related to Core - Bug #44633: Media-element: Vimeo-video can not play via HTML5 New 2013-01-18
related to Core - Feature #61799: Improve the handling of media files Under Review 2014-09-22

History

#1 Updated by Robert Heel over 3 years ago

Attached a workaround which bypass the generation on youtube links.

#2 Updated by Robert Heel over 3 years ago

Added wmode=Opaque to avoid flash overlay

#4 Updated by Stefan Neufeind about 1 year ago

This is still an issue in latest TYPO3 CMS (6.2.3). Embedding by using an iframe seems to be the best way.
Here is a slightly different patch, patch also using an iframe.

Of course all these ways are just "hacks" to get it working for the moment. Imho we need to cleanly extend the concept of MediaProviders to fit the new needs - which here is APIs that need iframes and don't allow access to the videos directly anymore.

#5 Updated by Stefan Neufeind about 1 year ago

  • Tracker changed from Feature to Bug
  • Subject changed from New way to embed youtube videos with html5 to work on ipad to New way to embed youtube videos

#6 Updated by Markus Klein about 1 year ago

  • Is Regression set to No

I agree we need to restructure the Media Providers a lot. Currently you can only modify the path to videos within a provider. IMO a provider should be much more general. Meaning it should be capable of rendering the whole html output and providing also adequate fields in the backend. The html should be fluid based. A provider should be an adapter between the Core and the source API, like YouTube or Vimeo.

#7 Updated by Stefan Neufeind about 1 year ago

Could we maybe agree on some "hack" to get youtube working again with one of the next releases? I doubt that a full restructuring will arrive in the short run - and even then it would need a decision if such a "new" MediaProvider-interface can be introducted in the 6.2.x-branch.

#8 Updated by Markus Klein about 1 year ago

From what I saw, I can tell that after the current media provider parses and rewrites the youtube url it uses the default SWFOJECT rendering of cObj (object-embed HTML code)

I don't have time currently to take a closer look how we could "hack" that now to get an iframe in 6.2.

By the way: Youtube is NOT broken currently, after applying the fix https://review.typo3.org/29952

#9 Updated by Stefan Neufeind about 1 year ago

Oh yes, that patch went in after 6.2.3-release. I just tried it out. Works fine on a machine where you have Flash available. For things like an an ipad that of course fails - in contrast to the iframe-embededing directly from youtube (which detects HTML5-capable players).

#10 Updated by Markus Klein about 1 year ago

Yep of course. iframe player detection is much more intelligent!

#11 Updated by Stefan Neufeind 12 months ago

Attached is the same patch/hack for using Youtube via iframe, redone against 4.5.34

#12 Updated by Johannes C. Schulz 11 months ago

Is there some magic to do within the plugin? I patched my 6.2.4 but youtube in media-element remains SWFOBJECT ínstead of IFRAME.

#13 Updated by Stefan Neufeind 11 months ago

No magic involved. Then please check the source again. What URLs does the mediaprovider return for you, is the mode correctly set to iframe etc.?

#14 Updated by Johannes C. Schulz 11 months ago

My plugin-settings:
Medientyp: Video
HTML5: nein
Breite:
Höhe:
Darstellungstyp: auto
URL: http://youtu.be/anM5lsLPwPE

in MediaContentObject.php I've changed:

$urlRewritten = $mediaWizard->rewriteUrl($conf['file']);
                if( (strpos($urlRewritten, 'www.youtube.com') !== FALSE) || (strpos($urlRewritten, 'youtu.be') !== FALSE) ) {
                    $renderType = 'iframe';
                }

PageContent is:

<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/anM5lsLPwPE?fs=1" width="600" height="400" id="mmswf53fedb6e1c783" style="visibility: visible;"><param name="quality" value="high"><param name="menu" value="false"><param name="allowScriptAccess" value="sameDomain"><param name="allowFullScreen" value="true"><param name="wmode" value="opaque"></object>

There is no option "IFRAME" inside the plugin.

Johannes

#15 Updated by Stefan Neufeind 11 months ago

Well, you missed the second half of the patch ...

#16 Updated by Johannes C. Schulz 11 months ago

No ;-) - It's also there.

case 'iframe':
                $url = $urlRewritten;
                $width = $conf['parameter.']['mmWidth'] ?: '100%';
                $height = $conf['parameter.']['mmHeight'] ?: '100%';
                $frameBorderAttribute = ' style="border:0px"';
                // literally taken from EXT:news/Classes/MediaRenderer/Video/Youtube.php
                $content = '<div class="wrapper"><div class="h_iframe"><iframe width="' . $width . '" height="' . $height . '" src="' . htmlspecialchars($url) . '"' . $frameBorderAttribute . '></iframe></div></div>';
                break;

#17 Updated by Benjamin Mack 7 months ago

  • Assigned To set to Benjamin Mack
  • Target version set to 7.2 (Frontend)

#18 Updated by Markus Klein 7 months ago

See extension of Frans which shall be the new way to do it.
https://github.com/fsaris/fal_online_media_connector

#19 Updated by Benjamin Mack about 1 month ago

  • Target version changed from 7.2 (Frontend) to 7.4 (Backend)

Also available in: Atom PDF