From 88ee6af4310c93e73950a2b0fd8c105678bda338 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Tue, 7 Mar 2017 13:52:51 -0500 Subject: [PATCH] fix(subs-caps-button): add hide threshold to subs-caps button (#4171) This is a followup from #4157 but for the subs-caps button. --- .../text-track-controls/subs-caps-button.js | 29 ++----------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/src/js/control-bar/text-track-controls/subs-caps-button.js b/src/js/control-bar/text-track-controls/subs-caps-button.js index 3ce40b803..e9138a39d 100644 --- a/src/js/control-bar/text-track-controls/subs-caps-button.js +++ b/src/js/control-bar/text-track-controls/subs-caps-button.js @@ -40,33 +40,6 @@ class SubsCapsButton extends TextTrackButton { return `vjs-subs-caps-button ${super.buildWrapperCSSClass()}`; } - /** - * Update caption menu items - * - * @param {EventTarget~Event} [event] - * The `addtrack` or `removetrack` event that caused this function to be - * called. - * - * @listens TextTrackList#addtrack - * @listens TextTrackList#removetrack - */ - update(event) { - let threshold = 2; - - super.update(); - - // if native, then threshold is 1 because no settings button - if (this.player().tech_ && this.player().tech_.featuresNativeTextTracks) { - threshold = 1; - } - - if (this.items && this.items.length > threshold) { - this.show(); - } else { - this.hide(); - } - } - /** * Create caption/subtitles menu items * @@ -78,6 +51,8 @@ class SubsCapsButton extends TextTrackButton { if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks)) { items.push(new CaptionSettingsMenuItem(this.player_, {kind: this.label_})); + + this.hideThreshold_ += 1; } items = super.createItems(items, SubsCapsMenuItem);