Source: lib/text/cue_region.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. goog.provide('shaka.text.CueRegion');
  7. /**
  8. * @export
  9. */
  10. shaka.text.CueRegion = class {
  11. constructor() {
  12. const CueRegion = shaka.text.CueRegion;
  13. /**
  14. * Region identifier.
  15. * @type {string}
  16. * @export
  17. */
  18. this.id = '';
  19. /**
  20. * The X offset to start the rendering area in viewportAnchorUnits of the
  21. * video width.
  22. * @type {number}
  23. * @export
  24. */
  25. this.viewportAnchorX = 0;
  26. /**
  27. * The X offset to start the rendering area in viewportAnchorUnits of the
  28. * video height.
  29. * @type {number}
  30. * @export
  31. */
  32. this.viewportAnchorY = 0;
  33. /**
  34. * The X offset to start the rendering area in percentage (0-100) of this
  35. * region width.
  36. * @type {number}
  37. * @export
  38. */
  39. this.regionAnchorX = 0;
  40. /**
  41. * The Y offset to start the rendering area in percentage (0-100) of the
  42. * region height.
  43. * @type {number}
  44. * @export
  45. */
  46. this.regionAnchorY = 0;
  47. /**
  48. * The width of the rendering area in widthUnits.
  49. * @type {number}
  50. * @export
  51. */
  52. this.width = 100;
  53. /**
  54. * The width of the rendering area in heightUnits.
  55. * @type {number}
  56. * @export
  57. */
  58. this.height = 100;
  59. /**
  60. * The units (percentage, pixels or lines) the region height is in.
  61. * @type {shaka.text.CueRegion.units}
  62. * @export
  63. */
  64. this.heightUnits = CueRegion.units.PERCENTAGE;
  65. /**
  66. * The units (percentage or pixels) the region width is in.
  67. * @type {shaka.text.CueRegion.units}
  68. * @export
  69. */
  70. this.widthUnits = CueRegion.units.PERCENTAGE;
  71. /**
  72. * The units (percentage or pixels) the region viewportAnchors are in.
  73. * @type {shaka.text.CueRegion.units}
  74. * @export
  75. */
  76. this.viewportAnchorUnits = CueRegion.units.PERCENTAGE;
  77. /**
  78. * If scroll=UP, it means that cues in the region will be added to the
  79. * bottom of the region and will push any already displayed cues in the
  80. * region up. Otherwise (scroll=NONE) cues will stay fixed at the location
  81. * they were first painted in.
  82. * @type {shaka.text.CueRegion.scrollMode}
  83. * @export
  84. */
  85. this.scroll = CueRegion.scrollMode.NONE;
  86. }
  87. };
  88. /**
  89. * @enum {number}
  90. * @export
  91. */
  92. shaka.text.CueRegion.units = {
  93. 'PX': 0,
  94. 'PERCENTAGE': 1,
  95. 'LINES': 2,
  96. };
  97. /**
  98. * @enum {string}
  99. * @export
  100. */
  101. shaka.text.CueRegion.scrollMode = {
  102. 'NONE': '',
  103. 'UP': 'up',
  104. };