Skip to content

Commit f46d5a0

Browse files
committed
Remove the quality button when no options are available
1 parent 42dc804 commit f46d5a0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/quality/quality.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Object.assign(mejs.MepDefaults, {
2020
* @type {String}
2121
*/
2222
qualityText: null,
23+
/**
24+
* @type {boolean}
25+
*/
26+
removeQualityButtonWhenNoOptions: false,
2327
/**
2428
* @type {boolean}
2529
*/
@@ -126,6 +130,14 @@ Object.assign(MediaElementPlayer.prototype, {
126130
t.generateQualityButton(t, player, media, qualityMap, currentQuality);
127131
}
128132
}
133+
134+
// Remove the button when no qualities are available
135+
if (t.options.removeQualityButtonWhenNoOptions) {
136+
const qualityLabels = player.qualitiesContainer.querySelectorAll(`.${t.options.classPrefix}qualities-selector-label`);
137+
if (qualityLabels.length <= 1) {
138+
t.cleanquality(player);
139+
}
140+
}
129141
});
130142

131143
t.generateQualityButton(t, player, media, qualityMap, currentQuality);

0 commit comments

Comments
 (0)