From 389beedcf99c22abb41641c78bbcdaec8d154ea6 Mon Sep 17 00:00:00 2001 From: polesye Date: Mon, 28 Oct 2013 20:22:08 +0200 Subject: [PATCH] Fix speed change bug. --- .../xmodule/xmodule/js/src/video/03_video_player.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/lib/xmodule/xmodule/js/src/video/03_video_player.js b/common/lib/xmodule/xmodule/js/src/video/03_video_player.js index bce005230e..a9eeb2a073 100644 --- a/common/lib/xmodule/xmodule/js/src/video/03_video_player.js +++ b/common/lib/xmodule/xmodule/js/src/video/03_video_player.js @@ -62,6 +62,14 @@ function (HTML5Video, Resizer) { function _initialize(state) { var youTubeId; + // The function is called just once to apply pre-defined configurations + // by student before video starts playing. Waits until the video's metadata + // is loaded, which normally happens just after the video starts playing. + // Just after that configurations can be applied. + state.videoPlayer.ready = _.once(function () { + state.videoPlayer.onSpeedChange(state.speed); + }); + if (state.videoType === 'youtube') { state.videoPlayer.PlayerState = YT.PlayerState; state.videoPlayer.PlayerState.UNSTARTED = -1; @@ -314,6 +322,8 @@ function (HTML5Video, Resizer) { if (this.config.show_captions) { this.trigger('videoCaption.play', null); } + + this.videoPlayer.ready(); } function onUnstarted() { }