@amazon/vinyl 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/dist/index.cjs +24 -6
  2. package/dist/index.cjs.map +2 -2
  3. package/dist/index.js +33 -13
  4. package/dist/index.js.map +3 -3
  5. package/dist/test/integ.es5.js +62 -62
  6. package/dist/test/integ.js +119 -6
  7. package/dist/test/integ.js.map +2 -2
  8. package/dist/types/current/ad/AdBreakInfo.d.ts +160 -0
  9. package/dist/types/current/ad/AdBreakInfo.d.ts.map +1 -0
  10. package/dist/types/current/ad/AdBreakInfo.js +5 -0
  11. package/dist/types/current/ad/AdController.d.ts +229 -0
  12. package/dist/types/current/ad/AdController.d.ts.map +1 -0
  13. package/dist/types/current/ad/AdController.js +19 -0
  14. package/dist/types/current/ad/AdControllerImpl.d.ts +162 -0
  15. package/dist/types/current/ad/AdControllerImpl.d.ts.map +1 -0
  16. package/dist/types/current/ad/AdControllerImpl.js +741 -0
  17. package/dist/types/current/ad/AdError.d.ts +6 -0
  18. package/dist/types/current/ad/AdError.d.ts.map +1 -0
  19. package/dist/types/current/ad/AdError.js +14 -0
  20. package/dist/types/current/ad/AdsProvider.d.ts +28 -0
  21. package/dist/types/current/ad/AdsProvider.d.ts.map +1 -0
  22. package/dist/types/current/ad/AdsProvider.js +5 -0
  23. package/dist/types/current/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
  24. package/dist/types/current/ad/defaultAdLoadOptionsResolver.d.ts.map +1 -0
  25. package/dist/types/current/ad/defaultAdLoadOptionsResolver.js +26 -0
  26. package/dist/types/current/ad/discoverHlsInterstitials.d.ts +22 -0
  27. package/dist/types/current/ad/discoverHlsInterstitials.d.ts.map +1 -0
  28. package/dist/types/current/ad/discoverHlsInterstitials.js +248 -0
  29. package/dist/types/current/drm/DrmControllerImpl.d.ts +6 -0
  30. package/dist/types/current/drm/DrmControllerImpl.d.ts.map +1 -1
  31. package/dist/types/current/drm/DrmControllerImpl.js +23 -1
  32. package/dist/types/current/playback/PlaybackControllerImpl.d.ts +1 -1
  33. package/dist/types/current/playback/createStallDetector.d.ts +43 -0
  34. package/dist/types/current/playback/createStallDetector.d.ts.map +1 -0
  35. package/dist/types/current/playback/createStallDetector.js +101 -0
  36. package/dist/types/current/playback/createStallMonitor.d.ts +45 -0
  37. package/dist/types/current/playback/createStallMonitor.d.ts.map +1 -0
  38. package/dist/types/current/playback/createStallMonitor.js +99 -0
  39. package/dist/types/current/streaming/AudioOptions.d.ts +66 -0
  40. package/dist/types/current/streaming/AudioOptions.d.ts.map +1 -0
  41. package/dist/types/current/streaming/AudioOptions.js +19 -0
  42. package/dist/types/current/streaming/LoadMetric.d.ts +72 -0
  43. package/dist/types/current/streaming/LoadMetric.d.ts.map +1 -0
  44. package/dist/types/current/streaming/LoadMetric.js +5 -0
  45. package/dist/types/current/streaming/ManifestControllerImpl.d.ts +43 -0
  46. package/dist/types/current/streaming/ManifestControllerImpl.d.ts.map +1 -0
  47. package/dist/types/current/streaming/ManifestControllerImpl.js +104 -0
  48. package/dist/types/current/streaming/buffering/codecDenylist.d.ts +23 -0
  49. package/dist/types/current/streaming/buffering/codecDenylist.d.ts.map +1 -0
  50. package/dist/types/current/streaming/buffering/codecDenylist.js +62 -0
  51. package/dist/types/current/streaming/createAllowedContentTypesValue.d.ts +30 -0
  52. package/dist/types/current/streaming/createAllowedContentTypesValue.d.ts.map +1 -0
  53. package/dist/types/current/streaming/createAllowedContentTypesValue.js +43 -0
  54. package/dist/types/current/streaming/createTimelineContentTypesValue.d.ts +21 -0
  55. package/dist/types/current/streaming/createTimelineContentTypesValue.d.ts.map +1 -0
  56. package/dist/types/current/streaming/createTimelineContentTypesValue.js +25 -0
  57. package/dist/types/current/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
  58. package/dist/types/current/streaming/mediaTimelineAccessibilityFilter.d.ts.map +1 -0
  59. package/dist/types/current/streaming/mediaTimelineAccessibilityFilter.js +75 -0
  60. package/dist/types/current/text/HtmlTextTrackRenderer.d.ts +60 -0
  61. package/dist/types/current/text/HtmlTextTrackRenderer.d.ts.map +1 -0
  62. package/dist/types/current/text/HtmlTextTrackRenderer.js +231 -0
  63. package/dist/types/current/text/SidecarTextTrackController.d.ts +103 -0
  64. package/dist/types/current/text/SidecarTextTrackController.d.ts.map +1 -0
  65. package/dist/types/current/text/SidecarTextTrackController.js +250 -0
  66. package/dist/types/current/text/SidecarTextTrackLoader.d.ts +65 -0
  67. package/dist/types/current/text/SidecarTextTrackLoader.d.ts.map +1 -0
  68. package/dist/types/current/text/SidecarTextTrackLoader.js +150 -0
  69. package/dist/types/current/text/TextTrack.d.ts +179 -0
  70. package/dist/types/current/text/TextTrack.d.ts.map +1 -0
  71. package/dist/types/current/text/TextTrack.js +29 -0
  72. package/dist/types/current/text/TextTrackRenderer.d.ts +24 -0
  73. package/dist/types/current/text/TextTrackRenderer.d.ts.map +1 -0
  74. package/dist/types/current/text/TextTrackRenderer.js +5 -0
  75. package/dist/types/current/text/VttCueStyle.d.ts +41 -0
  76. package/dist/types/current/text/VttCueStyle.d.ts.map +1 -0
  77. package/dist/types/current/text/VttCueStyle.js +45 -0
  78. package/dist/types/current/text/discoverDashTextTracks.d.ts +24 -0
  79. package/dist/types/current/text/discoverDashTextTracks.d.ts.map +1 -0
  80. package/dist/types/current/text/discoverDashTextTracks.js +110 -0
  81. package/dist/types/current/text/discoverHlsTextTracks.d.ts +19 -0
  82. package/dist/types/current/text/discoverHlsTextTracks.d.ts.map +1 -0
  83. package/dist/types/current/text/discoverHlsTextTracks.js +49 -0
  84. package/dist/types/current/text/mediaTextTrackProvider.d.ts +34 -0
  85. package/dist/types/current/text/mediaTextTrackProvider.d.ts.map +1 -0
  86. package/dist/types/current/text/mediaTextTrackProvider.js +42 -0
  87. package/dist/types/current/text/parseWebVtt.d.ts +60 -0
  88. package/dist/types/current/text/parseWebVtt.d.ts.map +1 -0
  89. package/dist/types/current/text/parseWebVtt.js +249 -0
  90. package/dist/types/current/text/pickPreferredTextTrack.d.ts +15 -0
  91. package/dist/types/current/text/pickPreferredTextTrack.d.ts.map +1 -0
  92. package/dist/types/current/text/pickPreferredTextTrack.js +71 -0
  93. package/dist/types/current/track/SeekRange.d.ts +9 -0
  94. package/dist/types/current/track/SeekRange.d.ts.map +1 -0
  95. package/dist/types/current/track/SeekRange.js +5 -0
  96. package/dist/types/current/track/hls/HlsManifestData.d.ts +19 -0
  97. package/dist/types/current/track/hls/HlsManifestData.d.ts.map +1 -0
  98. package/dist/types/current/track/hls/HlsManifestData.js +5 -0
  99. package/dist/types/current/track/hls/createHlsManifestProvider.d.ts +6 -0
  100. package/dist/types/current/track/hls/createHlsManifestProvider.d.ts.map +1 -0
  101. package/dist/types/current/track/hls/createHlsManifestProvider.js +9 -0
  102. package/dist/types/current/track/inferLoadOptionsFromUri.d.ts +15 -0
  103. package/dist/types/current/track/inferLoadOptionsFromUri.d.ts.map +1 -0
  104. package/dist/types/current/track/inferLoadOptionsFromUri.js +55 -0
  105. package/dist/types/current/track/mse/MseTrack.d.ts +0 -1
  106. package/dist/types/current/track/mse/MseTrack.d.ts.map +1 -1
  107. package/dist/types/current/track/mse/MseTrack.js +4 -5
  108. package/dist/types/current/tsconfig.tsbuildinfo +1 -1
  109. package/dist/types/current/util/media/codecOverrides.d.ts +33 -0
  110. package/dist/types/current/util/media/codecOverrides.d.ts.map +1 -0
  111. package/dist/types/current/util/media/codecOverrides.js +37 -0
  112. package/dist/types/current/util/media/codecSupport.d.ts +6 -0
  113. package/dist/types/current/util/media/codecSupport.d.ts.map +1 -0
  114. package/dist/types/current/util/media/codecSupport.js +17 -0
  115. package/dist/types/current/util/media/mimeType.d.ts +8 -0
  116. package/dist/types/current/util/media/mimeType.d.ts.map +1 -0
  117. package/dist/types/current/util/media/mimeType.js +13 -0
  118. package/dist/types/ts3.7/ad/AdBreakInfo.d.ts +160 -0
  119. package/dist/types/ts3.7/ad/AdController.d.ts +243 -0
  120. package/dist/types/ts3.7/ad/AdControllerImpl.d.ts +162 -0
  121. package/dist/types/ts3.7/ad/AdError.d.ts +6 -0
  122. package/dist/types/ts3.7/ad/AdsProvider.d.ts +28 -0
  123. package/dist/types/ts3.7/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
  124. package/dist/types/ts3.7/ad/discoverHlsInterstitials.d.ts +22 -0
  125. package/dist/types/ts3.7/drm/DrmControllerImpl.d.ts +6 -0
  126. package/dist/types/ts3.7/playback/PlaybackControllerImpl.d.ts +1 -1
  127. package/dist/types/ts3.7/playback/createStallDetector.d.ts +43 -0
  128. package/dist/types/ts3.7/playback/createStallMonitor.d.ts +45 -0
  129. package/dist/types/ts3.7/streaming/AudioOptions.d.ts +66 -0
  130. package/dist/types/ts3.7/streaming/LoadMetric.d.ts +72 -0
  131. package/dist/types/ts3.7/streaming/ManifestControllerImpl.d.ts +40 -0
  132. package/dist/types/ts3.7/streaming/buffering/codecDenylist.d.ts +23 -0
  133. package/dist/types/ts3.7/streaming/createAllowedContentTypesValue.d.ts +30 -0
  134. package/dist/types/ts3.7/streaming/createTimelineContentTypesValue.d.ts +21 -0
  135. package/dist/types/ts3.7/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
  136. package/dist/types/ts3.7/text/HtmlTextTrackRenderer.d.ts +60 -0
  137. package/dist/types/ts3.7/text/SidecarTextTrackController.d.ts +103 -0
  138. package/dist/types/ts3.7/text/SidecarTextTrackLoader.d.ts +65 -0
  139. package/dist/types/ts3.7/text/TextTrack.d.ts +183 -0
  140. package/dist/types/ts3.7/text/TextTrackRenderer.d.ts +24 -0
  141. package/dist/types/ts3.7/text/VttCueStyle.d.ts +41 -0
  142. package/dist/types/ts3.7/text/discoverDashTextTracks.d.ts +24 -0
  143. package/dist/types/ts3.7/text/discoverHlsTextTracks.d.ts +19 -0
  144. package/dist/types/ts3.7/text/mediaTextTrackProvider.d.ts +34 -0
  145. package/dist/types/ts3.7/text/parseWebVtt.d.ts +60 -0
  146. package/dist/types/ts3.7/text/pickPreferredTextTrack.d.ts +15 -0
  147. package/dist/types/ts3.7/track/SeekRange.d.ts +9 -0
  148. package/dist/types/ts3.7/track/hls/HlsManifestData.d.ts +19 -0
  149. package/dist/types/ts3.7/track/hls/createHlsManifestProvider.d.ts +6 -0
  150. package/dist/types/ts3.7/track/inferLoadOptionsFromUri.d.ts +15 -0
  151. package/dist/types/ts3.7/track/mse/MseTrack.d.ts +0 -1
  152. package/dist/types/ts3.7/util/media/codecOverrides.d.ts +33 -0
  153. package/dist/types/ts3.7/util/media/codecSupport.d.ts +6 -0
  154. package/dist/types/ts3.7/util/media/mimeType.d.ts +8 -0
  155. package/dist/types/ts4.1/ad/AdBreakInfo.d.ts +160 -0
  156. package/dist/types/ts4.1/ad/AdController.d.ts +243 -0
  157. package/dist/types/ts4.1/ad/AdControllerImpl.d.ts +162 -0
  158. package/dist/types/ts4.1/ad/AdError.d.ts +6 -0
  159. package/dist/types/ts4.1/ad/AdsProvider.d.ts +28 -0
  160. package/dist/types/ts4.1/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
  161. package/dist/types/ts4.1/ad/discoverHlsInterstitials.d.ts +22 -0
  162. package/dist/types/ts4.1/drm/DrmControllerImpl.d.ts +6 -0
  163. package/dist/types/ts4.1/playback/PlaybackControllerImpl.d.ts +1 -1
  164. package/dist/types/ts4.1/playback/createStallDetector.d.ts +43 -0
  165. package/dist/types/ts4.1/playback/createStallMonitor.d.ts +45 -0
  166. package/dist/types/ts4.1/streaming/AudioOptions.d.ts +66 -0
  167. package/dist/types/ts4.1/streaming/LoadMetric.d.ts +72 -0
  168. package/dist/types/ts4.1/streaming/ManifestControllerImpl.d.ts +40 -0
  169. package/dist/types/ts4.1/streaming/buffering/codecDenylist.d.ts +23 -0
  170. package/dist/types/ts4.1/streaming/createAllowedContentTypesValue.d.ts +30 -0
  171. package/dist/types/ts4.1/streaming/createTimelineContentTypesValue.d.ts +21 -0
  172. package/dist/types/ts4.1/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
  173. package/dist/types/ts4.1/text/HtmlTextTrackRenderer.d.ts +60 -0
  174. package/dist/types/ts4.1/text/SidecarTextTrackController.d.ts +104 -0
  175. package/dist/types/ts4.1/text/SidecarTextTrackLoader.d.ts +65 -0
  176. package/dist/types/ts4.1/text/TextTrack.d.ts +183 -0
  177. package/dist/types/ts4.1/text/TextTrackRenderer.d.ts +24 -0
  178. package/dist/types/ts4.1/text/VttCueStyle.d.ts +41 -0
  179. package/dist/types/ts4.1/text/discoverDashTextTracks.d.ts +24 -0
  180. package/dist/types/ts4.1/text/discoverHlsTextTracks.d.ts +19 -0
  181. package/dist/types/ts4.1/text/mediaTextTrackProvider.d.ts +34 -0
  182. package/dist/types/ts4.1/text/parseWebVtt.d.ts +60 -0
  183. package/dist/types/ts4.1/text/pickPreferredTextTrack.d.ts +15 -0
  184. package/dist/types/ts4.1/track/SeekRange.d.ts +9 -0
  185. package/dist/types/ts4.1/track/hls/HlsManifestData.d.ts +19 -0
  186. package/dist/types/ts4.1/track/hls/createHlsManifestProvider.d.ts +6 -0
  187. package/dist/types/ts4.1/track/inferLoadOptionsFromUri.d.ts +15 -0
  188. package/dist/types/ts4.1/track/mse/MseTrack.d.ts +0 -1
  189. package/dist/types/ts4.1/util/media/codecOverrides.d.ts +33 -0
  190. package/dist/types/ts4.1/util/media/codecSupport.d.ts +6 -0
  191. package/dist/types/ts4.1/util/media/mimeType.d.ts +8 -0
  192. package/dist/types/ts4.7/ad/AdBreakInfo.d.ts +160 -0
  193. package/dist/types/ts4.7/ad/AdController.d.ts +243 -0
  194. package/dist/types/ts4.7/ad/AdControllerImpl.d.ts +162 -0
  195. package/dist/types/ts4.7/ad/AdError.d.ts +6 -0
  196. package/dist/types/ts4.7/ad/AdsProvider.d.ts +28 -0
  197. package/dist/types/ts4.7/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
  198. package/dist/types/ts4.7/ad/discoverHlsInterstitials.d.ts +22 -0
  199. package/dist/types/ts4.7/drm/DrmControllerImpl.d.ts +6 -0
  200. package/dist/types/ts4.7/playback/PlaybackControllerImpl.d.ts +1 -1
  201. package/dist/types/ts4.7/playback/createStallDetector.d.ts +43 -0
  202. package/dist/types/ts4.7/playback/createStallMonitor.d.ts +45 -0
  203. package/dist/types/ts4.7/streaming/AudioOptions.d.ts +66 -0
  204. package/dist/types/ts4.7/streaming/LoadMetric.d.ts +72 -0
  205. package/dist/types/ts4.7/streaming/ManifestControllerImpl.d.ts +43 -0
  206. package/dist/types/ts4.7/streaming/buffering/codecDenylist.d.ts +23 -0
  207. package/dist/types/ts4.7/streaming/createAllowedContentTypesValue.d.ts +30 -0
  208. package/dist/types/ts4.7/streaming/createTimelineContentTypesValue.d.ts +21 -0
  209. package/dist/types/ts4.7/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
  210. package/dist/types/ts4.7/text/HtmlTextTrackRenderer.d.ts +60 -0
  211. package/dist/types/ts4.7/text/SidecarTextTrackController.d.ts +103 -0
  212. package/dist/types/ts4.7/text/SidecarTextTrackLoader.d.ts +65 -0
  213. package/dist/types/ts4.7/text/TextTrack.d.ts +183 -0
  214. package/dist/types/ts4.7/text/TextTrackRenderer.d.ts +24 -0
  215. package/dist/types/ts4.7/text/VttCueStyle.d.ts +41 -0
  216. package/dist/types/ts4.7/text/discoverDashTextTracks.d.ts +24 -0
  217. package/dist/types/ts4.7/text/discoverHlsTextTracks.d.ts +19 -0
  218. package/dist/types/ts4.7/text/mediaTextTrackProvider.d.ts +34 -0
  219. package/dist/types/ts4.7/text/parseWebVtt.d.ts +60 -0
  220. package/dist/types/ts4.7/text/pickPreferredTextTrack.d.ts +15 -0
  221. package/dist/types/ts4.7/track/SeekRange.d.ts +9 -0
  222. package/dist/types/ts4.7/track/hls/HlsManifestData.d.ts +19 -0
  223. package/dist/types/ts4.7/track/hls/createHlsManifestProvider.d.ts +6 -0
  224. package/dist/types/ts4.7/track/inferLoadOptionsFromUri.d.ts +15 -0
  225. package/dist/types/ts4.7/track/mse/MseTrack.d.ts +0 -1
  226. package/dist/types/ts4.7/util/media/codecOverrides.d.ts +33 -0
  227. package/dist/types/ts4.7/util/media/codecSupport.d.ts +6 -0
  228. package/dist/types/ts4.7/util/media/mimeType.d.ts +8 -0
  229. package/dist/unit/types/current/ad/AdController.test.d.ts +2 -0
  230. package/dist/unit/types/current/ad/AdController.test.d.ts.map +1 -0
  231. package/dist/unit/types/current/ad/AdController.test.js +10 -0
  232. package/dist/unit/types/current/ad/AdControllerImpl.test.d.ts +2 -0
  233. package/dist/unit/types/current/ad/AdControllerImpl.test.d.ts.map +1 -0
  234. package/dist/unit/types/current/ad/AdControllerImpl.test.js +1654 -0
  235. package/dist/unit/types/current/ad/defaultAdLoadOptionsResolver.test.d.ts +2 -0
  236. package/dist/unit/types/current/ad/defaultAdLoadOptionsResolver.test.d.ts.map +1 -0
  237. package/dist/unit/types/current/ad/defaultAdLoadOptionsResolver.test.js +56 -0
  238. package/dist/unit/types/current/ad/discoverHlsInterstitials.test.d.ts +2 -0
  239. package/dist/unit/types/current/ad/discoverHlsInterstitials.test.d.ts.map +1 -0
  240. package/dist/unit/types/current/ad/discoverHlsInterstitials.test.js +757 -0
  241. package/dist/unit/types/current/drm/DrmControllerImpl.test.js +96 -2
  242. package/dist/unit/types/current/playback/createStallDetector.test.d.ts +2 -0
  243. package/dist/unit/types/current/playback/createStallDetector.test.d.ts.map +1 -0
  244. package/dist/unit/types/current/playback/createStallDetector.test.js +163 -0
  245. package/dist/unit/types/current/playback/createStallMonitor.test.d.ts +2 -0
  246. package/dist/unit/types/current/playback/createStallMonitor.test.d.ts.map +1 -0
  247. package/dist/unit/types/current/playback/createStallMonitor.test.js +163 -0
  248. package/dist/unit/types/current/streaming/ManifestControllerImpl.test.d.ts +2 -0
  249. package/dist/unit/types/current/streaming/ManifestControllerImpl.test.d.ts.map +1 -0
  250. package/dist/unit/types/current/streaming/ManifestControllerImpl.test.js +197 -0
  251. package/dist/unit/types/current/streaming/MseTrack.test.js +15 -0
  252. package/dist/unit/types/current/streaming/buffering/codecDenylist.test.d.ts +2 -0
  253. package/dist/unit/types/current/streaming/buffering/codecDenylist.test.d.ts.map +1 -0
  254. package/dist/unit/types/current/streaming/buffering/codecDenylist.test.js +56 -0
  255. package/dist/unit/types/current/streaming/createAllowedContentTypesValue.test.d.ts +2 -0
  256. package/dist/unit/types/current/streaming/createAllowedContentTypesValue.test.d.ts.map +1 -0
  257. package/dist/unit/types/current/streaming/createAllowedContentTypesValue.test.js +77 -0
  258. package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.d.ts +2 -0
  259. package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.d.ts.map +1 -0
  260. package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.js +57 -0
  261. package/dist/unit/types/current/streaming/mediaTimelineAccessibilityFilter.test.d.ts +2 -0
  262. package/dist/unit/types/current/streaming/mediaTimelineAccessibilityFilter.test.d.ts.map +1 -0
  263. package/dist/unit/types/current/streaming/mediaTimelineAccessibilityFilter.test.js +99 -0
  264. package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts +2 -0
  265. package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts.map +1 -0
  266. package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.js +231 -0
  267. package/dist/unit/types/current/text/SidecarTextTrackController.test.d.ts +2 -0
  268. package/dist/unit/types/current/text/SidecarTextTrackController.test.d.ts.map +1 -0
  269. package/dist/unit/types/current/text/SidecarTextTrackController.test.js +686 -0
  270. package/dist/unit/types/current/text/SidecarTextTrackLoader.test.d.ts +2 -0
  271. package/dist/unit/types/current/text/SidecarTextTrackLoader.test.d.ts.map +1 -0
  272. package/dist/unit/types/current/text/SidecarTextTrackLoader.test.js +365 -0
  273. package/dist/unit/types/current/text/TextTrack.test.d.ts +2 -0
  274. package/dist/unit/types/current/text/TextTrack.test.d.ts.map +1 -0
  275. package/dist/unit/types/current/text/TextTrack.test.js +12 -0
  276. package/dist/unit/types/current/text/VttCueStyle.test.d.ts +2 -0
  277. package/dist/unit/types/current/text/VttCueStyle.test.d.ts.map +1 -0
  278. package/dist/unit/types/current/text/VttCueStyle.test.js +76 -0
  279. package/dist/unit/types/current/text/discoverDashTextTracks.test.d.ts +2 -0
  280. package/dist/unit/types/current/text/discoverDashTextTracks.test.d.ts.map +1 -0
  281. package/dist/unit/types/current/text/discoverDashTextTracks.test.js +216 -0
  282. package/dist/unit/types/current/text/discoverHlsTextTracks.test.d.ts +2 -0
  283. package/dist/unit/types/current/text/discoverHlsTextTracks.test.d.ts.map +1 -0
  284. package/dist/unit/types/current/text/discoverHlsTextTracks.test.js +177 -0
  285. package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts +2 -0
  286. package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts.map +1 -0
  287. package/dist/unit/types/current/text/mediaTextTrackProvider.test.js +86 -0
  288. package/dist/unit/types/current/text/parseWebVtt.test.d.ts +2 -0
  289. package/dist/unit/types/current/text/parseWebVtt.test.d.ts.map +1 -0
  290. package/dist/unit/types/current/text/parseWebVtt.test.js +419 -0
  291. package/dist/unit/types/current/text/pickPreferredTextTrack.test.d.ts +2 -0
  292. package/dist/unit/types/current/text/pickPreferredTextTrack.test.d.ts.map +1 -0
  293. package/dist/unit/types/current/text/pickPreferredTextTrack.test.js +78 -0
  294. package/dist/unit/types/current/track/inferLoadOptionsFromUri.test.d.ts +2 -0
  295. package/dist/unit/types/current/track/inferLoadOptionsFromUri.test.d.ts.map +1 -0
  296. package/dist/unit/types/current/track/inferLoadOptionsFromUri.test.js +165 -0
  297. package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
  298. package/dist/unit/types/current/util/media/codecOverrides.test.d.ts +2 -0
  299. package/dist/unit/types/current/util/media/codecOverrides.test.d.ts.map +1 -0
  300. package/dist/unit/types/current/util/media/codecOverrides.test.js +42 -0
  301. package/dist/unit/types/current/util/media/codecSupport.test.d.ts +2 -0
  302. package/dist/unit/types/current/util/media/codecSupport.test.d.ts.map +1 -0
  303. package/dist/unit/types/current/util/media/codecSupport.test.js +26 -0
  304. package/dist/unit/types/current/util/media/mimeType.test.d.ts +2 -0
  305. package/dist/unit/types/current/util/media/mimeType.test.d.ts.map +1 -0
  306. package/dist/unit/types/current/util/media/mimeType.test.js +22 -0
  307. package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.d.ts +2 -0
  308. package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.d.ts.map +1 -0
  309. package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.js +142 -0
  310. package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.d.ts +2 -0
  311. package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.d.ts.map +1 -0
  312. package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.js +188 -0
  313. package/dist/vinylTestUtil/types/current/mock/ad/MockAdController.d.ts +15 -0
  314. package/dist/vinylTestUtil/types/current/mock/ad/MockAdController.d.ts.map +1 -0
  315. package/dist/vinylTestUtil/types/current/mock/ad/MockAdController.js +26 -0
  316. package/dist/vinylTestUtil/types/current/mock/dash/mockDashManifest.d.ts +84 -84
  317. package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts +10 -0
  318. package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts.map +1 -0
  319. package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.js +14 -0
  320. package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
  321. package/dist/vinylTestUtil/types/ts3.7/mock/ad/MockAdController.d.ts +15 -0
  322. package/dist/vinylTestUtil/types/ts3.7/mock/dash/mockDashManifest.d.ts +84 -84
  323. package/dist/vinylTestUtil/types/ts3.7/mock/text/MockTextTrackController.d.ts +10 -0
  324. package/dist/vinylTestUtil/types/ts4.1/mock/ad/MockAdController.d.ts +15 -0
  325. package/dist/vinylTestUtil/types/ts4.1/mock/dash/mockDashManifest.d.ts +84 -84
  326. package/dist/vinylTestUtil/types/ts4.1/mock/text/MockTextTrackController.d.ts +10 -0
  327. package/dist/vinylTestUtil/types/ts4.7/mock/ad/MockAdController.d.ts +15 -0
  328. package/dist/vinylTestUtil/types/ts4.7/mock/dash/mockDashManifest.d.ts +84 -84
  329. package/dist/vinylTestUtil/types/ts4.7/mock/text/MockTextTrackController.d.ts +10 -0
  330. package/package.json +10 -11
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Renders a text track's cues. Injected into the player so an application can
3
+ * paint captions itself (as HTML) instead of relying on the browser's native
4
+ * `TextTrack` rendering — giving full control over styling and placement.
5
+ *
6
+ * The controller hands the renderer the DOM `TextTrack` (set to `'hidden'`, so
7
+ * the browser tracks cue timing but does not paint); the renderer listens for
8
+ * the track's active cues and draws them. See {@link HtmlTextTrackRenderer} for
9
+ * the built-in HTML implementation.
10
+ */
11
+ export interface TextTrackRenderer {
12
+ /**
13
+ * Renders the active cues of `track`, listening for cue changes. Passing
14
+ * `null` clears anything rendered and detaches from the previous track.
15
+ */
16
+ setTextTrack(track: TextTrack | null): void;
17
+ /**
18
+ * Supplies the CSS bodies of the track's WebVTT `STYLE` blocks (which carry
19
+ * `::cue` rules), so the renderer can style cue classes. Optional — a
20
+ * renderer may ignore authored styles.
21
+ */
22
+ setStyles?(styles: readonly string[]): void;
23
+ }
24
+ //# sourceMappingURL=TextTrackRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextTrackRenderer.d.ts","sourceRoot":"","sources":["../../../../src/text/TextTrackRenderer.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAA;IAE3C;;;;OAIG;IACH,SAAS,CAAC,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;CAC9C"}
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export {};
@@ -0,0 +1,41 @@
1
+ import type { ObjectSchema } from '@amazon/vinyl-validation';
2
+ /**
3
+ * Layout style applied to each rendered WebVTT cue, mirroring the settable
4
+ * positioning properties of the DOM `VTTCue`. Only the properties that are set
5
+ * are applied; the rest keep the browser defaults.
6
+ *
7
+ * These are the WebVTT cue-box layout controls (not text color/font, which are
8
+ * only reachable via the non-configurable `::cue` pseudo-element). See
9
+ * {@link https://developer.mozilla.org/docs/Web/API/VTTCue}.
10
+ */
11
+ export interface VttCueStyle {
12
+ /** Text alignment within the cue box. */
13
+ readonly align?: AlignSetting;
14
+ /** Line (vertical) position, as a line number/percentage or `'auto'`. */
15
+ readonly line?: number | AutoKeyword;
16
+ /** How `line` is anchored. */
17
+ readonly lineAlign?: LineAlignSetting;
18
+ /** Inline position of the cue box, as a percentage or `'auto'`. */
19
+ readonly position?: number | AutoKeyword;
20
+ /** How `position` is anchored. */
21
+ readonly positionAlign?: PositionAlignSetting;
22
+ /** Size of the cue box as a percentage of the video dimension. */
23
+ readonly size?: number;
24
+ /** Whether `line` is a line number (true) or a percentage (false). */
25
+ readonly snapToLines?: boolean;
26
+ /** Writing direction. */
27
+ readonly vertical?: DirectionSetting;
28
+ }
29
+ /**
30
+ * Type guard for a DOM cue that is a `VTTCue` (and so carries the WebVTT layout
31
+ * properties). On platforms without `VTTCue`, cues are plain `TextTrackCue`s
32
+ * that cannot be styled.
33
+ */
34
+ export declare function isVttCue(cue: TextTrackCue): cue is VTTCue;
35
+ /**
36
+ * Applies the configured layout style to a `VTTCue`, setting only the
37
+ * properties present in `style`.
38
+ */
39
+ export declare function applyVttCueStyle(cue: VTTCue, style: VttCueStyle): void;
40
+ export declare const vttCueStyleValidator: ObjectSchema<VttCueStyle>;
41
+ //# sourceMappingURL=VttCueStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VttCueStyle.d.ts","sourceRoot":"","sources":["../../../../src/text/VttCueStyle.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAG5D;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IACxB,yCAAyC;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAA;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;IACpC,8BAA8B;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAA;IACrC,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;IACxC,kCAAkC;IAClC,QAAQ,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAA;IAC7C,kEAAkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,yBAAyB;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CACvC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,YAAY,GAAG,GAAG,IAAI,MAAM,CAEzD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAUtE;AAED,eAAO,MAAM,oBAAoB,EAAE,YAAY,CAAC,WAAW,CAczD,CAAA"}
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { boolean, isOneOf, number, object } from '@amazon/vinyl-validation';
6
+ /**
7
+ * Type guard for a DOM cue that is a `VTTCue` (and so carries the WebVTT layout
8
+ * properties). On platforms without `VTTCue`, cues are plain `TextTrackCue`s
9
+ * that cannot be styled.
10
+ */
11
+ export function isVttCue(cue) {
12
+ return typeof VTTCue !== 'undefined' && cue instanceof VTTCue;
13
+ }
14
+ /**
15
+ * Applies the configured layout style to a `VTTCue`, setting only the
16
+ * properties present in `style`.
17
+ */
18
+ export function applyVttCueStyle(cue, style) {
19
+ if (style.align !== undefined)
20
+ cue.align = style.align;
21
+ if (style.line !== undefined)
22
+ cue.line = style.line;
23
+ if (style.lineAlign !== undefined)
24
+ cue.lineAlign = style.lineAlign;
25
+ if (style.position !== undefined)
26
+ cue.position = style.position;
27
+ if (style.positionAlign !== undefined)
28
+ cue.positionAlign = style.positionAlign;
29
+ if (style.size !== undefined)
30
+ cue.size = style.size;
31
+ if (style.snapToLines !== undefined)
32
+ cue.snapToLines = style.snapToLines;
33
+ if (style.vertical !== undefined)
34
+ cue.vertical = style.vertical;
35
+ }
36
+ export const vttCueStyleValidator = object({
37
+ align: isOneOf('start', 'center', 'end', 'left', 'right').optional(),
38
+ line: number().or(isOneOf('auto')).optional(),
39
+ lineAlign: isOneOf('start', 'center', 'end').optional(),
40
+ position: number().or(isOneOf('auto')).optional(),
41
+ positionAlign: isOneOf('line-left', 'center', 'line-right', 'auto').optional(),
42
+ size: number().optional(),
43
+ snapToLines: boolean().optional(),
44
+ vertical: isOneOf('', 'rl', 'lr').optional(),
45
+ });
@@ -0,0 +1,24 @@
1
+ import type { DashManifest } from '@amazon/vinyl-mpd-parser';
2
+ import type { TextTrackInfo } from './TextTrack';
3
+ /**
4
+ * Discovers sidecar text tracks from a DASH manifest.
5
+ *
6
+ * Considers an `<AdaptationSet>` to carry text when one of:
7
+ * - `contentType="text"`
8
+ * - its `mimeType`, or that of one of its `<Representation>`s, starts with
9
+ * `text/` (e.g. `text/vtt`)
10
+ *
11
+ * Within a text adaptation set, each `<Representation>` becomes one
12
+ * {@link TextTrackInfo}. The `BaseURL` chain (MPD → Period → AdaptationSet →
13
+ * Representation) is resolved against the supplied `baseUrl`.
14
+ *
15
+ * Only sidecar (single-file) WebVTT renditions are surfaced. Segmented text
16
+ * tracks (`stpp`/`wvtt` codecs) are ignored - they would require streaming
17
+ * through MSE which the sidecar pipeline does not support.
18
+ *
19
+ * @param manifest The parsed DASH manifest.
20
+ * @param baseUrl The URL of the manifest, used as the root for `BaseURL`
21
+ * resolution.
22
+ */
23
+ export declare function discoverDashTextTracks(manifest: DashManifest, baseUrl: string): readonly TextTrackInfo[];
24
+ //# sourceMappingURL=discoverDashTextTracks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discoverDashTextTracks.d.ts","sourceRoot":"","sources":["../../../../src/text/discoverDashTextTracks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GAChB,SAAS,aAAa,EAAE,CAwD1B"}
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { resolveUrl } from '@amazon/vinyl-util';
6
+ /**
7
+ * Discovers sidecar text tracks from a DASH manifest.
8
+ *
9
+ * Considers an `<AdaptationSet>` to carry text when one of:
10
+ * - `contentType="text"`
11
+ * - its `mimeType`, or that of one of its `<Representation>`s, starts with
12
+ * `text/` (e.g. `text/vtt`)
13
+ *
14
+ * Within a text adaptation set, each `<Representation>` becomes one
15
+ * {@link TextTrackInfo}. The `BaseURL` chain (MPD → Period → AdaptationSet →
16
+ * Representation) is resolved against the supplied `baseUrl`.
17
+ *
18
+ * Only sidecar (single-file) WebVTT renditions are surfaced. Segmented text
19
+ * tracks (`stpp`/`wvtt` codecs) are ignored - they would require streaming
20
+ * through MSE which the sidecar pipeline does not support.
21
+ *
22
+ * @param manifest The parsed DASH manifest.
23
+ * @param baseUrl The URL of the manifest, used as the root for `BaseURL`
24
+ * resolution.
25
+ */
26
+ export function discoverDashTextTracks(manifest, baseUrl) {
27
+ const out = [];
28
+ const periods = manifest.MPD.Period;
29
+ const mpdBase = chainBase(baseUrl, manifest.MPD.BaseURL);
30
+ for (let p = 0; p < periods.length; p++) {
31
+ const period = periods[p];
32
+ const periodBase = chainBase(mpdBase, period.BaseURL);
33
+ const adaptationSets = period.AdaptationSet ?? [];
34
+ for (const adaptationSet of adaptationSets) {
35
+ if (!isTextAdaptationSet(adaptationSet))
36
+ continue;
37
+ const asBase = chainBase(periodBase, adaptationSet.BaseURL);
38
+ const representations = adaptationSet.Representation ?? [];
39
+ for (const representation of representations) {
40
+ const repBase = chainBase(asBase, representation.BaseURL);
41
+ const uri = pickRepresentationUri(repBase, representation.id);
42
+ const mimeType = representation.mimeType ?? adaptationSet.mimeType ?? null;
43
+ // Only surface sidecar formats. Segmented text (stpp/wvtt) is
44
+ // intentionally skipped.
45
+ if (!isSidecarTextMime(mimeType))
46
+ continue;
47
+ const language = adaptationSet.lang ?? null;
48
+ const roleValues = (adaptationSet.Role ?? [])
49
+ .filter((d) => d.schemeIdUri === 'urn:mpeg:dash:role:2011')
50
+ .map((d) => d.value)
51
+ .filter((v) => v != null);
52
+ // Accessibility descriptors (e.g. SDH / hard-of-hearing) also
53
+ // describe the track's role; surface them as characteristics.
54
+ const accessibility = (adaptationSet.Accessibility ?? [])
55
+ .map((d) => d.value)
56
+ .filter((v) => v != null);
57
+ const characteristics = [...roleValues, ...accessibility];
58
+ const isCaption = roleValues.includes('caption');
59
+ const isDefault = roleValues.includes('main');
60
+ // DASH signals forced text via the `forced_subtitle` /
61
+ // `forced-subtitle` role value.
62
+ const forced = roleValues.includes('forced_subtitle') ||
63
+ roleValues.includes('forced-subtitle');
64
+ out.push({
65
+ id: `dash-text-${p}-${representation.id}`,
66
+ kind: isCaption ? 'captions' : 'subtitles',
67
+ language,
68
+ label: language ?? representation.id,
69
+ default: isDefault,
70
+ forced,
71
+ characteristics,
72
+ uri,
73
+ mimeType,
74
+ });
75
+ }
76
+ }
77
+ }
78
+ return out;
79
+ }
80
+ function isTextAdaptationSet(adaptationSet) {
81
+ if (adaptationSet.contentType === 'text')
82
+ return true;
83
+ const mt = adaptationSet.mimeType;
84
+ if (mt && mt.startsWith('text/'))
85
+ return true;
86
+ // `mimeType` may be declared on the Representation rather than the set.
87
+ return (adaptationSet.Representation ?? []).some((representation) => representation.mimeType?.startsWith('text/'));
88
+ }
89
+ function isSidecarTextMime(mimeType) {
90
+ // Permissive when manifest omits the MIME type, otherwise require a
91
+ // text/* MIME type. Segmented codec-only types like application/mp4
92
+ // (used with stpp/wvtt codecs) are excluded.
93
+ if (mimeType == null)
94
+ return true;
95
+ return mimeType.startsWith('text/');
96
+ }
97
+ function chainBase(parent, bases) {
98
+ if (!bases || bases.length === 0)
99
+ return parent;
100
+ return resolveUrl(bases[0]._content, parent);
101
+ }
102
+ function pickRepresentationUri(base, id) {
103
+ // For a sidecar text representation, the BaseURL is expected to point at
104
+ // the file. When the chain ends in a directory (trailing `/`), append a
105
+ // conventional `<id>.vtt` filename so the loader can fetch the resource.
106
+ if (base.endsWith('/')) {
107
+ return resolveUrl(`${id}.vtt`, base);
108
+ }
109
+ return base;
110
+ }
@@ -0,0 +1,19 @@
1
+ import type { HlsMainPlaylist } from '@amazon/vinyl-hls-parser';
2
+ import type { TextTrackInfo } from './TextTrack';
3
+ /**
4
+ * Discovers sidecar text tracks from an HLS multivariant playlist.
5
+ *
6
+ * Per RFC 8216 §4.3.4.2, subtitle renditions are signaled with
7
+ * `EXT-X-MEDIA:TYPE=SUBTITLES` and (when usable as sidecar) carry a `URI`
8
+ * attribute pointing at a media playlist or, in the simplified single-file
9
+ * case, a `.vtt` file directly.
10
+ *
11
+ * Closed captions (`TYPE=CLOSED-CAPTIONS`) are intentionally excluded - they
12
+ * are delivered in-band with the video stream and are surfaced by the browser
13
+ * automatically, not through a sidecar fetch.
14
+ *
15
+ * @param mainPlaylist The parsed HLS main playlist.
16
+ * @param baseUrl The URL of the main playlist, used to resolve relative URIs.
17
+ */
18
+ export declare function discoverHlsTextTracks(mainPlaylist: HlsMainPlaylist, baseUrl: string): readonly TextTrackInfo[];
19
+ //# sourceMappingURL=discoverHlsTextTracks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discoverHlsTextTracks.d.ts","sourceRoot":"","sources":["../../../../src/text/discoverHlsTextTracks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACjC,YAAY,EAAE,eAAe,EAC7B,OAAO,EAAE,MAAM,GAChB,SAAS,aAAa,EAAE,CA2B1B"}
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { resolveUrl } from '@amazon/vinyl-util';
6
+ /**
7
+ * Discovers sidecar text tracks from an HLS multivariant playlist.
8
+ *
9
+ * Per RFC 8216 §4.3.4.2, subtitle renditions are signaled with
10
+ * `EXT-X-MEDIA:TYPE=SUBTITLES` and (when usable as sidecar) carry a `URI`
11
+ * attribute pointing at a media playlist or, in the simplified single-file
12
+ * case, a `.vtt` file directly.
13
+ *
14
+ * Closed captions (`TYPE=CLOSED-CAPTIONS`) are intentionally excluded - they
15
+ * are delivered in-band with the video stream and are surfaced by the browser
16
+ * automatically, not through a sidecar fetch.
17
+ *
18
+ * @param mainPlaylist The parsed HLS main playlist.
19
+ * @param baseUrl The URL of the main playlist, used to resolve relative URIs.
20
+ */
21
+ export function discoverHlsTextTracks(mainPlaylist, baseUrl) {
22
+ const out = [];
23
+ let index = 0;
24
+ const parentDefines = mainPlaylist.defines && Object.keys(mainPlaylist.defines).length > 0
25
+ ? mainPlaylist.defines
26
+ : undefined;
27
+ for (const rendition of mainPlaylist.alternativeRenditions) {
28
+ if (rendition.type !== 'SUBTITLES')
29
+ continue;
30
+ if (!rendition.uri)
31
+ continue;
32
+ const resolved = resolveUrl(rendition.uri, baseUrl);
33
+ out.push({
34
+ id: `hls-text-${index++}-${rendition.groupId}-${rendition.name}`,
35
+ kind: 'subtitles',
36
+ language: rendition.language ?? null,
37
+ label: rendition.name,
38
+ default: rendition.default === true,
39
+ forced: rendition.forced === true,
40
+ characteristics: rendition.characteristics ?? [],
41
+ uri: resolved,
42
+ // HLS subtitle renditions don't carry a MIME type; WebVTT is the
43
+ // overwhelmingly dominant format for sidecar HLS subtitles.
44
+ mimeType: 'text/vtt',
45
+ ...(parentDefines && { variables: parentDefines }),
46
+ });
47
+ }
48
+ return out;
49
+ }
@@ -0,0 +1,34 @@
1
+ import type { TextTrackKind } from './TextTrack';
2
+ /**
3
+ * A handle to a DOM {@link TextTrack} created on the media element, plus a way
4
+ * to clear its cues.
5
+ */
6
+ export interface TextTrackRef {
7
+ readonly track: TextTrack;
8
+ /**
9
+ * Removes all cues from the track. Must be called while the track is not
10
+ * `disabled` — `TextTrack.cues` reads null in the disabled state, so
11
+ * clearing a disabled track silently leaves its cues attached.
12
+ */
13
+ clear(): void;
14
+ }
15
+ /**
16
+ * Creates and hands out DOM text tracks for a media element, memoized per
17
+ * `(kind, label, language)`.
18
+ *
19
+ * `HTMLMediaElement.addTextTrack` tracks can never be removed, so creating a
20
+ * fresh one per activation would accumulate tracks — and any left in `showing`
21
+ * mode renders alongside the active one (captions "bleed through"). Reusing one
22
+ * track per key keeps exactly one track per distinct rendition.
23
+ */
24
+ export interface MediaTextTrackProvider {
25
+ getOrCreate(kind: TextTrackKind, label?: string, language?: string): TextTrackRef;
26
+ }
27
+ export declare function createMediaTextTrackProvider(deps: {
28
+ /**
29
+ * The HTML media element on which to attach the in-band TextTrack
30
+ * representation.
31
+ */
32
+ readonly media: HTMLMediaElement;
33
+ }): MediaTextTrackProvider;
34
+ //# sourceMappingURL=mediaTextTrackProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaTextTrackProvider.d.ts","sourceRoot":"","sources":["../../../../src/text/mediaTextTrackProvider.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IAEzB;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAAA;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACnC,WAAW,CACP,IAAI,EAAE,aAAa,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAClB,YAAY,CAAA;CAClB;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IAC/C;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;CACnC,GAAG,sBAAsB,CAwCzB"}
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export function createMediaTextTrackProvider(deps) {
6
+ const { media } = deps;
7
+ const cache = new Map();
8
+ const isAttached = (track) => {
9
+ for (let i = 0; i < media.textTracks.length; i++) {
10
+ if (media.textTracks[i] === track)
11
+ return true;
12
+ }
13
+ return false;
14
+ };
15
+ const create = (kind, label, language) => {
16
+ const track = media.addTextTrack(kind, label, language);
17
+ return {
18
+ track,
19
+ clear() {
20
+ if (!track.cues)
21
+ return;
22
+ // Snapshot first — removeCue mutates the live list.
23
+ const all = Array.from(track.cues);
24
+ for (const cue of all)
25
+ track.removeCue(cue);
26
+ },
27
+ };
28
+ };
29
+ return {
30
+ getOrCreate(kind, label, language) {
31
+ const key = `${kind}-${label}-${language}`;
32
+ const cached = cache.get(key);
33
+ // Resetting the media source (MSE `src = null; load()`) drops added
34
+ // tracks, so a cached track can become detached; recreate when so.
35
+ if (cached && isAttached(cached.track))
36
+ return cached;
37
+ const ref = create(kind, label, language);
38
+ cache.set(key, ref);
39
+ return ref;
40
+ },
41
+ };
42
+ }
@@ -0,0 +1,60 @@
1
+ import type { VttCueStyle } from './VttCueStyle';
2
+ /**
3
+ * A single WebVTT cue.
4
+ *
5
+ * @see https://www.w3.org/TR/webvtt1/
6
+ */
7
+ export interface WebVttCue {
8
+ /**
9
+ * Optional cue identifier, the line that appears before the timing line.
10
+ */
11
+ readonly id: string | null;
12
+ /**
13
+ * Cue start time in seconds.
14
+ */
15
+ readonly startTime: number;
16
+ /**
17
+ * Cue end time in seconds.
18
+ */
19
+ readonly endTime: number;
20
+ /**
21
+ * The cue text payload, with line breaks preserved as `\n`.
22
+ */
23
+ readonly text: string;
24
+ /**
25
+ * The authored cue settings from the timing line (position/line/size/
26
+ * align/vertical), when any were present. Preserved so a renderer can
27
+ * position the cue faithfully. Absent when the cue declared no settings.
28
+ */
29
+ readonly settings?: VttCueStyle;
30
+ }
31
+ /**
32
+ * The result of parsing a WebVTT document.
33
+ */
34
+ export interface WebVttDocument {
35
+ /**
36
+ * Parsed cues in document order.
37
+ */
38
+ readonly cues: readonly WebVttCue[];
39
+ /**
40
+ * The raw CSS body of each `STYLE` block, in document order. These carry
41
+ * `::cue` rules (e.g. `::cue(.loud) { font-weight: bold }`) an HTML renderer
42
+ * can apply. Empty when the document declared no styles.
43
+ */
44
+ readonly styles: readonly string[];
45
+ }
46
+ /**
47
+ * Parses a WebVTT document into a list of cues.
48
+ *
49
+ * Implements a forgiving subset of the WebVTT 1.0 specification: header
50
+ * detection, comment blocks (lines starting with `NOTE`), styling/region
51
+ * blocks (STYLE bodies are captured, REGION skipped), cue identifiers, and
52
+ * HH:MM:SS.mmm or MM:SS.mmm timestamps with optional cue settings.
53
+ *
54
+ * @param input The raw WebVTT document text. Both LF and CRLF line endings
55
+ * are supported, and a leading BOM is stripped if present.
56
+ * @throws ValidationError if the input is missing the WEBVTT header.
57
+ * @see https://www.w3.org/TR/webvtt1/#webvtt-timestamp
58
+ */
59
+ export declare function parseWebVtt(input: string): WebVttDocument;
60
+ //# sourceMappingURL=parseWebVtt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseWebVtt.d.ts","sourceRoot":"","sources":["../../../../src/text/parseWebVtt.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAA;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CACrC;AAeD;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAqGzD"}