diff options
Diffstat (limited to 'javascript/videojs/src/js/control-bar/text-track-controls/subtitles-button.js')
| -rw-r--r-- | javascript/videojs/src/js/control-bar/text-track-controls/subtitles-button.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/javascript/videojs/src/js/control-bar/text-track-controls/subtitles-button.js b/javascript/videojs/src/js/control-bar/text-track-controls/subtitles-button.js new file mode 100644 index 0000000..f7c530c --- /dev/null +++ b/javascript/videojs/src/js/control-bar/text-track-controls/subtitles-button.js @@ -0,0 +1,66 @@ +/** + * @file subtitles-button.js + */ +import TextTrackButton from './text-track-button.js'; +import Component from '../../component.js'; + +/** @import Player from '../../player' */ + +/** + * The button component for toggling and selecting subtitles + * + * @extends TextTrackButton + */ +class SubtitlesButton extends TextTrackButton { + + /** + * Creates an instance of this class. + * + * @param {Player} player + * The `Player` that this class should be attached to. + * + * @param {Object} [options] + * The key/value store of player options. + * + * @param {Function} [ready] + * The function to call when this component is ready. + */ + constructor(player, options, ready) { + super(player, options, ready); + + this.setIcon('subtitles'); + } + + /** + * Builds the default DOM `className`. + * + * @return {string} + * The DOM `className` for this object. + */ + buildCSSClass() { + return `vjs-subtitles-button ${super.buildCSSClass()}`; + } + + buildWrapperCSSClass() { + return `vjs-subtitles-button ${super.buildWrapperCSSClass()}`; + } +} + +/** + * `kind` of TextTrack to look for to associate it with this menu. + * + * @type {string} + * @private + */ +SubtitlesButton.prototype.kind_ = 'subtitles'; + +/** + * The text that should display over the `SubtitlesButton`s controls. Added for localization. + * + * @type {string} + * @protected + */ +SubtitlesButton.prototype.controlText_ = 'Subtitles'; + +Component.registerComponent('SubtitlesButton', SubtitlesButton); +export default SubtitlesButton; |
