Commit 24a63dad by Shrhawk

Merge pull request #6694 from edx/shr/bug/TNL-1202-HD-button-not-working-properly

Hd button on for default high resolutions
parents 132cadb5 44468f84
...@@ -92,6 +92,19 @@ ...@@ -92,6 +92,19 @@
qualityControl.el.click(); qualityControl.el.click();
expect(player.setPlaybackQuality).toHaveBeenCalledWith('large'); expect(player.setPlaybackQuality).toHaveBeenCalledWith('large');
}); });
it('quality control is active if HD is available',
function () {
player.getAvailableQualityLevels.andReturn(
['highres', 'hd1080', 'hd720']
);
qualityControl.quality = 'highres';
videoPlayer.onPlay();
expect(qualityControl.el).toHaveClass('active');
});
}); });
describe('constructor, HTML5 mode', function () { describe('constructor, HTML5 mode', function () {
......
...@@ -103,6 +103,7 @@ function () { ...@@ -103,6 +103,7 @@ function () {
// HD qualities are available, show video quality control. // HD qualities are available, show video quality control.
if (this.config.availableHDQualities.length > 0) { if (this.config.availableHDQualities.length > 0) {
this.trigger('videoQualityControl.showQualityControl'); this.trigger('videoQualityControl.showQualityControl');
this.trigger('videoQualityControl.onQualityChange', this.videoQualityControl.quality);
} }
// On initialization, force the video quality to be 'large' instead of // On initialization, force the video quality to be 'large' instead of
// 'default'. Otherwise, the player will sometimes switch to HD // 'default'. Otherwise, the player will sometimes switch to HD
...@@ -115,7 +116,6 @@ function () { ...@@ -115,7 +116,6 @@ function () {
function onQualityChange(value) { function onQualityChange(value) {
var controlStateStr; var controlStateStr;
this.videoQualityControl.quality = value; this.videoQualityControl.quality = value;
if (_.contains(this.config.availableHDQualities, value)) { if (_.contains(this.config.availableHDQualities, value)) {
controlStateStr = gettext('HD on'); controlStateStr = gettext('HD on');
this.videoQualityControl.el this.videoQualityControl.el
...@@ -141,6 +141,7 @@ function () { ...@@ -141,6 +141,7 @@ function () {
event.preventDefault(); event.preventDefault();
newQuality = isHD ? 'large' : 'highres'; newQuality = isHD ? 'large' : 'highres';
this.trigger('videoPlayer.handlePlaybackQualityChange', newQuality); this.trigger('videoPlayer.handlePlaybackQualityChange', newQuality);
} }
......
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