diff --git a/common/lib/xmodule/xmodule/js/fixtures/video_html5.html b/common/lib/xmodule/xmodule/js/fixtures/video_html5.html
index 4e2a9dba0a..c199efd959 100644
--- a/common/lib/xmodule/xmodule/js/fixtures/video_html5.html
+++ b/common/lib/xmodule/xmodule/js/fixtures/video_html5.html
@@ -4,7 +4,7 @@
diff --git a/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js b/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js
index 5f23f4338b..f9775d81aa 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js
@@ -4,7 +4,8 @@
var state,
oldOTBD,
playbackRates = [0.75, 1.0, 1.25, 1.5],
- describeInfo;
+ describeInfo,
+ POSTER_URL = '/media/video-images/poster.png';
beforeEach(function() {
oldOTBD = window.onTouchBasedDevice;
@@ -320,6 +321,15 @@
}).done(done);
});
});
+
+ describe('poster', function() {
+ it('has url in player config', function() {
+ expect(state.videoPlayer.player.config.poster).toEqual(POSTER_URL);
+ expect(state.videoPlayer.player.videoEl).toHaveAttrs({
+ poster: POSTER_URL
+ });
+ });
+ });
});
describe('non-hls encoding', function() {
@@ -338,6 +348,28 @@
jasmine.getEnv().describe(describeInfo.description, describeInfo.specDefinitions);
});
+ it('does not show poster for html5 video if url is not present', function() {
+ state = jasmine.initializePlayer(
+ 'video_html5.html',
+ {
+ poster: null
+ }
+ );
+ expect(state.videoPlayer.player.config.poster).toEqual(null);
+ expect(state.videoPlayer.player.videoEl).not.toHaveAttr('poster');
+ });
+
+ it('does not show poster for hls video if url is not present', function() {
+ state = jasmine.initializePlayer(
+ 'video_hls.html',
+ {
+ poster: null
+ }
+ );
+ expect(state.videoPlayer.player.config.poster).toEqual(null);
+ expect(state.videoPlayer.player.videoEl).not.toHaveAttr('poster');
+ });
+
it('native controls are used on iPhone', function() {
window.onTouchBasedDevice.and.returnValue(['iPhone']);
diff --git a/common/lib/xmodule/xmodule/js/src/video/02_html5_video.js b/common/lib/xmodule/xmodule/js/src/video/02_html5_video.js
index 49387481a8..367939e21a 100644
--- a/common/lib/xmodule/xmodule/js/src/video/02_html5_video.js
+++ b/common/lib/xmodule/xmodule/js/src/video/02_html5_video.js
@@ -44,8 +44,11 @@ function(_) {
* // video format of the source. Supported
* // video formats are: 'mp4', 'webm', and
* // 'ogg'.
+ * poster: Video poster URL
*
- * events: { // Object's properties identify the
+ * browserIsSafari: Flag to tell if current browser is Safari
+ *
+ * events: { // Object's properties identify the
* // events that the API fires, and the
* // functions (event listeners) that the
* // API will call when those events occur.
@@ -320,6 +323,11 @@ function(_) {
this.videoEl.prop('controls', true);
}
+ // Set video poster
+ if (this.config.poster) {
+ this.videoEl.prop('poster', this.config.poster);
+ }
+
// Place the