@amazon/vinyl 3.0.1 → 3.2.0

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 (268) hide show
  1. package/dist/index.cjs +1103 -1042
  2. package/dist/index.cjs.map +4 -4
  3. package/dist/index.js +810 -739
  4. package/dist/index.js.map +4 -4
  5. package/dist/test/benchmark.js.map +2 -2
  6. package/dist/test/integ.es5.js +394 -388
  7. package/dist/test/integ.js +2626 -2032
  8. package/dist/test/integ.js.map +4 -4
  9. package/dist/test/jasmine.css +50 -3
  10. package/dist/test/jasmineHtml.es5.js +195 -155
  11. package/dist/test/jasmineHtml.js +2938 -1833
  12. package/dist/test/jasmineHtml.js.map +3 -3
  13. package/dist/types/current/ad/AdControllerImpl.d.ts.map +1 -1
  14. package/dist/types/current/ad/AdControllerImpl.js +4 -1
  15. package/dist/types/current/ad/discoverHlsInterstitials.d.ts.map +1 -1
  16. package/dist/types/current/ad/discoverHlsInterstitials.js +2 -2
  17. package/dist/types/current/drm/DrmControllerImpl.d.ts +19 -1
  18. package/dist/types/current/drm/DrmControllerImpl.d.ts.map +1 -1
  19. package/dist/types/current/drm/DrmControllerImpl.js +101 -58
  20. package/dist/types/current/drm/licenseProvider/defaultLicenseProvider.d.ts.map +1 -1
  21. package/dist/types/current/drm/licenseProvider/defaultLicenseProvider.js +2 -2
  22. package/dist/types/current/index.d.ts +3 -6
  23. package/dist/types/current/index.d.ts.map +1 -1
  24. package/dist/types/current/index.js +3 -6
  25. package/dist/types/current/playback/PlaybackControllerImpl.d.ts +15 -0
  26. package/dist/types/current/playback/PlaybackControllerImpl.d.ts.map +1 -1
  27. package/dist/types/current/playback/PlaybackControllerImpl.js +100 -9
  28. package/dist/types/current/playback/ReadonlyPlaybackController.d.ts +27 -1
  29. package/dist/types/current/playback/ReadonlyPlaybackController.d.ts.map +1 -1
  30. package/dist/types/current/playback/ReadonlyPlaybackController.js +16 -0
  31. package/dist/types/current/playback/createStallDetector.d.ts +43 -0
  32. package/dist/types/current/playback/createStallDetector.d.ts.map +1 -0
  33. package/dist/types/current/playback/createStallDetector.js +101 -0
  34. package/dist/types/current/playback/createStallMonitor.d.ts +45 -0
  35. package/dist/types/current/playback/createStallMonitor.d.ts.map +1 -0
  36. package/dist/types/current/playback/createStallMonitor.js +94 -0
  37. package/dist/types/current/streaming/AudioOptions.d.ts +27 -0
  38. package/dist/types/current/streaming/AudioOptions.d.ts.map +1 -1
  39. package/dist/types/current/streaming/AudioOptions.js +5 -1
  40. package/dist/types/current/streaming/ContentStream.d.ts +0 -5
  41. package/dist/types/current/streaming/ContentStream.d.ts.map +1 -1
  42. package/dist/types/current/streaming/ContentStream.js +0 -4
  43. package/dist/types/current/streaming/LoadMetric.d.ts +15 -1
  44. package/dist/types/current/streaming/LoadMetric.d.ts.map +1 -1
  45. package/dist/types/current/streaming/StreamingEventMap.d.ts +1 -5
  46. package/dist/types/current/streaming/StreamingEventMap.d.ts.map +1 -1
  47. package/dist/types/current/streaming/StreamingEventMap.js +0 -1
  48. package/dist/types/current/streaming/buffering/BufferingController.d.ts +0 -11
  49. package/dist/types/current/streaming/buffering/BufferingController.d.ts.map +1 -1
  50. package/dist/types/current/streaming/buffering/BufferingController.js +0 -13
  51. package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.d.ts.map +1 -1
  52. package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.js +13 -4
  53. package/dist/types/current/streaming/mediaTimelineFilter.d.ts +4 -2
  54. package/dist/types/current/streaming/mediaTimelineFilter.d.ts.map +1 -1
  55. package/dist/types/current/streaming/mediaTimelineFilter.js +23 -8
  56. package/dist/types/current/text/SidecarTextTrackLoader.d.ts.map +1 -1
  57. package/dist/types/current/text/SidecarTextTrackLoader.js +4 -4
  58. package/dist/types/current/text/TextTrack.d.ts.map +1 -1
  59. package/dist/types/current/track/TrackController.d.ts.map +1 -1
  60. package/dist/types/current/track/TrackController.js +8 -2
  61. package/dist/types/current/track/createSegmentDataProvider.d.ts.map +1 -1
  62. package/dist/types/current/track/createSegmentDataProvider.js +6 -3
  63. package/dist/types/current/track/dash/DashMediaQualityMetadataResolver.d.ts +10 -6
  64. package/dist/types/current/track/dash/DashMediaQualityMetadataResolver.d.ts.map +1 -1
  65. package/dist/types/current/track/dash/DashMediaQualityMetadataResolver.js +13 -8
  66. package/dist/types/current/track/dash/createDashFactories.d.ts +1 -1
  67. package/dist/types/current/track/dash/timeline/DashRepresentationSegmentProvider.d.ts.map +1 -1
  68. package/dist/types/current/track/dash/timeline/DashRepresentationSegmentProvider.js +71 -3
  69. package/dist/types/current/track/dash/urlDashManifestProvider.js +2 -2
  70. package/dist/types/current/track/dash/util/mpd.d.ts +6 -0
  71. package/dist/types/current/track/dash/util/mpd.d.ts.map +1 -1
  72. package/dist/types/current/track/dash/util/mpd.js +24 -3
  73. package/dist/types/current/track/filters/resourceTypeFilter.d.ts +4 -0
  74. package/dist/types/current/track/filters/resourceTypeFilter.d.ts.map +1 -1
  75. package/dist/types/current/track/filters/resourceTypeFilter.js +4 -0
  76. package/dist/types/current/track/filters/sampleRateFilter.d.ts +25 -7
  77. package/dist/types/current/track/filters/sampleRateFilter.d.ts.map +1 -1
  78. package/dist/types/current/track/filters/sampleRateFilter.js +52 -24
  79. package/dist/types/current/track/hls/createHlsFactories.d.ts +1 -1
  80. package/dist/types/current/track/hls/createUrlHlsManifestProvider.d.ts.map +1 -1
  81. package/dist/types/current/track/hls/createUrlHlsManifestProvider.js +3 -3
  82. package/dist/types/current/track/mse/MseTrack.d.ts +0 -17
  83. package/dist/types/current/track/mse/MseTrack.d.ts.map +1 -1
  84. package/dist/types/current/track/mse/MseTrack.js +1 -45
  85. package/dist/types/current/tsconfig.tsbuildinfo +1 -1
  86. package/dist/types/current/util/media/mimeType.d.ts +8 -0
  87. package/dist/types/current/util/media/mimeType.d.ts.map +1 -0
  88. package/dist/types/current/util/media/mimeType.js +13 -0
  89. package/dist/types/current/vinyl/VinylPlayer.d.ts +5 -0
  90. package/dist/types/current/vinyl/VinylPlayer.d.ts.map +1 -1
  91. package/dist/types/current/vinyl/VinylPlayer.js +23 -1
  92. package/dist/types/current/vinyl/createVinylFactories.d.ts +7 -16
  93. package/dist/types/current/vinyl/createVinylFactories.d.ts.map +1 -1
  94. package/dist/types/current/vinyl/createVinylFactories.js +2 -12
  95. package/dist/types/ts3.7/drm/DrmControllerImpl.d.ts +19 -1
  96. package/dist/types/ts3.7/index.d.ts +3 -6
  97. package/dist/types/ts3.7/playback/PlaybackControllerImpl.d.ts +15 -0
  98. package/dist/types/ts3.7/playback/ReadonlyPlaybackController.d.ts +28 -0
  99. package/dist/types/ts3.7/playback/createStallDetector.d.ts +43 -0
  100. package/dist/types/ts3.7/playback/createStallMonitor.d.ts +45 -0
  101. package/dist/types/ts3.7/streaming/AudioOptions.d.ts +27 -0
  102. package/dist/types/ts3.7/streaming/ContentStream.d.ts +0 -5
  103. package/dist/types/ts3.7/streaming/LoadMetric.d.ts +15 -1
  104. package/dist/types/ts3.7/streaming/StreamingEventMap.d.ts +0 -5
  105. package/dist/types/ts3.7/streaming/buffering/BufferingController.d.ts +0 -11
  106. package/dist/types/ts3.7/streaming/mediaTimelineFilter.d.ts +4 -2
  107. package/dist/types/ts3.7/track/dash/DashMediaQualityMetadataResolver.d.ts +10 -6
  108. package/dist/types/ts3.7/track/dash/createDashFactories.d.ts +1 -1
  109. package/dist/types/ts3.7/track/dash/util/mpd.d.ts +6 -0
  110. package/dist/types/ts3.7/track/filters/resourceTypeFilter.d.ts +4 -0
  111. package/dist/types/ts3.7/track/filters/sampleRateFilter.d.ts +25 -7
  112. package/dist/types/ts3.7/track/hls/createHlsFactories.d.ts +1 -1
  113. package/dist/types/ts3.7/track/mse/MseTrack.d.ts +0 -17
  114. package/dist/types/ts3.7/util/media/mimeType.d.ts +8 -0
  115. package/dist/types/ts3.7/vinyl/VinylPlayer.d.ts +5 -0
  116. package/dist/types/ts3.7/vinyl/createVinylFactories.d.ts +7 -16
  117. package/dist/types/ts4.1/drm/DrmControllerImpl.d.ts +19 -1
  118. package/dist/types/ts4.1/index.d.ts +3 -6
  119. package/dist/types/ts4.1/playback/PlaybackControllerImpl.d.ts +15 -0
  120. package/dist/types/ts4.1/playback/ReadonlyPlaybackController.d.ts +28 -0
  121. package/dist/types/ts4.1/playback/createStallDetector.d.ts +43 -0
  122. package/dist/types/ts4.1/playback/createStallMonitor.d.ts +45 -0
  123. package/dist/types/ts4.1/streaming/AudioOptions.d.ts +27 -0
  124. package/dist/types/ts4.1/streaming/ContentStream.d.ts +0 -5
  125. package/dist/types/ts4.1/streaming/LoadMetric.d.ts +15 -1
  126. package/dist/types/ts4.1/streaming/StreamingEventMap.d.ts +0 -5
  127. package/dist/types/ts4.1/streaming/buffering/BufferingController.d.ts +0 -11
  128. package/dist/types/ts4.1/streaming/mediaTimelineFilter.d.ts +4 -2
  129. package/dist/types/ts4.1/track/dash/DashMediaQualityMetadataResolver.d.ts +10 -6
  130. package/dist/types/ts4.1/track/dash/createDashFactories.d.ts +1 -1
  131. package/dist/types/ts4.1/track/dash/util/mpd.d.ts +6 -0
  132. package/dist/types/ts4.1/track/filters/resourceTypeFilter.d.ts +4 -0
  133. package/dist/types/ts4.1/track/filters/sampleRateFilter.d.ts +25 -7
  134. package/dist/types/ts4.1/track/hls/createHlsFactories.d.ts +1 -1
  135. package/dist/types/ts4.1/track/mse/MseTrack.d.ts +0 -17
  136. package/dist/types/ts4.1/util/media/mimeType.d.ts +8 -0
  137. package/dist/types/ts4.1/vinyl/VinylPlayer.d.ts +5 -0
  138. package/dist/types/ts4.1/vinyl/createVinylFactories.d.ts +7 -16
  139. package/dist/types/ts4.7/drm/DrmControllerImpl.d.ts +19 -1
  140. package/dist/types/ts4.7/index.d.ts +3 -6
  141. package/dist/types/ts4.7/playback/PlaybackControllerImpl.d.ts +15 -0
  142. package/dist/types/ts4.7/playback/ReadonlyPlaybackController.d.ts +28 -0
  143. package/dist/types/ts4.7/playback/createStallDetector.d.ts +43 -0
  144. package/dist/types/ts4.7/playback/createStallMonitor.d.ts +45 -0
  145. package/dist/types/ts4.7/streaming/AudioOptions.d.ts +27 -0
  146. package/dist/types/ts4.7/streaming/ContentStream.d.ts +0 -5
  147. package/dist/types/ts4.7/streaming/LoadMetric.d.ts +15 -1
  148. package/dist/types/ts4.7/streaming/StreamingEventMap.d.ts +0 -5
  149. package/dist/types/ts4.7/streaming/buffering/BufferingController.d.ts +0 -11
  150. package/dist/types/ts4.7/streaming/mediaTimelineFilter.d.ts +4 -2
  151. package/dist/types/ts4.7/track/dash/DashMediaQualityMetadataResolver.d.ts +10 -6
  152. package/dist/types/ts4.7/track/dash/createDashFactories.d.ts +1 -1
  153. package/dist/types/ts4.7/track/dash/util/mpd.d.ts +6 -0
  154. package/dist/types/ts4.7/track/filters/resourceTypeFilter.d.ts +4 -0
  155. package/dist/types/ts4.7/track/filters/sampleRateFilter.d.ts +25 -7
  156. package/dist/types/ts4.7/track/hls/createHlsFactories.d.ts +1 -1
  157. package/dist/types/ts4.7/track/mse/MseTrack.d.ts +0 -17
  158. package/dist/types/ts4.7/util/media/mimeType.d.ts +8 -0
  159. package/dist/types/ts4.7/vinyl/VinylPlayer.d.ts +5 -0
  160. package/dist/types/ts4.7/vinyl/createVinylFactories.d.ts +7 -16
  161. package/dist/unit/types/current/ad/AdControllerImpl.test.js +27 -1
  162. package/dist/unit/types/current/drm/DrmControllerImpl.test.js +146 -9
  163. package/dist/unit/types/current/index.d.ts +3 -4
  164. package/dist/unit/types/current/index.d.ts.map +1 -1
  165. package/dist/unit/types/current/index.js +3 -4
  166. package/dist/unit/types/current/playback/PlaybackControllerImpl.test.js +165 -0
  167. package/dist/unit/types/current/playback/createStallDetector.test.d.ts +2 -0
  168. package/dist/unit/types/current/playback/createStallDetector.test.d.ts.map +1 -0
  169. package/dist/unit/types/current/playback/createStallDetector.test.js +163 -0
  170. package/dist/unit/types/current/playback/createStallMonitor.test.d.ts +2 -0
  171. package/dist/unit/types/current/playback/createStallMonitor.test.d.ts.map +1 -0
  172. package/dist/unit/types/current/playback/createStallMonitor.test.js +125 -0
  173. package/dist/unit/types/current/streaming/ContentStream.test.js +0 -11
  174. package/dist/unit/types/current/streaming/MseTrack.test.js +49 -73
  175. package/dist/unit/types/current/streaming/abr/QualitySelectorImpl.test.js +1 -1
  176. package/dist/unit/types/current/streaming/buffering/BufferingController.test.js +0 -21
  177. package/dist/unit/types/current/streaming/createDefaultMediaTimelineTransformer.test.js +133 -0
  178. package/dist/unit/types/current/streaming/mediaTimelineFilter.test.js +60 -54
  179. package/dist/unit/types/current/track/TrackController.test.js +61 -1
  180. package/dist/unit/types/current/track/createSegmentDataProvider.test.js +18 -0
  181. package/dist/unit/types/current/track/dash/DashMediaQualityMetadataResolver.test.js +46 -14
  182. package/dist/unit/types/current/track/dash/createSegmentControllerFactory.test.js +1 -0
  183. package/dist/unit/types/current/track/dash/timeline/DashRepresentationSegmentProvider.test.js +114 -0
  184. package/dist/unit/types/current/track/dash/util/mpd.test.js +37 -0
  185. package/dist/unit/types/current/track/filters/resourceTypeFilter.test.js +7 -0
  186. package/dist/unit/types/current/track/filters/sampleRateFilter.test.js +211 -34
  187. package/dist/unit/types/current/track/source/SourceObjectTrack.test.js +1 -1
  188. package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
  189. package/dist/unit/types/current/util/media/mimeType.test.d.ts +2 -0
  190. package/dist/unit/types/current/util/media/mimeType.test.d.ts.map +1 -0
  191. package/dist/unit/types/current/util/media/mimeType.test.js +22 -0
  192. package/dist/unit/types/current/vinyl/VinylPlayer.test.js +33 -2
  193. package/dist/unit/types/current/vinyl/createVinylFactories.test.js +2 -36
  194. package/dist/vinylTestUtil/index.js +6 -4
  195. package/dist/vinylTestUtil/index.js.map +2 -2
  196. package/dist/vinylTestUtil/types/current/assets/vinylTestAssets.d.ts +1 -0
  197. package/dist/vinylTestUtil/types/current/assets/vinylTestAssets.d.ts.map +1 -1
  198. package/dist/vinylTestUtil/types/current/assets/vinylTestAssets.js +1 -0
  199. package/dist/vinylTestUtil/types/current/media/FrequencyAnalyzer.d.ts.map +1 -1
  200. package/dist/vinylTestUtil/types/current/mock/streaming/MockContentStream.d.ts +0 -1
  201. package/dist/vinylTestUtil/types/current/mock/streaming/MockContentStream.d.ts.map +1 -1
  202. package/dist/vinylTestUtil/types/current/mock/streaming/MockContentStream.js +0 -1
  203. package/dist/vinylTestUtil/types/current/mock/streaming/buffering/MockBufferingController.d.ts +0 -1
  204. package/dist/vinylTestUtil/types/current/mock/streaming/buffering/MockBufferingController.d.ts.map +1 -1
  205. package/dist/vinylTestUtil/types/current/mock/streaming/buffering/MockBufferingController.js +0 -1
  206. package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
  207. package/dist/vinylTestUtil/types/current/util/playback/eventPromises.js +1 -1
  208. package/dist/vinylTestUtil/types/current/util/playback/expectTrackCanSeek.d.ts.map +1 -1
  209. package/dist/vinylTestUtil/types/current/util/playback/expectTrackCanSeek.js +9 -1
  210. package/dist/vinylTestUtil/types/ts3.7/assets/vinylTestAssets.d.ts +1 -0
  211. package/dist/vinylTestUtil/types/ts3.7/mock/streaming/MockContentStream.d.ts +0 -1
  212. package/dist/vinylTestUtil/types/ts3.7/mock/streaming/buffering/MockBufferingController.d.ts +0 -1
  213. package/dist/vinylTestUtil/types/ts4.1/assets/vinylTestAssets.d.ts +1 -0
  214. package/dist/vinylTestUtil/types/ts4.1/mock/streaming/MockContentStream.d.ts +0 -1
  215. package/dist/vinylTestUtil/types/ts4.1/mock/streaming/buffering/MockBufferingController.d.ts +0 -1
  216. package/dist/vinylTestUtil/types/ts4.7/assets/vinylTestAssets.d.ts +1 -0
  217. package/dist/vinylTestUtil/types/ts4.7/mock/streaming/MockContentStream.d.ts +0 -1
  218. package/dist/vinylTestUtil/types/ts4.7/mock/streaming/buffering/MockBufferingController.d.ts +0 -1
  219. package/docs/USAGE.md +29 -0
  220. package/package.json +11 -10
  221. package/dist/types/current/patch/media/HtmlMediaElementPatch.d.ts +0 -3
  222. package/dist/types/current/patch/media/HtmlMediaElementPatch.d.ts.map +0 -1
  223. package/dist/types/current/patch/media/HtmlMediaElementPatch.js +0 -5
  224. package/dist/types/current/patch/media/MediaElementPatchOptions.d.ts +0 -19
  225. package/dist/types/current/patch/media/MediaElementPatchOptions.d.ts.map +0 -1
  226. package/dist/types/current/patch/media/MediaElementPatchOptions.js +0 -16
  227. package/dist/types/current/patch/media/patchMediaElement.d.ts +0 -9
  228. package/dist/types/current/patch/media/patchMediaElement.d.ts.map +0 -1
  229. package/dist/types/current/patch/media/patchMediaElement.js +0 -15
  230. package/dist/types/current/patch/media/patches/createPreventStallsPatch.d.ts +0 -17
  231. package/dist/types/current/patch/media/patches/createPreventStallsPatch.d.ts.map +0 -1
  232. package/dist/types/current/patch/media/patches/createPreventStallsPatch.js +0 -55
  233. package/dist/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts +0 -26
  234. package/dist/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts.map +0 -1
  235. package/dist/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.js +0 -218
  236. package/dist/types/current/vinyl/VinylPatchOptions.d.ts +0 -10
  237. package/dist/types/current/vinyl/VinylPatchOptions.d.ts.map +0 -1
  238. package/dist/types/current/vinyl/VinylPatchOptions.js +0 -11
  239. package/dist/types/ts3.7/patch/media/HtmlMediaElementPatch.d.ts +0 -3
  240. package/dist/types/ts3.7/patch/media/MediaElementPatchOptions.d.ts +0 -19
  241. package/dist/types/ts3.7/patch/media/patchMediaElement.d.ts +0 -9
  242. package/dist/types/ts3.7/patch/media/patches/createPreventStallsPatch.d.ts +0 -17
  243. package/dist/types/ts3.7/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts +0 -26
  244. package/dist/types/ts3.7/vinyl/VinylPatchOptions.d.ts +0 -10
  245. package/dist/types/ts4.1/patch/media/HtmlMediaElementPatch.d.ts +0 -3
  246. package/dist/types/ts4.1/patch/media/MediaElementPatchOptions.d.ts +0 -19
  247. package/dist/types/ts4.1/patch/media/patchMediaElement.d.ts +0 -9
  248. package/dist/types/ts4.1/patch/media/patches/createPreventStallsPatch.d.ts +0 -17
  249. package/dist/types/ts4.1/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts +0 -26
  250. package/dist/types/ts4.1/vinyl/VinylPatchOptions.d.ts +0 -10
  251. package/dist/types/ts4.7/patch/media/HtmlMediaElementPatch.d.ts +0 -3
  252. package/dist/types/ts4.7/patch/media/MediaElementPatchOptions.d.ts +0 -19
  253. package/dist/types/ts4.7/patch/media/patchMediaElement.d.ts +0 -9
  254. package/dist/types/ts4.7/patch/media/patches/createPreventStallsPatch.d.ts +0 -17
  255. package/dist/types/ts4.7/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts +0 -26
  256. package/dist/types/ts4.7/vinyl/VinylPatchOptions.d.ts +0 -10
  257. package/dist/unit/types/current/patch/media/MediaElementPatchOptions.test.d.ts +0 -2
  258. package/dist/unit/types/current/patch/media/MediaElementPatchOptions.test.d.ts.map +0 -1
  259. package/dist/unit/types/current/patch/media/MediaElementPatchOptions.test.js +0 -17
  260. package/dist/unit/types/current/patch/media/patchMediaElement.test.d.ts +0 -2
  261. package/dist/unit/types/current/patch/media/patchMediaElement.test.d.ts.map +0 -1
  262. package/dist/unit/types/current/patch/media/patchMediaElement.test.js +0 -36
  263. package/dist/unit/types/current/patch/media/patches/createPreventStallsPatch.test.d.ts +0 -2
  264. package/dist/unit/types/current/patch/media/patches/createPreventStallsPatch.test.d.ts.map +0 -1
  265. package/dist/unit/types/current/patch/media/patches/createPreventStallsPatch.test.js +0 -93
  266. package/dist/unit/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.test.d.ts +0 -2
  267. package/dist/unit/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.test.d.ts.map +0 -1
  268. package/dist/unit/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.test.js +0 -423
