Source: externs/shaka/text.js

  1. /**
  2. * @license
  3. * Copyright 2016 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /** @externs */
  18. /**
  19. * An interface for plugins that parse text tracks.
  20. *
  21. * @interface
  22. * @exportDoc
  23. */
  24. shakaExtern.TextParser = function() {};
  25. /**
  26. * A collection of time offsets used to adjust text cue times.
  27. *
  28. * @typedef {{
  29. * periodStart : number,
  30. * segmentStart : number,
  31. * segmentEnd : number
  32. * }}
  33. *
  34. * @property {number} periodStart
  35. * The absolute start time of the period in seconds.
  36. * @property {number} segmentStart
  37. * The absolute start time of the segment in seconds.
  38. * @property {number} segmentEnd
  39. * The absolute end time of the segment in seconds.
  40. *
  41. * @exportDoc
  42. */
  43. shakaExtern.TextParser.TimeContext;
  44. /**
  45. * Parse an initialization segment. Some formats do not have init
  46. * segments so this won't always be called.
  47. *
  48. * @param {!ArrayBuffer} data
  49. * The data that makes up the init segment.
  50. *
  51. * @exportDoc
  52. */
  53. shakaExtern.TextParser.prototype.parseInit = function(data) {};
  54. /**
  55. * Parse a media segment and return the cues that make up the segment.
  56. *
  57. * @param {!ArrayBuffer} data
  58. * The next section of buffer.
  59. * @param {shakaExtern.TextParser.TimeContext} timeContext
  60. * The time information that should be used to adjust the times values
  61. * for each cue.
  62. * @return {!Array.<!shaka.text.Cue>}
  63. *
  64. * @exportDoc
  65. */
  66. shakaExtern.TextParser.prototype.parseMedia = function(data, timeContext) {};
  67. /**
  68. * @typedef {function(new:shakaExtern.TextParser)}
  69. */
  70. shakaExtern.TextParserPlugin;
  71. /**
  72. * An interface for plugins that display text.
  73. *
  74. * @interface
  75. * @extends {shaka.util.IDestroyable}
  76. * @exportDoc
  77. */
  78. shakaExtern.TextDisplayer = function() {};
  79. /**
  80. * Append given text cues to the list of cues to be displayed.
  81. *
  82. * @param {!Array.<!shaka.text.Cue>} cues
  83. * Text cues to be appended.
  84. *
  85. * @exportDoc
  86. */
  87. shakaExtern.TextDisplayer.prototype.append = function(cues) {};
  88. /**
  89. * Remove cues in a given time range.
  90. *
  91. * @param {number} start
  92. * @param {number} end
  93. * @return {boolean}
  94. *
  95. * @exportDoc
  96. */
  97. shakaExtern.TextDisplayer.prototype.remove = function(start, end) {};
  98. /**
  99. * Returns true if text is currently visible.
  100. *
  101. * @return {boolean}
  102. *
  103. * @exportDoc
  104. */
  105. shakaExtern.TextDisplayer.prototype.isTextVisible = function() {};
  106. /**
  107. * Set text visibility.
  108. *
  109. * @param {boolean} on
  110. *
  111. * @exportDoc
  112. */
  113. shakaExtern.TextDisplayer.prototype.setTextVisibility = function(on) {};
  114. /**
  115. * A factory for creating a TextDisplayer.
  116. *
  117. * @typedef {function(new:shakaExtern.TextDisplayer)}
  118. * @exportDoc
  119. */
  120. shakaExtern.TextDisplayer.Factory;