When I try to insert a youtube video via the wysiwyg support I always get a video-tag. That naturally fails to display with the type="video/youtube".

  • This seems to occur as soon as the "video" display is activated in the display settings - regardless of it's the order of display methods (even is "youtube" occurs before "video").
  • This may be related to #2073001: Internet video sources fail with html5 video tags but only occurs with WYSIWYG - the visible result is the same though.
  • The same thing happens with both youtube and vimeo videos.
  • The media-browser popup fails to close after hitting submit on the media_format_form - although it succeeds in adding the video tag.

This bug occurs with various combinations of the file_entity, media and media_youtube modules including:
media-7.x-2.x-dev (current checkout)
file_entity-7.x-2.0-alpha3
media_youtube-7.x-2.0-rc4

Steps to reproduce

  1. Configure a file display mode that has only video and youtube video as activated. Video has a higher weight than youtube.
  2. In some wysiwyg enabled textfield: Add a youtube video using the previously configured display mode.

Expected result: The video is displayed as broken html tag in the wysiwyg preview (becaus youtube embed player doesn't work with wysiwyg) but when the form is saved and the field is displayed the youtube video is embedded.

Actual result: When the field is displayed it is still rendered as the video-tag.

The problem: If the file is rendered via the video display in wysiwyg it directly stores the video tag in the field-data instead of the media-tag.

CommentFileSizeAuthor
#7 wysiwyg_videos-2150455-7.patch1.12 KBmglaman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

torotil’s picture

Issue summary: View changes

Updated summary: happens also with vimeo videos, popup fails to close.

torotil’s picture

Issue summary: View changes
torotil’s picture

Title: WYSIWYG: youtube videos inserted as <video> tags » WYSIWYG: videos inserted as <video> instead of [[{media}]]
Issue summary: View changes

Added more precise steps to reproduce.

moonray’s picture

Still an issue.

A specific use case: jwplayer requires additional javascript added to a page with its videos. The javascript never gets added the way it is now and the videos won't work.

EDIT: This use case is with uploaded media, i.e. .flv or .mp4 files.

mglaman’s picture

The problem isn't adding the media tag, it's actually the fact element is being passed to WYSIWYG through Media. I haven't followed it through 100%, but it adds the HTML to the WYSIWYG which attaches the Media [{{media}}] tag into the textbox as well via a mapping array.

So, the solution is figuring out if TinyMCE (which I'm using) or other WYSIWYG can support displaying the element within itself, or making sure other filters aren't disrupting.

Another note:

tinyMCE.settings.extended_valid_elements provided:

extended_valid_elements: "img[!src|title|alt|style|width|height|class|hspace|vspace|view_mode|format|fid]"

I think trick is to add "video[!src|controls|class|view_mode|fid]"

mglaman’s picture

Title: WYSIWYG: videos inserted as <video> instead of [[{media}]] » WYSIWYG: videos inserted as <video>, excluded by rich text editor filters.

Updating title. After doing tests it is expected for media to insert HTML then process the macro on the WYSIWYG detach.

However, when manually invoking...

Drupal.wysiwyg.instances["edit-body-und-0-value"].insert('<img src="http://localhost/panopoly/profiles/panopoly/modules/panopoly/panopoly_theme/images/panopoly_icon_theme.png" />');

I get the expected Panopoly logo. However, swap that out for a video element, like:

Drupal.wysiwyg.instances["edit-body-und-0-value"].insert('<video controls="controls" data-fid="6" class="media-element file-default"><source src="http://localhost/panopoly/sites/default/files/AUTO_AWESOME_MOVIE_1_20131224_224656.mp4" type="video/mp4"></video>');

And the .insert does to add the HTML. I traced it back to

tinyMCE.execInstanceCommand(this.getInstanceId(), 'mceInsertContent', false, content);

I haven't had a chance to drop in the non-minified TinyMCE source code and see what's going on. Simply adding video to extended_valid_elements didn't seem to work.

mglaman’s picture

Status: Active » Needs review
FileSize
1.12 KB

Here is a patch that adds the extended valid elements to WYSIWYG for TinyMCE, ensuring that native video and audio can actually be inserted via Media.

moonray’s picture

Status: Needs review » Needs work

While this patch allows adding a <video> element, it still won't work for the use-case of #4.

Take a local video file uploaded that needs to use jwplayer to display. It'll output the HTML produced by the module, but never attach any of the js (attached through drupal_add_js() in jw_player_process_jw_player(). Normally this would be invoked every time the page loads, but since wysiwyg only outputs the HTML produced (and doesn't account for any of the js), we have a video that won't work aas expected.

Basically what needs to happen is that any code to display the video needs to be triggered on every page load to make it compatible with normal behavior (not through wysiwyg).

EDIT: basically we wind up with an HTML5 video element that can't use any JS-based fallback to Flash so it'll work for non-compatible browsers.

Chris Matthews’s picture

Status: Needs work » Closed (outdated)

Closing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team