Page MenuHomePhabricator

Allow video embed in remarkup
Closed, ResolvedPublic

Description

Is it possible to embed videos in remarkup in a similar way to how images can be dragged on to the editor?

Even if it is just the browsers built in HTML5 player, this would be a great feature!

Event Timeline

nateguchi2 raised the priority of this task from to Needs Triage.
nateguchi2 updated the task description. (Show Details)
nateguchi2 added a project: Remarkup.
nateguchi2 added a subscriber: nateguchi2.
epriestley added a subscriber: epriestley.

A while ago, we added support for the HTML5 <audio /> tag. We can take the same approach for <video />.

D7156 is the major change to look at. The fix will look something like:

  • Add isVideo() to PhabricatorFile.
  • When rendering a file, if it's a video, use a <video /> tag.
  • That might just work, or it might need some more tuning. <audio /> needed a couple of tweaks, I think. I haven't worked with <video /> before so I'm not sure what you're in for, but googling "HTML5 audio" worked pretty well for <audio />.

Some sort-of-related discussion in T6674.

Managed to get this working on our install, will bring together a Diff after testing.

  • We'll bring something similar to D11297 upstream.
  • T6674 discusses an issue where some mime types (notably, OGG) may ambiguously be audio or video. At a minimum, we'll provide {Fxxx, layout=video} or similar to force ambiguous types to render as a specific type. This may not really be much of a problem, but if we don't have an easy, reliable way to automatically detect whether a given .ogg file has video we aren't planning to put a tremendous amount of effort into detecting it correctly at this time.
epriestley triaged this task as Normal priority.

I have no idea if this is MP4 or not:

I think this one works:

Thanks to @nateguchi2 for doing a big chunk of the work.

I have no idea if this is MP4 or not:

F1679224 says it is 0 bytes, so nope!

Here's an ogg
Huzzah!

I believe this is now resolved and accounted for. See the remarkup documentation for some details.

If you've adjusted files.viewable-mime-types on your install, you may need to update it to add the new video MIME types. You may also want to review files.audio-mime-types: we now expect it to include video mime types that you want to enable media=audio for a particular type. You can compare the default values to what you've set to see what's missing.

Browser support for media formats varies, so not all browsers will be able to play all videos (for example, Safari can not play OGG by default).

I can imagine some future improvements to this feature:

  • Improve client side detection/fallback behavior when browsers don't support a given video format, so you get a nicer explicit error + option to download instead of a broken video?
  • Design some "video player" chrome so there's an easier way to get to the Fxxx page for the file to, e.g., download the file? (You can usually "View Raw" to get the monogram today.)
  • Support transcoding video between formats so you can upload an OGG and we can serve multiple sources, including MP4, so the video works in all browsers?

I'm not currently planning to pursue these since it's not clear if they're really useful (and transcoding is probably quite complicated). If you're interested in these features or run into issues, let us know.