@@ -1,4 +1,5 @@
1
1
  import type { ObjectSchema } from '@amazon/vinyl-validation';
2
+ import type { Maybe } from '@amazon/vinyl-util';
2
3
  /**
3
4
  * Criteria used to pick which audio rendition to play.
4
5
  */
@@ -33,6 +34,32 @@ export interface AudioOptions {
33
34
  * The audio selection criteria (language / descriptive).
34
35
  */
35
36
  readonly selection?: AudioSelection;
37
+ /**
38
+ * When `true`, disables the audio sampling-rate support filter, so audio
39
+ * renditions whose sampling rate exceeds what the platform reports (via the
40
+ * `AudioContext` output rate) are kept and offered to playback anyway.
41
+ * `false` (the default) applies the filter. Changing this re-filters the
42
+ * timeline immediately.
43
+ */
44
+ readonly disableSampleRateFilter?: boolean;
45
+ /**
46
+ * The maximum audio sampling rate (Hz) the sampling-rate filter treats as
47
+ * supported. When set, it takes precedence over the platform's
48
+ * `AudioContext`-reported output rate. Ignored when
49
+ * {@link disableSampleRateFilter} is `true`. Changing this re-filters the
50
+ * timeline immediately. `null`/`undefined` falls back to the reported rate.
51
+ */
52
+ readonly maxSampleRate?: Maybe<number>;
53
+ /**
54
+ * The minimum audio sampling rate (Hz) the sampling-rate filter treats as
55
+ * supported. When set, renditions below it are filtered out as a soft floor
56
+ * (if every audio rendition is below it, the highest is kept so playback is
57
+ * never stranded). Applied alongside the max cap whenever the filter runs,
58
+ * regardless of how the max was determined; ignored when
59
+ * {@link disableSampleRateFilter} is `true`. Changing this re-filters the
60
+ * timeline immediately.
61
+ */
62
+ readonly minSampleRate?: Maybe<number>;
36
63
  }
