WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#27915 closed defect (bug) (fixed)

Problems with subtitles and what should Tracks field really do?

Reported by: pavelevap Owned by: nacin
Milestone: 3.9.1 Priority: normal
Severity: major Version: 3.9
Component: Media Keywords: has-patch commit fixed-major
Focuses: javascript Cc:
PR Number:

Description

In "Video details" modal window, there is "Tracks" field at the bottom. Before I figured out that it is for tracks tag with kind attribute, I tried to wrote some description, but nothing happened on front end. Maybe this field should not be editable? Or some kind of help would be nice. Users are not developers.

I tried to add some subtitles and now there are two fields and I can edit both of them? See attached screenshot.

Tracks field should be available also for audio files?

I tried to upload .srt subtitle file but it is not allowed. But users usually know .srt files. #27643

I tried to add subtitles, but I had many .txt and .csv files in modal window. Why? There should be only supported formats available?

I was not able to add subtitles to my video file. After adding them and click "Update" they are not in shortcode and missing also from Tracks field.

Also after adding subtitle file to video, but it is not available in my video playlist? How can I add subtitles to my video playlist? And why should I set it on another place? When I add subtitles to my video, I want it to be saved also to Media library (as Featured image).

But in the end, I was not able to add subtitles to my video :-(

Attachments (3)

Tracks_field.jpg (15.5 KB) - added by pavelevap 6 years ago.
XO.vtt (186 bytes) - added by wonderboymusic 6 years ago.
27915.patch (1.3 KB) - added by azaozz 6 years ago.

Download all attachments as: .zip

Change History (18)

#1 @wonderboymusic
6 years ago

  • Focuses javascript added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.9.1

Yeah, the textarea is not supposed to be visible

#2 @wonderboymusic
6 years ago

The inside of the video shortcode is getting dropped when switching to the Text tab - not good.

#3 follow-up: @pavelevap
6 years ago

I was not able to add subtitles to video in any way, never inserted whatever I tried.

#4 in reply to: ↑ 3 @wonderboymusic
6 years ago

Replying to pavelevap:

I was not able to add subtitles to video in any way, never inserted whatever I tried.

Thanks for the clarification, but I'm just adding notes to the ticket.

#5 @wonderboymusic
6 years ago

In 28169:

Don't show textareas that have "hidden" as a class in the media modal.

See #27915.

#6 follow-up: @wonderboymusic
6 years ago

  • Severity changed from normal to major

So... this is a pretty serious issue...

I am going to need someone with more in-depth TinyMCE knowledge to help me, but I think there is a race condition happening.

Do the following:

  1. Insert a Video into a post
  2. Click to Edit
  3. Add Subtitles
  4. Click "Update"

If you don't see the CC logo in the video player, some weird race condition is happening that is causing the view to not re-render.

Edit the Video again: the subtitles are there in the modal, click Update. All seems to work. Sometimes, the race condition doesn't occur so the view rendered properly.

EVERY time though, when you click from Visual to Text, the shortcode drops its content, which is where the <track>s are stored. That may be false, but it seems to be what is happening. If you have a video shortcode, edit it (replace the video or something), and then click over to the Text tab, the shortcode is updated.

I even tested manually replacing the shortcode in the textarea #content on update (adding subtitles), but it always gets reverted to a [video] with no body when switching to Text mode.

@wonderboymusic
6 years ago

This ticket was mentioned in IRC in #wordpress-dev by wonderboymusic. View the logs.


6 years ago

#8 in reply to: ↑ 6 @azaozz
6 years ago

Replying to wonderboymusic:

EVERY time though, when you click from Visual to Text, the shortcode drops its content, which is where the <track>s are stored.

Caused by replacing the wpview wrapper <div> node with a <p> node in TinyMCE on getting the content/saving. The shortcode string together with any HTML that is wrapped in the shortcode gets added inside that <p> node. As <track> is not valid inside a <p>, it gets stripped by the internal cleanup in MCE.

Seems the way to fix it is to go back to replacing wpview wrappers on PostProcess with a regex. Patch coming up.

@azaozz
6 years ago

#9 @azaozz
6 years ago

  • Keywords needs-testing added

27915.patch fixes the removal of <track> tags wrapped in the shortcodes.

Still can't see the cc logo in the player inside the editor. Happens also on loading a post that has a proper [video]<track>[/video] shortcode. This seems minor compared to the removal of <track> on saving.

Last edited 6 years ago by azaozz (previous) (diff)

#10 @wonderboymusic
6 years ago

In 28183:

Persisting <track> elements as the body of a [video] shortcode in MCE Views:

  • When generating the view's HTML, ensure that the shortcode's content is added to the model
  • Add a PostProcess event in the wpview plugin to properly return the shortcode when the editor mode is toggled, ensuring that elements in the body are not dropped.

Props azaozz, wonderboymusic.
See #27915.

#11 @wonderboymusic
6 years ago

  • Keywords has-patch commit fixed-major added; needs-patch needs-testing removed

#12 @pavelevap
6 years ago

Nice, works well!

Added track field should be editable?

#13 @wonderboymusic
6 years ago

Yes, so you can change the language - each <track> is for a different language

#14 @pavelevap
6 years ago

OK, nice! Maybe this field (and all with URLs in this modal) could be a little bit longer, there is enough space... But nevermind, adding subtitles finally works!

#15 @nacin
6 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 28273:

Fix persistence of <track> elements in the body of a [video] shotcode in TinyMCE views.

Merges [28183] and [28169] to the 3.9 branch.

props azaozz, wonderboymusic.
fixes #27915.

Note: See TracTickets for help on using tickets.