Add file attachment thumbnails for video files.
Review Request #10934 — Created March 2, 2020 and submitted
This implements a new
VideoMimetype
handler for allvideo/*
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 aposter="..."
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.
Summary | ID |
---|---|
cb769b722d88197aec23f9da2c5989a456a59fd9 |
Description | From | Last Updated |
---|---|---|
Col: 39 Missing semicolon. |
reviewbot | |
Can we fix the alignment here? |
david | |
Just a question about this line, Can we always assume that the video will be playing if this section doesn't … |
bui1 | |
Tackling onto the other comment, if the video ended up never playing and this_.playingVideo = true i.e if we tried … |
bui1 |
- Change Summary:
-
Fixed a missing semicolon.
- Commits:
-
Summary ID fe2ef00a0ad815a90e9545b4d25a7b150bb2ed9c a3ecb12c8f07174b21ddb248e6f3e61530815b84
Checks run (2 succeeded)
-
The code itself looks very good! Just had a couple questions.
-
Just a question about this line,
Can we always assume that the video will be playing if this section doesn't return a promise?What happens if we set
this._playingVideo = true;
but the video itself isn't playing? Then it would give a false positive -
Tackling onto the other comment, if the video ended up never playing and
this_.playingVideo = true
i.e if we tried to pause an already paused video, is there any implications to that?