37
64
  export declare const defaultAudioOptions: AudioOptions;
38
65
  export declare const audioOptionsValidator: ObjectSchema<AudioOptions>;
@@ -38,10 +38,6 @@ export interface ContentStream extends ReadonlyEventHost<StreamingEventMap>, Dis
38
38
  * True if the last segment has been appended.
39
39
  */
40
40
  readonly bufferingEnded: boolean;
41
- /**
42
- * True while this stream's buffer holds any data.
43
- */
44
- readonly hasData: boolean;
45
41
  /**
46
42
  * Starts prefetching with the given priority and prefetch start time.
47
43
  * @param options
@@ -96,7 +92,6 @@ export declare class ContentStreamImpl extends EventHostImpl<StreamingEventMap>
96
92
  get streamingQuality(): MediaQualityMetadata | null;
97
93
  get bufferingQuality(): MediaQualityMetadata | null;
98
94
  get playbackQuality(): MediaQualityMetadata | null;
99
- get hasData(): boolean;
100
95
  get bufferingEnded(): boolean;
101
96
  get error(): Error | null;
102
97
  /**
@@ -1,14 +1,17 @@
1
1
  import type { Timestamp } from '@amazon/vinyl-util';
2
2
  import type { TrackUri } from '../track/Track';
3
+ import type { ContentType } from './MediaQualityMetadata';
3
4
  /**
4
5
  * The stage of the track-load journey a {@link LoadSpanMeasurement} describes.
5
6
  *
6
7
  * - `manifest`: fetching and parsing the DASH/HLS manifest.
8
+ * - `keySetup`: the EME/CDM setup, from session creation to the CDM's first
9
+ * license message. Precedes and is contiguous with `license`.
7
10
  * - `license`: the DRM license request/response exchange.
8
11
  * - `initSegment`: fetching the initialization segment.
9
12
  * - `firstSegment`: fetching the first media segment.
10
13
  */
