@amazon/vinyl 1.2.0 → 1.2.1

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 (289) hide show
  1. package/dist/index.cjs +11 -2
  2. package/dist/index.cjs.map +2 -2
  3. package/dist/index.js +15 -4
  4. package/dist/index.js.map +3 -3
  5. package/dist/test/integ.es5.js +43 -43
  6. package/dist/test/integ.js +70 -2
  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 +146 -0
  15. package/dist/types/current/ad/AdControllerImpl.d.ts.map +1 -0
  16. package/dist/types/current/ad/AdControllerImpl.js +705 -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 +246 -0
  29. package/dist/types/current/drm/DrmControllerImpl.d.ts.map +1 -1
  30. package/dist/types/current/drm/DrmControllerImpl.js +11 -1
  31. package/dist/types/current/playback/PlaybackControllerImpl.d.ts +1 -1
  32. package/dist/types/current/streaming/AudioOptions.d.ts +39 -0
  33. package/dist/types/current/streaming/AudioOptions.d.ts.map +1 -0
  34. package/dist/types/current/streaming/AudioOptions.js +15 -0
  35. package/dist/types/current/streaming/LoadMetric.d.ts +58 -0
  36. package/dist/types/current/streaming/LoadMetric.d.ts.map +1 -0
  37. package/dist/types/current/streaming/LoadMetric.js +5 -0
  38. package/dist/types/current/streaming/ManifestControllerImpl.d.ts +43 -0
  39. package/dist/types/current/streaming/ManifestControllerImpl.d.ts.map +1 -0
  40. package/dist/types/current/streaming/ManifestControllerImpl.js +104 -0
  41. package/dist/types/current/streaming/buffering/codecDenylist.d.ts +23 -0
  42. package/dist/types/current/streaming/buffering/codecDenylist.d.ts.map +1 -0
  43. package/dist/types/current/streaming/buffering/codecDenylist.js +62 -0
  44. package/dist/types/current/streaming/createAllowedContentTypesValue.d.ts +30 -0
  45. package/dist/types/current/streaming/createAllowedContentTypesValue.d.ts.map +1 -0
  46. package/dist/types/current/streaming/createAllowedContentTypesValue.js +43 -0
  47. package/dist/types/current/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
  48. package/dist/types/current/streaming/mediaTimelineAccessibilityFilter.d.ts.map +1 -0
  49. package/dist/types/current/streaming/mediaTimelineAccessibilityFilter.js +75 -0
  50. package/dist/types/current/text/HtmlTextTrackRenderer.d.ts +60 -0
  51. package/dist/types/current/text/HtmlTextTrackRenderer.d.ts.map +1 -0
  52. package/dist/types/current/text/HtmlTextTrackRenderer.js +231 -0
  53. package/dist/types/current/text/SidecarTextTrackController.d.ts +103 -0
  54. package/dist/types/current/text/SidecarTextTrackController.d.ts.map +1 -0
  55. package/dist/types/current/text/SidecarTextTrackController.js +250 -0
  56. package/dist/types/current/text/SidecarTextTrackLoader.d.ts +65 -0
  57. package/dist/types/current/text/SidecarTextTrackLoader.d.ts.map +1 -0
  58. package/dist/types/current/text/SidecarTextTrackLoader.js +150 -0
  59. package/dist/types/current/text/TextTrack.d.ts +179 -0
  60. package/dist/types/current/text/TextTrack.d.ts.map +1 -0
  61. package/dist/types/current/text/TextTrack.js +29 -0
  62. package/dist/types/current/text/TextTrackRenderer.d.ts +24 -0
  63. package/dist/types/current/text/TextTrackRenderer.d.ts.map +1 -0
  64. package/dist/types/current/text/TextTrackRenderer.js +5 -0
  65. package/dist/types/current/text/VttCueStyle.d.ts +41 -0
  66. package/dist/types/current/text/VttCueStyle.d.ts.map +1 -0
  67. package/dist/types/current/text/VttCueStyle.js +45 -0
  68. package/dist/types/current/text/discoverDashTextTracks.d.ts +24 -0
  69. package/dist/types/current/text/discoverDashTextTracks.d.ts.map +1 -0
  70. package/dist/types/current/text/discoverDashTextTracks.js +109 -0
  71. package/dist/types/current/text/discoverHlsTextTracks.d.ts +19 -0
  72. package/dist/types/current/text/discoverHlsTextTracks.d.ts.map +1 -0
  73. package/dist/types/current/text/discoverHlsTextTracks.js +49 -0
  74. package/dist/types/current/text/mediaTextTrackProvider.d.ts +34 -0
  75. package/dist/types/current/text/mediaTextTrackProvider.d.ts.map +1 -0
  76. package/dist/types/current/text/mediaTextTrackProvider.js +42 -0
  77. package/dist/types/current/text/parseWebVtt.d.ts +60 -0
  78. package/dist/types/current/text/parseWebVtt.d.ts.map +1 -0
  79. package/dist/types/current/text/parseWebVtt.js +248 -0
  80. package/dist/types/current/text/pickPreferredTextTrack.d.ts +15 -0
  81. package/dist/types/current/text/pickPreferredTextTrack.d.ts.map +1 -0
  82. package/dist/types/current/text/pickPreferredTextTrack.js +71 -0
  83. package/dist/types/current/track/SeekRange.d.ts +9 -0
  84. package/dist/types/current/track/SeekRange.d.ts.map +1 -0
  85. package/dist/types/current/track/SeekRange.js +5 -0
  86. package/dist/types/current/track/hls/HlsManifestData.d.ts +19 -0
  87. package/dist/types/current/track/hls/HlsManifestData.d.ts.map +1 -0
  88. package/dist/types/current/track/hls/HlsManifestData.js +5 -0
  89. package/dist/types/current/track/hls/createHlsManifestProvider.d.ts +6 -0
  90. package/dist/types/current/track/hls/createHlsManifestProvider.d.ts.map +1 -0
  91. package/dist/types/current/track/hls/createHlsManifestProvider.js +9 -0
  92. package/dist/types/current/track/inferLoadOptionsFromUri.d.ts +15 -0
  93. package/dist/types/current/track/inferLoadOptionsFromUri.d.ts.map +1 -0
  94. package/dist/types/current/track/inferLoadOptionsFromUri.js +55 -0
  95. package/dist/types/current/tsconfig.tsbuildinfo +1 -1
  96. package/dist/types/current/util/media/codecOverrides.d.ts +33 -0
  97. package/dist/types/current/util/media/codecOverrides.d.ts.map +1 -0
  98. package/dist/types/current/util/media/codecOverrides.js +37 -0
  99. package/dist/types/current/util/media/codecSupport.d.ts +6 -0
  100. package/dist/types/current/util/media/codecSupport.d.ts.map +1 -0
  101. package/dist/types/current/util/media/codecSupport.js +17 -0
  102. package/dist/types/current/util/media/mimeType.d.ts +8 -0
  103. package/dist/types/current/util/media/mimeType.d.ts.map +1 -0
  104. package/dist/types/current/util/media/mimeType.js +13 -0
  105. package/dist/types/ts3.7/ad/AdBreakInfo.d.ts +160 -0
  106. package/dist/types/ts3.7/ad/AdController.d.ts +243 -0
  107. package/dist/types/ts3.7/ad/AdControllerImpl.d.ts +146 -0
  108. package/dist/types/ts3.7/ad/AdError.d.ts +6 -0
  109. package/dist/types/ts3.7/ad/AdsProvider.d.ts +28 -0
  110. package/dist/types/ts3.7/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
  111. package/dist/types/ts3.7/ad/discoverHlsInterstitials.d.ts +22 -0
  112. package/dist/types/ts3.7/playback/PlaybackControllerImpl.d.ts +1 -1
  113. package/dist/types/ts3.7/streaming/AudioOptions.d.ts +39 -0
  114. package/dist/types/ts3.7/streaming/LoadMetric.d.ts +58 -0
  115. package/dist/types/ts3.7/streaming/ManifestControllerImpl.d.ts +40 -0
  116. package/dist/types/ts3.7/streaming/buffering/codecDenylist.d.ts +23 -0
  117. package/dist/types/ts3.7/streaming/createAllowedContentTypesValue.d.ts +30 -0
  118. package/dist/types/ts3.7/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
  119. package/dist/types/ts3.7/text/HtmlTextTrackRenderer.d.ts +60 -0
  120. package/dist/types/ts3.7/text/SidecarTextTrackController.d.ts +103 -0
  121. package/dist/types/ts3.7/text/SidecarTextTrackLoader.d.ts +65 -0
  122. package/dist/types/ts3.7/text/TextTrack.d.ts +183 -0
  123. package/dist/types/ts3.7/text/TextTrackRenderer.d.ts +24 -0
  124. package/dist/types/ts3.7/text/VttCueStyle.d.ts +41 -0
  125. package/dist/types/ts3.7/text/discoverDashTextTracks.d.ts +24 -0
  126. package/dist/types/ts3.7/text/discoverHlsTextTracks.d.ts +19 -0
  127. package/dist/types/ts3.7/text/mediaTextTrackProvider.d.ts +34 -0
  128. package/dist/types/ts3.7/text/parseWebVtt.d.ts +60 -0
  129. package/dist/types/ts3.7/text/pickPreferredTextTrack.d.ts +15 -0
  130. package/dist/types/ts3.7/track/SeekRange.d.ts +9 -0
  131. package/dist/types/ts3.7/track/hls/HlsManifestData.d.ts +19 -0
  132. package/dist/types/ts3.7/track/hls/createHlsManifestProvider.d.ts +6 -0
  133. package/dist/types/ts3.7/track/inferLoadOptionsFromUri.d.ts +15 -0
  134. package/dist/types/ts3.7/util/media/codecOverrides.d.ts +33 -0
  135. package/dist/types/ts3.7/util/media/codecSupport.d.ts +6 -0
  136. package/dist/types/ts3.7/util/media/mimeType.d.ts +8 -0
  137. package/dist/types/ts4.1/ad/AdBreakInfo.d.ts +160 -0
  138. package/dist/types/ts4.1/ad/AdController.d.ts +243 -0
  139. package/dist/types/ts4.1/ad/AdControllerImpl.d.ts +146 -0
  140. package/dist/types/ts4.1/ad/AdError.d.ts +6 -0
  141. package/dist/types/ts4.1/ad/AdsProvider.d.ts +28 -0
  142. package/dist/types/ts4.1/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
  143. package/dist/types/ts4.1/ad/discoverHlsInterstitials.d.ts +22 -0
  144. package/dist/types/ts4.1/playback/PlaybackControllerImpl.d.ts +1 -1
  145. package/dist/types/ts4.1/streaming/AudioOptions.d.ts +39 -0
  146. package/dist/types/ts4.1/streaming/LoadMetric.d.ts +58 -0
  147. package/dist/types/ts4.1/streaming/ManifestControllerImpl.d.ts +40 -0
  148. package/dist/types/ts4.1/streaming/buffering/codecDenylist.d.ts +23 -0
  149. package/dist/types/ts4.1/streaming/createAllowedContentTypesValue.d.ts +30 -0
  150. package/dist/types/ts4.1/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
  151. package/dist/types/ts4.1/text/HtmlTextTrackRenderer.d.ts +60 -0
  152. package/dist/types/ts4.1/text/SidecarTextTrackController.d.ts +104 -0
  153. package/dist/types/ts4.1/text/SidecarTextTrackLoader.d.ts +65 -0
  154. package/dist/types/ts4.1/text/TextTrack.d.ts +183 -0
  155. package/dist/types/ts4.1/text/TextTrackRenderer.d.ts +24 -0
  156. package/dist/types/ts4.1/text/VttCueStyle.d.ts +41 -0
  157. package/dist/types/ts4.1/text/discoverDashTextTracks.d.ts +24 -0
  158. package/dist/types/ts4.1/text/discoverHlsTextTracks.d.ts +19 -0
  159. package/dist/types/ts4.1/text/mediaTextTrackProvider.d.ts +34 -0
  160. package/dist/types/ts4.1/text/parseWebVtt.d.ts +60 -0
  161. package/dist/types/ts4.1/text/pickPreferredTextTrack.d.ts +15 -0
  162. package/dist/types/ts4.1/track/SeekRange.d.ts +9 -0
  163. package/dist/types/ts4.1/track/hls/HlsManifestData.d.ts +19 -0
  164. package/dist/types/ts4.1/track/hls/createHlsManifestProvider.d.ts +6 -0
  165. package/dist/types/ts4.1/track/inferLoadOptionsFromUri.d.ts +15 -0
  166. package/dist/types/ts4.1/util/media/codecOverrides.d.ts +33 -0
  167. package/dist/types/ts4.1/util/media/codecSupport.d.ts +6 -0
  168. package/dist/types/ts4.1/util/media/mimeType.d.ts +8 -0
  169. package/dist/types/ts4.7/ad/AdBreakInfo.d.ts +160 -0
  170. package/dist/types/ts4.7/ad/AdController.d.ts +243 -0
  171. package/dist/types/ts4.7/ad/AdControllerImpl.d.ts +146 -0
  172. package/dist/types/ts4.7/ad/AdError.d.ts +6 -0
  173. package/dist/types/ts4.7/ad/AdsProvider.d.ts +28 -0
  174. package/dist/types/ts4.7/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
  175. package/dist/types/ts4.7/ad/discoverHlsInterstitials.d.ts +22 -0
  176. package/dist/types/ts4.7/playback/PlaybackControllerImpl.d.ts +1 -1
  177. package/dist/types/ts4.7/streaming/AudioOptions.d.ts +39 -0
  178. package/dist/types/ts4.7/streaming/LoadMetric.d.ts +58 -0
  179. package/dist/types/ts4.7/streaming/ManifestControllerImpl.d.ts +43 -0
  180. package/dist/types/ts4.7/streaming/buffering/codecDenylist.d.ts +23 -0
  181. package/dist/types/ts4.7/streaming/createAllowedContentTypesValue.d.ts +30 -0
  182. package/dist/types/ts4.7/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
  183. package/dist/types/ts4.7/text/HtmlTextTrackRenderer.d.ts +60 -0
  184. package/dist/types/ts4.7/text/SidecarTextTrackController.d.ts +103 -0
  185. package/dist/types/ts4.7/text/SidecarTextTrackLoader.d.ts +65 -0
  186. package/dist/types/ts4.7/text/TextTrack.d.ts +183 -0
  187. package/dist/types/ts4.7/text/TextTrackRenderer.d.ts +24 -0
  188. package/dist/types/ts4.7/text/VttCueStyle.d.ts +41 -0
  189. package/dist/types/ts4.7/text/discoverDashTextTracks.d.ts +24 -0
  190. package/dist/types/ts4.7/text/discoverHlsTextTracks.d.ts +19 -0
  191. package/dist/types/ts4.7/text/mediaTextTrackProvider.d.ts +34 -0
  192. package/dist/types/ts4.7/text/parseWebVtt.d.ts +60 -0
  193. package/dist/types/ts4.7/text/pickPreferredTextTrack.d.ts +15 -0
  194. package/dist/types/ts4.7/track/SeekRange.d.ts +9 -0
  195. package/dist/types/ts4.7/track/hls/HlsManifestData.d.ts +19 -0
  196. package/dist/types/ts4.7/track/hls/createHlsManifestProvider.d.ts +6 -0
  197. package/dist/types/ts4.7/track/inferLoadOptionsFromUri.d.ts +15 -0
  198. package/dist/types/ts4.7/util/media/codecOverrides.d.ts +33 -0
  199. package/dist/types/ts4.7/util/media/codecSupport.d.ts +6 -0
  200. package/dist/types/ts4.7/util/media/mimeType.d.ts +8 -0
  201. package/dist/unit/types/current/ad/AdController.test.d.ts +2 -0
  202. package/dist/unit/types/current/ad/AdController.test.d.ts.map +1 -0
  203. package/dist/unit/types/current/ad/AdController.test.js +10 -0
  204. package/dist/unit/types/current/ad/AdControllerImpl.test.d.ts +2 -0
  205. package/dist/unit/types/current/ad/AdControllerImpl.test.d.ts.map +1 -0
  206. package/dist/unit/types/current/ad/AdControllerImpl.test.js +1456 -0
  207. package/dist/unit/types/current/ad/defaultAdLoadOptionsResolver.test.d.ts +2 -0
  208. package/dist/unit/types/current/ad/defaultAdLoadOptionsResolver.test.d.ts.map +1 -0
  209. package/dist/unit/types/current/ad/defaultAdLoadOptionsResolver.test.js +56 -0
  210. package/dist/unit/types/current/ad/discoverHlsInterstitials.test.d.ts +2 -0
  211. package/dist/unit/types/current/ad/discoverHlsInterstitials.test.d.ts.map +1 -0
  212. package/dist/unit/types/current/ad/discoverHlsInterstitials.test.js +756 -0
  213. package/dist/unit/types/current/drm/DrmControllerImpl.test.js +66 -1
  214. package/dist/unit/types/current/streaming/ManifestControllerImpl.test.d.ts +2 -0
  215. package/dist/unit/types/current/streaming/ManifestControllerImpl.test.d.ts.map +1 -0
  216. package/dist/unit/types/current/streaming/ManifestControllerImpl.test.js +197 -0
  217. package/dist/unit/types/current/streaming/buffering/codecDenylist.test.d.ts +2 -0
  218. package/dist/unit/types/current/streaming/buffering/codecDenylist.test.d.ts.map +1 -0
  219. package/dist/unit/types/current/streaming/buffering/codecDenylist.test.js +56 -0
  220. package/dist/unit/types/current/streaming/createAllowedContentTypesValue.test.d.ts +2 -0
  221. package/dist/unit/types/current/streaming/createAllowedContentTypesValue.test.d.ts.map +1 -0
  222. package/dist/unit/types/current/streaming/createAllowedContentTypesValue.test.js +77 -0
  223. package/dist/unit/types/current/streaming/mediaTimelineAccessibilityFilter.test.d.ts +2 -0
  224. package/dist/unit/types/current/streaming/mediaTimelineAccessibilityFilter.test.d.ts.map +1 -0
  225. package/dist/unit/types/current/streaming/mediaTimelineAccessibilityFilter.test.js +99 -0
  226. package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts +2 -0
  227. package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts.map +1 -0
  228. package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.js +231 -0
  229. package/dist/unit/types/current/text/SidecarTextTrackController.test.d.ts +2 -0
  230. package/dist/unit/types/current/text/SidecarTextTrackController.test.d.ts.map +1 -0
  231. package/dist/unit/types/current/text/SidecarTextTrackController.test.js +686 -0
  232. package/dist/unit/types/current/text/SidecarTextTrackLoader.test.d.ts +2 -0
  233. package/dist/unit/types/current/text/SidecarTextTrackLoader.test.d.ts.map +1 -0
  234. package/dist/unit/types/current/text/SidecarTextTrackLoader.test.js +365 -0
  235. package/dist/unit/types/current/text/VttCueStyle.test.d.ts +2 -0
  236. package/dist/unit/types/current/text/VttCueStyle.test.d.ts.map +1 -0
  237. package/dist/unit/types/current/text/VttCueStyle.test.js +76 -0
  238. package/dist/unit/types/current/text/discoverDashTextTracks.test.d.ts +2 -0
  239. package/dist/unit/types/current/text/discoverDashTextTracks.test.d.ts.map +1 -0
  240. package/dist/unit/types/current/text/discoverDashTextTracks.test.js +199 -0
  241. package/dist/unit/types/current/text/discoverHlsTextTracks.test.d.ts +2 -0
  242. package/dist/unit/types/current/text/discoverHlsTextTracks.test.d.ts.map +1 -0
  243. package/dist/unit/types/current/text/discoverHlsTextTracks.test.js +177 -0
  244. package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts +2 -0
  245. package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts.map +1 -0
  246. package/dist/unit/types/current/text/mediaTextTrackProvider.test.js +86 -0
  247. package/dist/unit/types/current/text/parseWebVtt.test.d.ts +2 -0
  248. package/dist/unit/types/current/text/parseWebVtt.test.d.ts.map +1 -0
  249. package/dist/unit/types/current/text/parseWebVtt.test.js +393 -0
  250. package/dist/unit/types/current/text/pickPreferredTextTrack.test.d.ts +2 -0
  251. package/dist/unit/types/current/text/pickPreferredTextTrack.test.d.ts.map +1 -0
  252. package/dist/unit/types/current/text/pickPreferredTextTrack.test.js +78 -0
  253. package/dist/unit/types/current/track/inferLoadOptionsFromUri.test.d.ts +2 -0
  254. package/dist/unit/types/current/track/inferLoadOptionsFromUri.test.d.ts.map +1 -0
  255. package/dist/unit/types/current/track/inferLoadOptionsFromUri.test.js +165 -0
  256. package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
  257. package/dist/unit/types/current/util/media/codecOverrides.test.d.ts +2 -0
  258. package/dist/unit/types/current/util/media/codecOverrides.test.d.ts.map +1 -0
  259. package/dist/unit/types/current/util/media/codecOverrides.test.js +42 -0
  260. package/dist/unit/types/current/util/media/codecSupport.test.d.ts +2 -0
  261. package/dist/unit/types/current/util/media/codecSupport.test.d.ts.map +1 -0
  262. package/dist/unit/types/current/util/media/codecSupport.test.js +26 -0
  263. package/dist/unit/types/current/util/media/mimeType.test.d.ts +2 -0
  264. package/dist/unit/types/current/util/media/mimeType.test.d.ts.map +1 -0
  265. package/dist/unit/types/current/util/media/mimeType.test.js +22 -0
  266. package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.d.ts +2 -0
  267. package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.d.ts.map +1 -0
  268. package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.js +142 -0
  269. package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.d.ts +2 -0
  270. package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.d.ts.map +1 -0
  271. package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.js +188 -0
  272. package/dist/vinylTestUtil/types/current/mock/ad/MockAdController.d.ts +15 -0
  273. package/dist/vinylTestUtil/types/current/mock/ad/MockAdController.d.ts.map +1 -0
  274. package/dist/vinylTestUtil/types/current/mock/ad/MockAdController.js +26 -0
  275. package/dist/vinylTestUtil/types/current/mock/dash/mockDashManifest.d.ts +84 -84
  276. package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts +10 -0
  277. package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts.map +1 -0
  278. package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.js +14 -0
  279. package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
  280. package/dist/vinylTestUtil/types/ts3.7/mock/ad/MockAdController.d.ts +15 -0
  281. package/dist/vinylTestUtil/types/ts3.7/mock/dash/mockDashManifest.d.ts +84 -84
  282. package/dist/vinylTestUtil/types/ts3.7/mock/text/MockTextTrackController.d.ts +10 -0
  283. package/dist/vinylTestUtil/types/ts4.1/mock/ad/MockAdController.d.ts +15 -0
  284. package/dist/vinylTestUtil/types/ts4.1/mock/dash/mockDashManifest.d.ts +84 -84
  285. package/dist/vinylTestUtil/types/ts4.1/mock/text/MockTextTrackController.d.ts +10 -0
  286. package/dist/vinylTestUtil/types/ts4.7/mock/ad/MockAdController.d.ts +15 -0
  287. package/dist/vinylTestUtil/types/ts4.7/mock/dash/mockDashManifest.d.ts +84 -84
  288. package/dist/vinylTestUtil/types/ts4.7/mock/text/MockTextTrackController.d.ts +10 -0
  289. package/package.json +10 -11
