Skip to content

Commit

Permalink
fix(plugin): add a quality getter
Browse files Browse the repository at this point in the history
  • Loading branch information
cboustead committed Oct 7, 2020
1 parent 03a04bf commit 13b8be9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ class HlsQualitySelectorPlugin {
setQuality(height) {
const qualityList = this.player.qualityLevels();

// Set quality on plugin
this._currentQuality = height;

if (this.config.displayCurrentQuality) {
this.setButtonInnerText(height === 'auto' ? height : `${height}p`);
}
Expand All @@ -170,6 +173,14 @@ class HlsQualitySelectorPlugin {
this._qualityButton.unpressButton();
}

/**
* Return the current set quality or 'auto';
* @returns {string} the currently set quality
*/
getCurrentQuality() {
return this._currentQuality || 'auto';
}

}

/**
Expand Down

0 comments on commit 13b8be9

Please sign in to comment.