11
- export type LoadSpanKind = 'manifest' | 'license' | 'initSegment' | 'firstSegment';
14
+ export type LoadSpanKind = 'manifest' | 'keySetup' | 'license' | 'initSegment' | 'firstSegment';
12
15
  /**
13
16
  * A timed span for one stage of a track load.
14
17
  *
@@ -35,6 +38,17 @@ export interface LoadSpanMeasurement {
35
38
  * buffering DRM info is set).
36
39
  */
37
40
  readonly trackUri?: TrackUri;
41
+ /**
42
+ * The MIME type of the content this span was measured for, when known. Set
43
+ * for DRM `license` spans so a certificate exchange and the per-content-type
44
+ * license exchanges are distinguishable.
45
+ */
46
+ readonly mimeType?: string;
47
+ /**
48
+ * The content type this span was measured for, when known. Set alongside
49
+ * {@link mimeType} for DRM `license` spans.
50
+ */
51
+ readonly contentType?: ContentType;
38
52
  }
39
53
  /**
40
54
  * A {@link LoadSpanMeasurement} attributed to the track it was measured for.
@@ -34,10 +34,6 @@ export interface StreamingEventMap {
34
34
  * The last segment has finished appending.
35
35
  */
36
36
  readonly bufferingEnded: AnyRecord;