@@ -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,CAoGzD"}
@@ -0,0 +1,248 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { ErrorOrigin, ValidationError } from '@amazon/vinyl-util';
6
+ const WEBVTT_HEADER = 'WEBVTT';
7
+ // A single WebVTT timestamp anchored at the start: `[ hours ":" ] minutes ":"
8
+ // seconds "." ms`, with hours two-or-more digits (optional), minutes/seconds
9
+ // two digits in 0-59, and milliseconds three digits (per the spec's "collect a
10
+ // WebVTT timestamp"). Timestamp collection stops after the milliseconds — it is
11
+ // NOT anchored at the end — so the start match must be checked to consume its
12
+ // whole (pre-`-->`) token, while for the end match any remainder is cue
13
+ // settings. The only unbounded quantifier is `\d+`, followed by a literal `:`
14
+ // (no nested/overlapping quantifiers), so it matches in linear time, and it
15
+ // only ever runs against a single short token — backtracking is a non-issue.
16
+ const TIMESTAMP_RE = /^(?:(\d+):)?([0-5]\d):([0-5]\d)\.(\d{3})/;
17
+ /**
18
+ * Parses a WebVTT document into a list of cues.
19
+ *
20
+ * Implements a forgiving subset of the WebVTT 1.0 specification: header
21
+ * detection, comment blocks (lines starting with `NOTE`), styling/region
22
+ * blocks (STYLE bodies are captured, REGION skipped), cue identifiers, and
23
+ * HH:MM:SS.mmm or MM:SS.mmm timestamps with optional cue settings.
24
+ *
25
+ * @param input The raw WebVTT document text. Both LF and CRLF line endings
26
+ * are supported, and a leading BOM is stripped if present.
27
+ * @throws ValidationError if the input is missing the WEBVTT header.
28
+ * @see https://www.w3.org/TR/webvtt1/#webvtt-timestamp
29
+ */
30
+ export function parseWebVtt(input) {
31
+ if (typeof input !== 'string') {
32
+ throw new ValidationError('WebVTT input must be a string', ErrorOrigin.MEDIA);
33
+ }
34
+ let text = input;
35
+ // Strip a leading BOM, then normalize line endings.
36
+ if (text.charCodeAt(0) === 0xfeff)
37
+ text = text.slice(1);
38
+ const lines = text.split(/\r\n|\r|\n/);
39
+ if (lines.length === 0 || !isWebVttHeader(lines[0])) {
40
+ throw new ValidationError('WebVTT must begin with a WEBVTT header', ErrorOrigin.MEDIA);
41
+ }
42
+ const cues = [];
43
+ const styles = [];
44
+ // Per the WebVTT spec, everything from the `WEBVTT` signature up to (and
45
+ // including) the first blank line is the file header — metadata lines (e.g.
46
+ // HLS's `X-TIMESTAMP-MAP=...`) belong in that block and MUST NOT be
47
+ // interpreted as cue content.
48
+ let i = 1;
49
+ while (i < lines.length && lines[i] !== '')
50
+ i++;
51
+ while (i < lines.length) {
52
+ // Skip blank lines between blocks.
53
+ if (lines[i] === '') {
54
+ i++;
55
+ continue;
56
+ }
57
+ // NOTE comment / REGION blocks: skip until the blank line. A NOTE line
58
+ // is `NOTE` alone or `NOTE` followed by whitespace (space or tab).
59
+ if (lines[i] === 'NOTE' ||
60
+ lines[i].startsWith('NOTE ') ||
61
+ lines[i].startsWith('NOTE\t') ||
62
+ lines[i] === 'REGION') {
63
+ i++;
64
+ while (i < lines.length && lines[i] !== '')
65
+ i++;
66
+ continue;
67
+ }
68
+ // STYLE block: capture its CSS body (up to the blank line).
69
+ if (lines[i] === 'STYLE') {
70
+ i++;
71
+ const start = i;
72
+ while (i < lines.length && lines[i] !== '')
73
+ i++;
74
+ const css = lines.slice(start, i).join('\n').trim();
75
+ if (css)
76
+ styles.push(css);
77
+ continue;
78
+ }
79
+ // Cue: an optional identifier line, then a timing line, then payload.
80
+ // A cue identifier never contains `-->`, so a line without it is the
81
+ // identifier and the timing line follows (spec: "collect a WebVTT
82
+ // block").
83
+ let id = null;
84
+ if (!lines[i].includes('-->')) {
85
+ id = lines[i];
86
+ i++;
87
+ if (i >= lines.length)
88
+ break; // identifier with no timing line
89
+ }
90
+ const timing = parseTiming(lines[i]);
91
+ i++;
92
+ if (!timing) {
93
+ // Malformed timing line: drain to the next blank line.
94
+ while (i < lines.length && lines[i] !== '')
95
+ i++;
96
+ continue;
97
+ }
98
+ const payloadLines = [];
99
+ while (i < lines.length && lines[i] !== '') {
100
+ payloadLines.push(lines[i]);
101
+ i++;
102
+ }
103
+ const text = payloadLines.join('\n');
104
+ // Omit the optional `settings` key entirely when there are none.
105
+ cues.push(timing.settings === undefined
106
+ ? {
107
+ id,
108
+ startTime: timing.startTime,
109
+ endTime: timing.endTime,
110
+ text,
111
+ }
112
+ : {
113
+ id,
114
+ startTime: timing.startTime,
115
+ endTime: timing.endTime,
116
+ text,
117
+ settings: timing.settings,
118
+ });
119
+ }
120
+ return { cues, styles };
121
+ }
122
+ /**
123
+ * Parses a WebVTT timing line ("start --> end settings"), returning the two
124
+ * times (in seconds) and any parsed cue settings, or null if it is not a valid
125
+ * timing line. Splitting on the literal `-->` (and on the whitespace before the
126
+ * settings) keeps each timestamp match a fixed, anchored token.
127
+ */
128
+ function parseTiming(line) {
129
+ const arrow = line.indexOf('-->');
130
+ if (arrow < 0)
131
+ return null;
132
+ // Before the arrow: only the start timestamp (whitespace-trimmed), so the
133
+ // match must consume the whole token.
134
+ const before = line.slice(0, arrow).trim();
135
+ const start = TIMESTAMP_RE.exec(before);
136
+ if (!start || start[0].length !== before.length)
137
+ return null;
138
+ // After the arrow: the end timestamp, then whatever follows is cue settings.
139
+ const rest = line.slice(arrow + 3).trim();
140
+ const end = TIMESTAMP_RE.exec(rest);
141
+ if (!end)
142
+ return null;
143
+ return {
144
+ startTime: toSeconds(start[1], start[2], start[3], start[4]),
145
+ endTime: toSeconds(end[1], end[2], end[3], end[4]),
146
+ settings: parseCueSettings(rest.slice(end[0].length)),
147
+ };
148
+ }
149
+ function toSeconds(hours, minutes, seconds, millis) {
150
+ return ((hours ? Number(hours) * 3600 : 0) +
151
+ Number(minutes) * 60 +
152
+ Number(seconds) +
153
+ Number(millis) / 1000);
154
+ }
155
+ function isWebVttHeader(line) {
156
+ if (!line.startsWith(WEBVTT_HEADER))
157
+ return false;
158
+ if (line.length === WEBVTT_HEADER.length)
159
+ return true;
160
+ const next = line.charCodeAt(WEBVTT_HEADER.length);
161
+ // Header may be followed by space, tab, or any text after a separator.
162
+ return next === 0x20 || next === 0x09;
163
+ }
164
+ const ALIGN = new Set(['start', 'center', 'end', 'left', 'right']);
165
+ const LINE_ALIGN = new Set(['start', 'center', 'end']);
166
+ const POSITION_ALIGN = new Set(['line-left', 'center', 'line-right', 'auto']);
167
+ const VERTICAL = new Set(['rl', 'lr']);
168
+ /**
169
+ * Parses the cue-settings tail of a timing line (e.g.
170
+ * `align:center line:80% position:50%,center size:90% vertical:rl`) into a
171
+ * {@link VttCueStyle}. Unknown keys and malformed values are skipped; returns
172
+ * undefined when nothing valid was found.
173
+ */
174
+ function parseCueSettings(text) {
175
+ if (!text)
176
+ return undefined;
177
+ const settings = {};
178
+ for (const token of text.trim().split(/\s+/)) {
179
+ const colon = token.indexOf(':');
180
+ if (colon <= 0)
181
+ continue;
182
+ const key = token.slice(0, colon);
183
+ const value = token.slice(colon + 1);
184
+ switch (key) {
185
+ case 'align': {
186
+ // 'middle' is the legacy spelling of 'center'.
187
+ const align = value === 'middle' ? 'center' : value;
188
+ if (ALIGN.has(align))
189
+ settings.align = align;
190
+ break;
191
+ }
192
+ case 'vertical':
193
+ if (VERTICAL.has(value))
194
+ settings.vertical = value;
195
+ break;
196
+ case 'size': {
197
+ const size = parsePercent(value);
198
+ if (size != null)
199
+ settings.size = size;
200
+ break;
201
+ }
202
+ case 'line':
203
+ parseLine(value, settings);
204
+ break;
205
+ case 'position':
206
+ parsePosition(value, settings);
207
+ break;
208
+ }
209
+ }
210
+ return Object.keys(settings).length > 0 ? settings : undefined;
211
+ }
212
+ function parseLine(value, settings) {
213
+ const [pos, align] = value.split(',');
214
+ if (pos.endsWith('%')) {
215
+ const percent = parsePercent(pos);
216
+ if (percent == null)
217
+ return;
218
+ settings.line = percent;
219
+ settings.snapToLines = false;
220
+ }
221
+ else {
222
+ const n = Number(pos);
223
+ if (!Number.isInteger(n))
224
+ return;
225
+ settings.line = n;
226
+ settings.snapToLines = true;
227
+ }
228
+ const lineAlign = align === 'middle' ? 'center' : align;
229
+ if (lineAlign && LINE_ALIGN.has(lineAlign))
230
+ settings.lineAlign = lineAlign;
231
+ }
232
+ function parsePosition(value, settings) {
233
+ const [pos, align] = value.split(',');
234
+ const percent = parsePercent(pos);
235
+ if (percent == null)
236
+ return;
237
+ settings.position = percent;
238
+ const positionAlign = align === 'middle' ? 'center' : align;
239
+ if (positionAlign && POSITION_ALIGN.has(positionAlign))
240
+ settings.positionAlign = positionAlign;
241
+ }
242
+ /** Parses an `N%` token to its numeric percentage, or null when malformed. */
243
+ function parsePercent(value) {
244
+ if (!value.endsWith('%'))
245
+ return null;
246
+ const n = Number(value.slice(0, -1));
247
+ return Number.isFinite(n) ? n : null;
248
+ }
@@ -0,0 +1,15 @@
1
+ import type { TextTrackInfo } from './TextTrack';
2
+ import type { Maybe } from '@amazon/vinyl-util';
3
+ /**
4
+ * Chooses the text track that best matches the preferred language(s), or null
5
+ * when none relate (or there is no preference / no tracks).
6
+ *
7
+ * Language dominates: a track is ranked first by which preference it relates to
8
+ * (earlier entries win) and how closely (see {@link languageRelatedness}).
9
+ * Within a single language, a full track is preferred over a forced-only track
10
+ * (a user asking for a caption language wants the full captions, not just the
11
+ * forced foreign-dialogue cues), and a manifest-default track breaks any
12
+ * remaining tie.
13
+ */
14
+ export declare function pickPreferredTextTrack(tracks: readonly TextTrackInfo[], preferred: Maybe<string | readonly string[]>): TextTrackInfo | null;
15
+ //# sourceMappingURL=pickPreferredTextTrack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pickPreferredTextTrack.d.ts","sourceRoot":"","sources":["../../../../src/text/pickPreferredTextTrack.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAkB/C;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,GAC7C,aAAa,GAAG,IAAI,CActB"}
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { languageRelatedness } from '../track/filters/languageFilter';
6
+ /**
7
+ * Resolves the preferred-text-language option to an ordered list of BCP 47
8
+ * tags, most-preferred first. A string becomes a single-element list; an array
9
+ * is used as-is; unset (null/undefined) falls back to the platform's
10
+ * `navigator.languages`. Returns an empty list only when there is no preference
11
+ * and no `navigator.languages` — in which case nothing is selected.
12
+ */
13
+ function resolvePreferredTextLanguages(preferred) {
14
+ if (typeof preferred === 'string')
15
+ return [preferred];
16
+ if (preferred)
17
+ return preferred;
18
+ if (typeof navigator !== 'undefined')
19
+ return [...navigator.languages];
20
+ return [];
21
+ }
22
+ /**
23
+ * Chooses the text track that best matches the preferred language(s), or null
24
+ * when none relate (or there is no preference / no tracks).
25
+ *
26
+ * Language dominates: a track is ranked first by which preference it relates to
27
+ * (earlier entries win) and how closely (see {@link languageRelatedness}).
28
+ * Within a single language, a full track is preferred over a forced-only track
29
+ * (a user asking for a caption language wants the full captions, not just the
30
+ * forced foreign-dialogue cues), and a manifest-default track breaks any
31
+ * remaining tie.
32
+ */
33
+ export function pickPreferredTextTrack(tracks, preferred) {
34
+ const prefs = resolvePreferredTextLanguages(preferred);
35
+ if (tracks.length === 0 || prefs.length === 0)
36
+ return null;
37
+ let best = null;
38
+ let bestScore = 0;
39
+ for (const track of tracks) {
40
+ const score = scoreTextTrack(track, prefs);
41
+ if (score > bestScore) {
42
+ bestScore = score;
43
+ best = track;
44
+ }
45
+ }
46
+ return best;
47
+ }
48
+ /**
49
+ * Scores a track against the ordered preference list. 0 means unrelated to
50
+ * every preference (never selected). Preference position and language
51
+ * relatedness are weighted so they dominate the full/forced/default tiebreaks.
52
+ */
53
+ function scoreTextTrack(track, prefs) {
54
+ if (track.language == null)
55
+ return 0;
56
+ let best = 0;
57
+ for (let i = 0; i < prefs.length; i++) {
58
+ const rel = languageRelatedness(prefs[i], track.language);
59
+ if (rel > 0) {
60
+ best = Math.max(best, (prefs.length - i) * 100 + rel * 10);
61
+ }
62
+ }
63
+ if (best === 0)
64
+ return 0;
65
+ // Tiebreaks within the same language: prefer full over forced, then default.
66
+ if (!track.forced)
67
+ best += 2;
68
+ if (track.default)
69
+ best += 1;
70
+ return best;
71
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The seekable time range on the media timeline, in seconds.
3
+ * `end` will be `Infinity` when a live stream.
4
+ */
5
+ export type SeekRange = {
6
+ readonly start: number;
7
+ readonly end: number;
8
+ };
9
+ //# sourceMappingURL=SeekRange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeekRange.d.ts","sourceRoot":"","sources":["../../../../src/track/SeekRange.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA"}
@@ -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,19 @@
1
+ import type { HlsMainPlaylist, HlsMediaPlaylist } from '@amazon/vinyl-hls-parser';
2
+ export interface HlsManifestData {
3
+ /**
4
+ * The main HLS playlist manifest.
5
+ * Use getMediaPlaylist to resolve bitrate manifests.
6
+ */
7
+ readonly mainPlaylist: HlsMainPlaylist;
8
+ /**
9
+ * The URL to be used for relative requests. Guaranteed to be absolute.
10
+ *
11
+ * Media with relative paths in the manifests will be resolved relative to this URL.
12
+ */
13
+ readonly baseUrl: string;
14
+ /**
15
+ * Lazily fetches and caches a media playlist by variant URI.
16
+ */
17
+ readonly getMediaPlaylist: (uri: string) => Promise<HlsMediaPlaylist>;
18
+ }
19
+ //# sourceMappingURL=HlsManifestData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HlsManifestData.d.ts","sourceRoot":"","sources":["../../../../../src/track/hls/HlsManifestData.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,eAAe,EACf,gBAAgB,EACnB,MAAM,0BAA0B,CAAA;AAEjC,MAAM,WAAW,eAAe;IAC5B;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAA;IAEtC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACxE"}
@@ -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,6 @@
1
+ import type { HlsTrackLoadOptions } from './HlsTrack';
2
+ import type { ManifestProvider } from '../../streaming/ManifestController';
3
+ import type { HlsManifestData } from './HlsManifestData';
4
+ export declare function createHlsManifestProvider(loadOptions: HlsTrackLoadOptions): HlsManifestProvider;
5
+ export type HlsManifestProvider = ManifestProvider<HlsManifestData>;
6
+ //# sourceMappingURL=createHlsManifestProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHlsManifestProvider.d.ts","sourceRoot":"","sources":["../../../../../src/track/hls/createHlsManifestProvider.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,wBAAgB,yBAAyB,CACrC,WAAW,EAAE,mBAAmB,GACjC,mBAAmB,CAQrB;AAED,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { createUrlHlsManifestProvider } from './createUrlHlsManifestProvider';
6
+ export function createHlsManifestProvider(loadOptions) {
7
+ return (loadOptions.manifestProvider ||
8
+ createUrlHlsManifestProvider(loadOptions.uri, loadOptions.requestInit || undefined));
9
+ }
@@ -0,0 +1,15 @@
1
+ import type { VinylTrackLoadOptions } from './createVinylTrackFactories';
2
+ /**
3
+ * The built-in track types Vinyl can infer from a URI.
4
+ */
5
+ export type TrackType = 'hls' | 'dash' | 'src';
6
+ /**
7
+ * Infers the track type from a URI based first on its file extension
8
+ * then mime type.
9
+ *
10
+ * Returns null if the type cannot be determined.
11
+ */
12
+ export declare function inferTrackTypeFromUrl(url: string): Promise<TrackType | null>;
13
+ export declare function inferTrackTypeFromUrlPath(url: string): TrackType | null;
14
+ export declare function createTrackLoadOptionsFromUrl(url: string): Promise<VinylTrackLoadOptions | null>;
15
+ //# sourceMappingURL=inferLoadOptionsFromUri.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inferLoadOptionsFromUri.d.ts","sourceRoot":"","sources":["../../../../src/track/inferLoadOptionsFromUri.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAGxE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;AAE9C;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACvC,GAAG,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAE3B;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAMvE;AAED,wBAAsB,6BAA6B,CAC/C,GAAG,EAAE,MAAM,GACZ,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAKvC"}