Skip to content

Commit

Permalink
Video captions (#3694)
Browse files Browse the repository at this point in the history
* show captions on videos

* support credits on videoAdvanced, for parity with images
  • Loading branch information
erikdesjardins committed Dec 1, 2016
1 parent 2c720db commit 6942e2b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/core/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export type VideoMedia = {|
type: 'VIDEO',
title?: string,
caption?: string,
credits?: string,
sources: Array<{|
source: string,
reverse?: string,
Expand Down
1 change: 1 addition & 0 deletions lib/css/modules/_showImages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ body:not(.res-showImages-displayImageCaptions) {
.res-showImages-captionsPosition {
@at-root {
.res-image,
.video-advanced,
.res-gallery {
display: inline-flex;
flex-direction: column;
Expand Down
7 changes: 4 additions & 3 deletions lib/modules/showImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,7 @@ function videoAdvanced(options) {
element.appendChild(player);

const vid: HTMLVideoElement = (player.querySelector('video'): any);
const container: HTMLElement = (player.querySelector('.video-advanced-container'): any);

const msgError = element.querySelector('.video-advanced-error');

Expand Down Expand Up @@ -2029,9 +2030,9 @@ function videoAdvanced(options) {
setMediaMaxSize(vid);
makeMediaZoomable(vid);
setMediaControls(vid, undefined, options.sources[0].source);
makeMediaMovable(player);
keepMediaVisible(player);
makeMediaIndependentOnResize(element, player);
makeMediaMovable(container);
keepMediaVisible(container);
makeMediaIndependentOnResize(element, container);

return element;
}
Expand Down
9 changes: 9 additions & 0 deletions lib/templates/videoAdvanced.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<div class="video-advanced">
{{#title}}
<h4 class="res-title">{{title}}</h4>
{{/title}}
{{#caption}}
<div class="res-caption">{{{caption}}}</div>
{{/caption}}
{{#credits}}
<div class="res-credits">{{{credits}}}</div>
{{/credits}}
<div class="video-advanced-container">
{{^controls}}
<a class="noKeyNav" href="{{href}}" {{#openInNewWindow}}target="_blank" rel="noopener noreferrer"{{/openInNewWindow}}>
Expand Down

0 comments on commit 6942e2b

Please sign in to comment.