37
- /**
38
- * The buffer went from empty to holding data, or back to empty.
39
- */
40
- readonly hasDataChange: ChangeEvent<boolean>;
41
37
  /**
42
38
  * Dispatched when a streaming error occurs.
43
39
  */
@@ -97,7 +93,6 @@ export declare const ALL_STREAMING_EVENTS: readonly [
97
93
  "bufferingQualityChange",
98
94
  "playbackQualityChange",
99
95
  "bufferingEnded",
100
- "hasDataChange",
101
96
  "error",
102
97
  "reset",
103
98
  "qualitiesChange",
@@ -44,10 +44,6 @@ export interface BufferingControllerEventMap {
44
44
  * The last segment has finished appending.
45
45
  */
46
46
  readonly bufferingEnded: AnyRecord;
47
- /**
48
- * The buffer went from empty to holding data, or back to empty.
49
- */
50
- readonly hasDataChange: ChangeEvent<boolean>;
51
47
  /**
52
48
  * A codec the browser reported as supported failed to decode on append and
53
49
  * has been denylisted. Dispatched instead of `error` so the media can be
@@ -83,10 +79,6 @@ export interface BufferingController extends ReadonlyEventHost<BufferingControll
83
79
  * True if the stream has buffered the last segment.
84
80
  */
85
81
  readonly bufferingEnded: boolean;
86
- /**
87
- * True while the buffer holds any data (false when empty or cleared).
88
- */
89
- readonly hasData: boolean;
90
82
  /**
91
83
  * Begins buffering.
92
84
  */
@@ -163,7 +155,6 @@ export declare class BufferingControllerImpl extends EventHostImpl<BufferingCont
163
155
  private reopen;
164
156
  private _error;
165
157
  private _bufferingEnded;
166
- private _hasData;
167
158
  private readonly queue;
168
159
  private disposer;
169
160
  private _active;
@@ -238,8 +229,6 @@ export declare class BufferingControllerImpl extends EventHostImpl<BufferingCont
238
229
  * Returns true if the last segment has been appended.
239
230
  */
240
231
  get bufferingEnded(): boolean;
241
- get hasData(): boolean;
242
- private setHasData;
243
232
  private readonly handleError;
244
233
  /**
245
234
  * Attempts to recover from a SourceBuffer decode/append failure caused by a
@@ -3,12 +3,14 @@ import type { MediaQualityMetadata } from './MediaQualityMetadata';
3
3
  import type { FilterPredicate, FilterPredicateAsync, Maybe } from '@amazon/vinyl-util';
4
4
  /**
5
5
  * Filters qualities in a MediaTimeline using a synchronous predicate.
6
- * If filtering would remove all qualities from any period, throws via `throwError`.
6
+ * If filtering drops an audio or video stream to zero in any period, throws via
7
+ * `throwError`.
7
8
  */
8
9
  export declare function filterTimelineQualities(filter: Maybe<FilterPredicate<MediaQualityMetadata>>, throwError: () => never, timeline: MediaTimeline): MediaTimeline;
9
10
  /**
10
11
  * Filters qualities in a MediaTimeline using an asynchronous predicate.
11
- * If filtering would remove all qualities from any period, throws via `throwError`.
12
+ * If filtering drops an audio or video stream to zero in any period, throws via
13
+ * `throwError`.
12
14
  */
13
15
  export declare function filterTimelineQualitiesAsync(filter: FilterPredicateAsync<MediaQualityMetadata>, throwError: () => never, timeline: MediaTimeline): Promise<MediaTimeline>;
14
16
  /**
@@ -20,13 +20,17 @@ export interface DashMediaQualityMetadataResolverDeps {
20
20
  }
21
21
  export declare function createMediaQualityMetadataFromDashRepresentation(representation: RepresentationType, deps: DashMediaQualityMetadataResolverDeps): MediaQualityMetadata;
22
22
  /**
23
- * Estimates the total bandwidth a representation would use when paired with
24
- * proportionally matched qualities from sibling content types.
23
+ * Estimates the total bandwidth a representation uses alongside sibling content
24
+ * types, pairing it with the cheapest sibling rendition in its proportional
25
+ * bucket.
25
26
  *
26
- * For each sibling content type, the representation's relative position within its own
27
- * content type's sorted bandwidth list is mapped to the corresponding position in the
28
- * sibling's list. This produces realistic pairings — e.g. with video [v1,v2,v3,v4] and
29
- * audio [a1,a2], v1 pairs with a1, v2 with a1, v3 with a2, v4 with a2.
27
+ * Each content type's sorted list is split into as many buckets as this
28
+ * representation's own list has tiers; the representation is paired with the
29
+ * cheapest sibling rendition in the matching bucket. A stream with few tiers
30
+ * therefore stays selected across the span of a finer sibling's tiers (e.g. the
31
+ * top audio across the top half of video tiers) rather than being pinned to a
32
+ * single endpoint — with video [v1..v4] and audio [a1,a2], a1's bucket is
33
+ * v1..v2 so a1 pairs with v2, and a2's bucket is v3..v4 so a2 pairs with v4.
30
34
  */
31
35
  export declare function estimatePeakBandwidth(representation: RepresentationType, contentType: ContentType): number;
32
36
  /**
@@ -107,7 +107,7 @@ export declare function createDashFactories(options: Maybe<DashInitOptions>): (d
107
107
  readonly manifestTransformed: ObservableValue<Promise<DashManifestData>>;
108
108
  readonly options: ObservableValue<Pick<VinylOptions, "text">>;
109
109
  }) => SidecarTextTrackController;
110
- options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "audio" | "text" | "abr" | "allowedContentTypes">>>;
110
+ options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "text" | "audio" | "abr" | "allowedContentTypes">>>;
111
111
  playbackController: import("@amazon/vinyl-di").Factory<PlaybackController>;
112
112
  playbackSource: import("@amazon/vinyl-di").Factory<PlaybackSource>;
113
113
  drmKeySystemResolver: import("@amazon/vinyl-di").Factory<DrmKeySystemResolver>;
@@ -36,6 +36,12 @@ export declare function calculatePeriodTimeRange(period: PeriodType): PeriodRang
36
36
  *
37
37
  * In a static presentation, the first period SHALL start at the zero point of the MPD timeline (with a
38
38
  * Period@start value of 0 seconds).
39
+ *
40
+ * When `Period@start` is absent, the start is derived from the sum of the
41
+ * preceding periods' `Period@duration` values, per the PeriodStart derivation
42
+ * in ISO/IEC 23009-1 §5.3.2.1. This is common in on-demand manifests that
43
+ * declare only per-period durations (no explicit `@start`, no
44
+ * `MPD@mediaPresentationDuration`).
39
45
  */
40
46
  export declare function calculatePeriodStart(period: PeriodType): number;
41
47
  /**
@@ -3,6 +3,10 @@ import type { MediaFormatMetadata } from '../../streaming/MediaQualityMetadata';
3
3
  export declare function throwMimeTypesUnsupported(): never;
4
4
  /**
5
5
  * Returns true when the media's codec and container is supported.
6
+ *
7
+ * Both ISO-BMFF (MP4/fMP4) and WebM containers are supported: the DASH
8
+ * `SegmentBase` indexer reads ISO-BMFF `sidx` boxes or WebM EBML `Cues` as
9
+ * appropriate, and MSE appends each to a matching SourceBuffer.
6
10
  */
7
11
  export declare function canPlayMimeType(deps: {
8
12
  readonly capabilities: Capabilities;
@@ -1,13 +1,31 @@
1
1
  import type { MediaQualityMetadata } from '../../streaming/MediaQualityMetadata';
2
2
  import type { Capabilities } from '../../client/Capabilities';
3
3
  export declare function throwSamplingRatesUnsupported(): never;
4
+ export interface AudioSampleRateRangeOptions {
5
+ readonly capabilities: Capabilities;
6
+ /**
7
+ * An explicit maximum sampling rate that takes precedence over the
8
+ * platform's `AudioContext`-reported output rate when set.
9
+ */
10
+ readonly maxSampleRate?: number | null;
11
+ /** An optional minimum sampling-rate floor. */
12
+ readonly minSampleRate?: number | null;
13
+ }
4
14
  /**
5
- * Returns true when the media's sampling rate is supported.
6
- * If Firefox (which does not support >48kHz), filter out all sampling rates above the supported sampling rate.
7
- * All other browsers filter out all sampling rates above the supported sampling rate unless this will filter all
8
- * and then do not filter the lowest sampling rate.
15
+ * Returns true when the media's sampling rate is within the supported range.
16
+ * Only audio content types are gated; every other content type passes through.
17
+ *
18
+ * The upper bound is `maxSampleRate` when set, otherwise the platform's
19
+ * `AudioContext`-reported output rate (Firefox is hard-capped at 48kHz, which it
20
+ * cannot decode beyond via MSE). The optional lower bound is `minSampleRate`.
21
+ * Both bounds are soft, and soft *together*: when no audio rendition sits in the
22
+ * acceptable `[minSampleRate, maxSampleRate]` band, a single fallback is kept so
23
+ * playback is never stranded — the highest rate the ceiling can decode, or, when
24
+ * every rate is above the ceiling, the lowest. This holds even when renditions
25
+ * straddle an empty band (some below the floor, some above the ceiling). Only
26
+ * audio renditions count toward the fallback — a co-present video quality (no
27
+ * audio rate) never influences it. Firefox is the exception: its 48kHz cap is
28
+ * hard, with no fallback.
9
29
  */
10
- export declare function supportsAudioSamplingRate(deps: {
11
- readonly capabilities: Capabilities;
12
- }, metadata: MediaQualityMetadata, _index: number, array: ArrayLike<MediaQualityMetadata>): boolean;
30
+ export declare function withinAudioSampleRateRange(options: AudioSampleRateRangeOptions, metadata: MediaQualityMetadata, _index: number, array: ArrayLike<MediaQualityMetadata>): boolean;
13
31
  //# sourceMappingURL=sampleRateFilter.d.ts.map
@@ -96,7 +96,7 @@ export declare function createHlsFactories(options: Maybe<HlsInitOptions>): (dep
96
96
  readonly manifestTransformed: ObservableValue<Promise<HlsManifestData>>;
97
97
  readonly options: ObservableValue<Pick<VinylOptions, "text">>;
98
98
  }) => SidecarTextTrackController;
99
- options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "audio" | "text" | "abr" | "allowedContentTypes">>>;
99
+ options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "text" | "audio" | "abr" | "allowedContentTypes">>>;
100
100
  playbackController: import("@amazon/vinyl-di").Factory<PlaybackController>;
101
101
  playbackSource: import("@amazon/vinyl-di").Factory<PlaybackSource>;
102
102
  drmKeySystemResolver: import("@amazon/vinyl-di").Factory<DrmKeySystemResolver>;
@@ -14,15 +14,6 @@ import type { TextTrackController } from '../../text/TextTrack';
14
14
  import type { TrackConfigOptions } from '../TrackFactory';
15
15
  import type { TrackAds } from '../../ad/AdBreakInfo';
16
16
  import type { VinylOptions } from '../../vinyl/VinylOptions';
17
- /**
18
- * How long to wait after all streams have data before checking whether a seek
19
- * is still stuck, in seconds.
20
- */
21
- export declare const SEEKING_STALL_TIME_CHECK = 0.1;
22
- /**
23
- * How far to nudge the playhead, in seconds, to recover a stuck seek.
24
- */
25
- export declare const PLAYHEAD_NUDGE = 0.05;
26
17
  export type MseTrackDeps = TrackBaseDeps & {
27
18
  readonly contentTypesValue: ContentTypesValue;
28
19
  readonly contentStreamFactory: (contentType: ContentType) => ContentStream;
@@ -54,7 +45,6 @@ export declare class MseTrack extends TrackBase {
54
45
  protected readonly deps: MseTrackDeps;
55
46
  get textTrackController(): TextTrackController | null;
56
47
  private readonly streams;
57
- private stallNudgeTimer;
58
48
  private readonly disposeAbort;
59
49
  private lastPreloadOptions;
60
50
  private readonly allFetchedRanges;
@@ -129,13 +119,6 @@ export declare class MseTrack extends TrackBase {
129
119
  private getStream;
130
120
  private clearStreams;
131
121
  get bufferingEnded(): boolean;
132
- /**
133
- * A seek only completes once every stream has data at the target, but on
134
- * some platforms the element can stay stuck `seeking` even after that. Once
135
- * all streams hold data, if we're still seeking a moment later, nudge the
136
- * playhead to prod the element into completing the seek.
137
- */
138
- private checkStalledSeek;
139
122
  private setContentTypes;
140
123
  dispose(): void;
141
124
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Extracts the container subtype from a MIME type, lowercased — the portion
3
+ * after the `/`, ignoring any parameters. For example
4
+ * `video/webm; codecs="vp9"` → `webm` and `audio/mp4` → `mp4`. Returns an empty
5
+ * string when the MIME type has no subtype.
6
+ */
7
+ export declare function mimeSubtype(mimeType: string): string;
8
+ //# sourceMappingURL=mimeType.d.ts.map
@@ -66,6 +66,11 @@ export declare class VinylPlayer<TrackLoadOptionsType extends TrackLoadOptions =
66
66
  * @see createVinylPlayer
67
67
  */
68
68
  protected constructor(factories: Factories<VinylDeps<TrackLoadOptionsType, OptionsType>>);
69
+ /**
70
+ * Logs each republished load span once at the verbose level, formatting its
71
+ * bounds as ISO date strings and its duration in milliseconds.
72
+ */
73
+ protected initializeLoadSpanLogging(): void;
69
74
  protected redispatchSubControllerEvents(): void;
70
75
  /**
71
76
  * Certain track events are redispatched on the player for the current track.
@@ -1,6 +1,6 @@
1
1
  import type { CapabilitiesImplDeps } from '../client/CapabilitiesImpl';
2
2
  import { CapabilitiesImpl } from '../client/CapabilitiesImpl';
3
- import type { Merge, PartialDeep, PatchedRef } from '@amazon/vinyl-util';
3
+ import type { Merge, PartialDeep } from '@amazon/vinyl-util';
4
4
  import { noop } from '@amazon/vinyl-util';
5
5
  import type { PlaybackControllerImplDeps, PlaybackControllerImplOptions } from '../playback/PlaybackControllerImpl';
6
6
  import { PlaybackControllerImpl } from '../playback/PlaybackControllerImpl';
@@ -9,7 +9,6 @@ import { PlaybackSourceImpl } from '../playback/PlaybackSourceImpl';
9
9
  import { type VinylTrackFactoryDeps } from '../track/createVinylTrackFactories';
10
10
  import type { TrackControllerImplDeps, TrackControllerImplOptions } from '../track/TrackController';
11
11
  import { TrackControllerImpl } from '../track/TrackController';
12
- import type { VinylPatchOptions } from './VinylPatchOptions';
13
12
  import { type QualitySelectorImplOptions } from '../streaming/abr/QualitySelectorImpl';
14
13
  import { AdControllerImpl, type AdControllerImplDeps, type AdControllerImplOptions } from '../ad/AdControllerImpl';
15
14
  import { type MediaTextTrackProvider } from '../text/mediaTextTrackProvider';
@@ -41,11 +40,6 @@ export interface VinylDependencyOptions {
41
40
  * `'hidden'`; without one they render natively. See `TextTrackRenderer`.
42
41
  */
43
42
  readonly textTrackRenderer?: TextTrackRenderer;
44
- /**
45
- * Flags for patches that should be applied browser-specifically.
46
- * These will be defaulted based on the user-agent.
47
- */
48
- readonly patches?: PartialDeep<VinylPatchOptions>;
49
43
  /**
50
44
  * Configuration for the track controller.
51
45
  */
@@ -82,12 +76,7 @@ export interface VinylDependencyOptions {
82
76
  */
83
77
  export declare function createVinylFactories(options: VinylDependencyOptions): {
84
78
  options: (_deps: import("@amazon/vinyl-util").AnyRecord, add: import("@amazon/vinyl-util").AddDisposable) => import("@amazon/vinyl-observable").MutableValue<VinylOptions>;
85
- patchedMedia: () => PatchedRef<HTMLMediaElement>;
86
- media: (deps: {
87
- readonly patchedMedia: {
88
- readonly patched: HTMLMediaElement;
89
- };
90
- }) => HTMLMediaElement;
79
+ media: () => HTMLMediaElement;
91
80
  textTrackProvider: (deps: {
92
81
  readonly media: HTMLMediaElement;
93
82
  }) => MediaTextTrackProvider;
@@ -153,7 +142,7 @@ export declare function createVinylFactories(options: VinylDependencyOptions): {
153
142
  readonly manifestTransformed: ObservableValue<Promise<import("..").DashManifestData>>;
154
143
  readonly options: ObservableValue<Pick<VinylOptions, "text">>;
155
144
  }) => import("..").SidecarTextTrackController;
156
- options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "audio" | "text" | "abr" | "allowedContentTypes">>>;
145
+ options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "text" | "audio" | "abr" | "allowedContentTypes">>>;
157
146
  playbackController: import("@amazon/vinyl-di").Factory<import("..").PlaybackController>;
158
147
  playbackSource: import("@amazon/vinyl-di").Factory<import("..").PlaybackSource>;
159
148
  drmKeySystemResolver: import("@amazon/vinyl-di").Factory<import("..").DrmKeySystemResolver>;
@@ -165,7 +154,9 @@ export declare function createVinylFactories(options: VinylDependencyOptions): {
165
154
  textTrackRenderer: import("@amazon/vinyl-di").Factory<TextTrackRenderer | null>;
166
155
  adController: import("@amazon/vinyl-di").Factory<import("..").AdController>;
167
156
  };
168
- createHlsFactories: (deps: import("..").HlsFactoryDeps) => (loadOptions: import("..").HlsTrackLoadOptions) => {
157
+ createHlsFactories: (deps: import("..").HlsFactoryDeps) => (loadOptions: import("..").HlsTrackLoadOptions /**
158
+ * Configuration for adaptive bitrate switching.
159
+ */) => {
169
160
  baseContentTypesValue: typeof import("..").createHlsContentTypesValue;
170
161
  contentTypesValue: typeof import("..").createAllowedContentTypesValue;
171
162
  manifestProvider: () => import("..").HlsManifestProvider;
@@ -208,7 +199,7 @@ export declare function createVinylFactories(options: VinylDependencyOptions): {
208
199
  readonly manifestTransformed: ObservableValue<Promise<import("..").HlsManifestData>>;
209
200
  readonly options: ObservableValue<Pick<VinylOptions, "text">>;
210
201
  }) => import("..").SidecarTextTrackController;
211
- options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "audio" | "text" | "abr" | "allowedContentTypes">>>;
202
+ options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "text" | "audio" | "abr" | "allowedContentTypes">>>;
212
203
  playbackController: import("@amazon/vinyl-di").Factory<import("..").PlaybackController>;
213
204
  playbackSource: import("@amazon/vinyl-di").Factory<import("..").PlaybackSource>;
214
205
  drmKeySystemResolver: import("@amazon/vinyl-di").Factory<import("..").DrmKeySystemResolver>;
@@ -6,11 +6,22 @@ import { AdControllerImpl } from '@amazon/vinyl';
6
6
  import { MockPlaybackController, MockTrack } from '@amazon/vinyl/vinylTestUtil';
7
7
  describe('AdControllerImpl', () => {
8
8
  let playbackController;
9
+ let controllers;
9
10
  beforeEach(() => {
10
11
  playbackController = new MockPlaybackController();
12
+ controllers = [];
13
+ });
14
+ // Dispose every controller a spec created. An activated-but-unstarted ad
15
+ // arms a `sleep(adLoadTimeout)` timer.
16
+ afterEach(() => {
17
+ for (const c of controllers)
18
+ if (!c.disposed)
19
+ c.dispose();
11
20
  });
12
21
  function createController() {
13
- return new AdControllerImpl({ playbackController });
22
+ const c = new AdControllerImpl({ playbackController });
23
+ controllers.push(c);
24
+ return c;
14
25
  }
15
26
  function updateTime(time) {
16
27
  playbackController.currentTime = time;
@@ -301,6 +312,21 @@ describe('AdControllerImpl', () => {
301
312
  await flush();
302
313
  expect(c.currentAdBreak).toBeNull();
303
314
  });
315
+ it('ignores a late provider ad-discovery resolution after dispose', async () => {
316
+ const c = createController();
317
+ let resolveAds = () => { };
318
+ const track = new MockTrack();
319
+ track.uri = 't1';
320
+ track.active = true;
321
+ track.getAds = () => new Promise((res) => {
322
+ resolveAds = res;
323
+ });
324
+ c.setAdsProvider(track); // refreshAds() runs; getAds() stays pending
325
+ c.dispose();
326
+ resolveAds(trackAds(makeBreak())); // refreshAds .then: interrupted (disposed)
327
+ await flush();
328
+ expect(c.currentTrackAds).toBeNull();
329
+ });
304
330
  });
305
331
  it('emits currentTrackAdsChange with the TrackAds when a parent track is set', async () => {
306
332
  const c = createController();