Commit a077dc81 by Anton Stupak

Merge pull request #2352 from edx/anton/fix-persist-speed-per-video

Video: Fix speed persistence per video.
parents ec8a86f2 642c239a
......@@ -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
});
......
......@@ -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,
......
......@@ -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"
......@@ -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,
......
......@@ -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}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment