Skip to content

Commit

Permalink
fix(FEC-6855): auto video quality option added (#17)
Browse files Browse the repository at this point in the history
* fix(FEC-6855): auto video quality option added

* karma file rename

* player reference fix
  • Loading branch information
Dvir Hazout committed Aug 3, 2017
1 parent 041b21f commit 23989dd
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/components/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ class SettingsControl extends BaseComponent {
this.player.playbackRate = playbackRate;
}

onQualityChange(videoTrack: Object) {
this.player.selectTrack(videoTrack);
onQualityChange(videoTrack: Object | string) {
if (videoTrack === 'auto') {
this.player.enableAdaptiveBitrate();
}
else {
this.player.selectTrack(videoTrack);
}
}

getQualityOptionLabel(t: Object) {
Expand Down Expand Up @@ -99,10 +104,17 @@ class SettingsControl extends BaseComponent {
})
.map(t => ({
label: this.getQualityOptionLabel(t),
active: t.active,
active: !this.player.isAdaptiveBitrateEnabled() && t.active,
value: t
}));

qualityOptions
.unshift({
label: 'Auto',
active: this.player.isAdaptiveBitrateEnabled(),
value: 'auto'
});

return (
<div
ref={c => this._controlSettingsElement=c}
Expand Down

0 comments on commit 23989dd

Please sign in to comment.