Add file attachment thumbnails for video files.

Review Request #10934 — Created March 2, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

This implements a new VideoMimetype handler for all video/* files,
which provide a browser-supplied thumbnail for uploaded videos. This
handler will generate an HTML thumbnail that sets up a <video> tag
starting 0.5 seconds into the video, prompting the browser to load
enough of the video to display an early frame and to stop. The video is
set to not auto-play, to mute audio, and to preload only metadata along
with the frame.

When hovering over the thumbnail, the RB.FileAttachmentThumbnailView
will look for a <video> tag and play the video on loop, instead of
scrolling the frame. When the mouse moves away, the video will pause,
but retain the current position within the video for later resuming.

This does a lot to help video files not appear so blank. There is room
for improvement. For instance, if the video file cannot be played by the
browser, or it can only play audio but not the video, then the thumbnail
will appear blank. This is no different than it was before. Fixing it
would involve providing a poster="..." argument that points to an
image to display. However, for now, this is being left out, as this is
still an improvement over the existing behavior.

Tested with a bunch of videos (some that could be displayed, some that
could not). Verified that the browsers weren't downloading the entire
thing up-front.

Hovered over the thumbnail and saw it start playing. Moved away and
saw it pause. Hovered over again and saw it resume.

Tested in Chrome, Firefox, Edge, and Safari. Safari did not support
any of this for my test videos, but did not break.


Commits

Files

    Loading...