[wp-trac] [WordPress Trac] #28190: Support for mediaelement.js YouTube sources in the video shortcode does not work in TinyMce
WordPress Trac
noreply at wordpress.org
Mon May 12 07:48:00 UTC 2014
#28190: Support for mediaelement.js YouTube sources in the video shortcode does not
work in TinyMce
--------------------------+-----------------------------------------
Reporter: Fab1en | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.0
Component: Media | Version: 3.9
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: javascript, administration
--------------------------+-----------------------------------------
Comment (by Fab1en):
Thanks lukecarbis for this patch. Detecting youtube video using the mime
type is cleaner than parsing the url, this should be the way to do it in
all other places, and would allow easier addition for other providers
(Vimeo, Dailymotion, ...).
I have also seen the Javascript error you mentioned. I managed to
understand from where it comes from : the javascript code is executed by
the MediaElementJS flash bridge to create a javascript event. (see line
1020 in src/flash/FlashMediaElement.as
https://github.com/johndyer/mediaelement/blob/master/src/flash/FlashMediaElement.as#L1020
of MediaElementJS source code). The flash code assumes that `mejs` is a
global var holding the library, but inside TinyMce iframe this global var
is not defined. You can remove the javascript error by executing the
following code in the console before inserting the shortcode :
{{{
window.frames[0].mejs = mejs
}}}
But this will not remove the youtube video display issue. This issue is
caused by something else. You can see by inspecting the generated DOM that
MEJS control bar is present but empty. Something must prevent controls
from being generated, but I could not determine what. Perhaps nesting
iframes raise an issue ? Or perhaps it is a race condition between youtube
iframe loading and tinyMce iframe ?
The youtube video play control is displayed by the youtube iframe, so it
cannot be removed. It is also present in the well generated mejs player
that shows when you click on the edit button of the video shortcode.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28190#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list