diff --git a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js index b088cd5a1c..928808c06b 100644 --- a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js +++ b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js @@ -382,8 +382,10 @@ function (VideoPlayer, CookieStorage) { isTouch = onTouchBasedDevice() || '', storage = CookieStorage('video_player'), speed = storage.getItem('video_speed_' + id) || + el.data('speed') || storage.getItem('general_speed') || - el.data('speed').toFixed(2).replace(/\.00$/, '.0') || '1.0'; + el.data('general-speed') || + '1.0'; if (isTouch) { el.addClass('is-touch'); @@ -397,7 +399,7 @@ function (VideoPlayer, CookieStorage) { id: id, isFullScreen: false, isTouch: isTouch, - speed: speed, + speed: Number(speed).toFixed(2).replace(/\.00$/, '.0'), storage: storage }); diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index c6a698c5f2..9764066141 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -233,7 +233,8 @@ class VideoModule(VideoFields, XModule): 'id': self.location.html_id(), 'show_captions': json.dumps(self.show_captions), 'sources': sources, - 'speed': self.speed or self.global_speed, + 'speed': json.dumps(self.speed), + 'general_speed': self.global_speed, 'start': self.start_time.total_seconds(), 'sub': self.sub, 'track': track_url, diff --git a/lms/djangoapps/courseware/features/video.feature b/lms/djangoapps/courseware/features/video.feature index 39de72ba00..d040d8c86e 100644 --- a/lms/djangoapps/courseware/features/video.feature +++ b/lms/djangoapps/courseware/features/video.feature @@ -62,7 +62,8 @@ Feature: LMS.Video component And I reload the page When I open video "A" Then video "A" should start playing at speed "2.0" + And I select the "1.0" speed on video "A" When I open video "B" Then video "B" should start playing at speed "0.50" When I open video "C" - Then video "C" should start playing at speed "0.50" + Then video "C" should start playing at speed "1.0" diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index 21f9835c5c..e6a24154bd 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -66,7 +66,8 @@ class TestVideoYouTube(TestVideo): 'end': 3610.0, 'id': self.item_module.location.html_id(), 'sources': sources, - 'speed': 1.0, + 'speed': 'null', + 'general_speed': 1.0, 'start': 3603.0, 'sub': u'a_sub_file.srt.sjson', 'track': None, @@ -120,7 +121,8 @@ class TestVideoNonYouTube(TestVideo): 'end': 3610.0, 'id': self.item_module.location.html_id(), 'sources': sources, - 'speed': 1.0, + 'speed': 'null', + 'general_speed': 1.0, 'start': 3603.0, 'sub': u'a_sub_file.srt.sjson', 'track': None, @@ -201,7 +203,8 @@ class TestGetHtmlMethod(BaseTestXmodule): }, 'start': 3603.0, 'sub': u'a_sub_file.srt.sjson', - 'speed': 1.0, + 'speed': 'null', + 'general_speed': 1.0, 'track': None, 'youtube_streams': '1.00:OEoXaMPEzfM', 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', True), @@ -302,7 +305,8 @@ class TestGetHtmlMethod(BaseTestXmodule): 'end': 3610.0, 'id': None, 'sources': None, - 'speed': 1.0, + 'speed': 'null', + 'general_speed': 1.0, 'start': 3603.0, 'sub': u'a_sub_file.srt.sjson', 'track': None, diff --git a/lms/templates/video.html b/lms/templates/video.html index 44657671e9..2bf21478e4 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -20,6 +20,7 @@ data-save-state-url="${ajax_url}" data-caption-data-dir="${data_dir}" data-show-captions="${show_captions}" + data-general-speed="${general_speed}" data-speed="${speed}" data-start="${start}" data-end="${end}"