1. 1 : /**
  2. 2 : * @file caption-settings-menu-item.js
  3. 3 : */
  4. 4 : import TextTrackMenuItem from './text-track-menu-item.js';
  5. 5 : import Component from '../../component.js';
  6. 6 :
  7. 7 : /**
  8. 8 : * The menu item for caption track settings menu
  9. 9 : *
  10. 10 : * @extends TextTrackMenuItem
  11. 11 : */
  12. 12 : class CaptionSettingsMenuItem extends TextTrackMenuItem {
  13. 13 :
  14. 14 : /**
  15. 15 : * Creates an instance of this class.
  16. 16 : *
  17. 17 : * @param {Player} player
  18. 18 : * The `Player` that this class should be attached to.
  19. 19 : *
  20. 20 : * @param {Object} [options]
  21. 21 : * The key/value store of player options.
  22. 22 : */
  23. 23 : constructor(player, options) {
  24. 24 : options.track = {
  25. 25 : player,
  26. 26 : kind: options.kind,
  27. 27 : label: options.kind + ' settings',
  28. 28 : selectable: false,
  29. 29 : default: false,
  30. 30 : mode: 'disabled'
  31. 31 : };
  32. 32 :
  33. 33 : // CaptionSettingsMenuItem has no concept of 'selected'
  34. 34 : options.selectable = false;
  35. 35 :
  36. 36 : options.name = 'CaptionSettingsMenuItem';
  37. 37 :
  38. 38 : super(player, options);
  39. 39 : this.addClass('vjs-texttrack-settings');
  40. 40 : this.controlText(', opens ' + options.kind + ' settings dialog');
  41. 41 : }
  42. 42 :
  43. 43 : /**
  44. 44 : * This gets called when an `CaptionSettingsMenuItem` is "clicked". See
  45. 45 : * {@link ClickableComponent} for more detailed information on what a click can be.
  46. 46 : *
  47. 47 : * @param {EventTarget~Event} [event]
  48. 48 : * The `keydown`, `tap`, or `click` event that caused this function to be
  49. 49 : * called.
  50. 50 : *
  51. 51 : * @listens tap
  52. 52 : * @listens click
  53. 53 : */
  54. 54 : handleClick(event) {
  55. 55 : this.player().getChild('textTrackSettings').open();
  56. 56 : }
  57. 57 : }
  58. 58 :
  59. 59 : Component.registerComponent('CaptionSettingsMenuItem', CaptionSettingsMenuItem);
  60. 60 : export default CaptionSettingsMenuItem;