@amazon/vinyl 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +24 -6
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +33 -13
- package/dist/index.js.map +3 -3
- package/dist/test/integ.es5.js +62 -62
- package/dist/test/integ.js +119 -6
- package/dist/test/integ.js.map +2 -2
- package/dist/types/current/ad/AdBreakInfo.d.ts +160 -0
- package/dist/types/current/ad/AdBreakInfo.d.ts.map +1 -0
- package/dist/types/current/ad/AdBreakInfo.js +5 -0
- package/dist/types/current/ad/AdController.d.ts +229 -0
- package/dist/types/current/ad/AdController.d.ts.map +1 -0
- package/dist/types/current/ad/AdController.js +19 -0
- package/dist/types/current/ad/AdControllerImpl.d.ts +162 -0
- package/dist/types/current/ad/AdControllerImpl.d.ts.map +1 -0
- package/dist/types/current/ad/AdControllerImpl.js +741 -0
- package/dist/types/current/ad/AdError.d.ts +6 -0
- package/dist/types/current/ad/AdError.d.ts.map +1 -0
- package/dist/types/current/ad/AdError.js +14 -0
- package/dist/types/current/ad/AdsProvider.d.ts +28 -0
- package/dist/types/current/ad/AdsProvider.d.ts.map +1 -0
- package/dist/types/current/ad/AdsProvider.js +5 -0
- package/dist/types/current/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
- package/dist/types/current/ad/defaultAdLoadOptionsResolver.d.ts.map +1 -0
- package/dist/types/current/ad/defaultAdLoadOptionsResolver.js +26 -0
- package/dist/types/current/ad/discoverHlsInterstitials.d.ts +22 -0
- package/dist/types/current/ad/discoverHlsInterstitials.d.ts.map +1 -0
- package/dist/types/current/ad/discoverHlsInterstitials.js +248 -0
- package/dist/types/current/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/current/drm/DrmControllerImpl.d.ts.map +1 -1
- package/dist/types/current/drm/DrmControllerImpl.js +23 -1
- package/dist/types/current/playback/PlaybackControllerImpl.d.ts +1 -1
- package/dist/types/current/playback/createStallDetector.d.ts +43 -0
- package/dist/types/current/playback/createStallDetector.d.ts.map +1 -0
- package/dist/types/current/playback/createStallDetector.js +101 -0
- package/dist/types/current/playback/createStallMonitor.d.ts +45 -0
- package/dist/types/current/playback/createStallMonitor.d.ts.map +1 -0
- package/dist/types/current/playback/createStallMonitor.js +99 -0
- package/dist/types/current/streaming/AudioOptions.d.ts +66 -0
- package/dist/types/current/streaming/AudioOptions.d.ts.map +1 -0
- package/dist/types/current/streaming/AudioOptions.js +19 -0
- package/dist/types/current/streaming/LoadMetric.d.ts +72 -0
- package/dist/types/current/streaming/LoadMetric.d.ts.map +1 -0
- package/dist/types/current/streaming/LoadMetric.js +5 -0
- package/dist/types/current/streaming/ManifestControllerImpl.d.ts +43 -0
- package/dist/types/current/streaming/ManifestControllerImpl.d.ts.map +1 -0
- package/dist/types/current/streaming/ManifestControllerImpl.js +104 -0
- package/dist/types/current/streaming/buffering/codecDenylist.d.ts +23 -0
- package/dist/types/current/streaming/buffering/codecDenylist.d.ts.map +1 -0
- package/dist/types/current/streaming/buffering/codecDenylist.js +62 -0
- package/dist/types/current/streaming/createAllowedContentTypesValue.d.ts +30 -0
- package/dist/types/current/streaming/createAllowedContentTypesValue.d.ts.map +1 -0
- package/dist/types/current/streaming/createAllowedContentTypesValue.js +43 -0
- package/dist/types/current/streaming/createTimelineContentTypesValue.d.ts +21 -0
- package/dist/types/current/streaming/createTimelineContentTypesValue.d.ts.map +1 -0
- package/dist/types/current/streaming/createTimelineContentTypesValue.js +25 -0
- package/dist/types/current/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
- package/dist/types/current/streaming/mediaTimelineAccessibilityFilter.d.ts.map +1 -0
- package/dist/types/current/streaming/mediaTimelineAccessibilityFilter.js +75 -0
- package/dist/types/current/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/current/text/HtmlTextTrackRenderer.d.ts.map +1 -0
- package/dist/types/current/text/HtmlTextTrackRenderer.js +231 -0
- package/dist/types/current/text/SidecarTextTrackController.d.ts +103 -0
- package/dist/types/current/text/SidecarTextTrackController.d.ts.map +1 -0
- package/dist/types/current/text/SidecarTextTrackController.js +250 -0
- package/dist/types/current/text/SidecarTextTrackLoader.d.ts +65 -0
- package/dist/types/current/text/SidecarTextTrackLoader.d.ts.map +1 -0
- package/dist/types/current/text/SidecarTextTrackLoader.js +150 -0
- package/dist/types/current/text/TextTrack.d.ts +179 -0
- package/dist/types/current/text/TextTrack.d.ts.map +1 -0
- package/dist/types/current/text/TextTrack.js +29 -0
- package/dist/types/current/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/current/text/TextTrackRenderer.d.ts.map +1 -0
- package/dist/types/current/text/TextTrackRenderer.js +5 -0
- package/dist/types/current/text/VttCueStyle.d.ts +41 -0
- package/dist/types/current/text/VttCueStyle.d.ts.map +1 -0
- package/dist/types/current/text/VttCueStyle.js +45 -0
- package/dist/types/current/text/discoverDashTextTracks.d.ts +24 -0
- package/dist/types/current/text/discoverDashTextTracks.d.ts.map +1 -0
- package/dist/types/current/text/discoverDashTextTracks.js +110 -0
- package/dist/types/current/text/discoverHlsTextTracks.d.ts +19 -0
- package/dist/types/current/text/discoverHlsTextTracks.d.ts.map +1 -0
- package/dist/types/current/text/discoverHlsTextTracks.js +49 -0
- package/dist/types/current/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/current/text/mediaTextTrackProvider.d.ts.map +1 -0
- package/dist/types/current/text/mediaTextTrackProvider.js +42 -0
- package/dist/types/current/text/parseWebVtt.d.ts +60 -0
- package/dist/types/current/text/parseWebVtt.d.ts.map +1 -0
- package/dist/types/current/text/parseWebVtt.js +249 -0
- package/dist/types/current/text/pickPreferredTextTrack.d.ts +15 -0
- package/dist/types/current/text/pickPreferredTextTrack.d.ts.map +1 -0
- package/dist/types/current/text/pickPreferredTextTrack.js +71 -0
- package/dist/types/current/track/SeekRange.d.ts +9 -0
- package/dist/types/current/track/SeekRange.d.ts.map +1 -0
- package/dist/types/current/track/SeekRange.js +5 -0
- package/dist/types/current/track/hls/HlsManifestData.d.ts +19 -0
- package/dist/types/current/track/hls/HlsManifestData.d.ts.map +1 -0
- package/dist/types/current/track/hls/HlsManifestData.js +5 -0
- package/dist/types/current/track/hls/createHlsManifestProvider.d.ts +6 -0
- package/dist/types/current/track/hls/createHlsManifestProvider.d.ts.map +1 -0
- package/dist/types/current/track/hls/createHlsManifestProvider.js +9 -0
- package/dist/types/current/track/inferLoadOptionsFromUri.d.ts +15 -0
- package/dist/types/current/track/inferLoadOptionsFromUri.d.ts.map +1 -0
- package/dist/types/current/track/inferLoadOptionsFromUri.js +55 -0
- package/dist/types/current/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/current/track/mse/MseTrack.d.ts.map +1 -1
- package/dist/types/current/track/mse/MseTrack.js +4 -5
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/current/util/media/codecOverrides.d.ts +33 -0
- package/dist/types/current/util/media/codecOverrides.d.ts.map +1 -0
- package/dist/types/current/util/media/codecOverrides.js +37 -0
- package/dist/types/current/util/media/codecSupport.d.ts +6 -0
- package/dist/types/current/util/media/codecSupport.d.ts.map +1 -0
- package/dist/types/current/util/media/codecSupport.js +17 -0
- package/dist/types/current/util/media/mimeType.d.ts +8 -0
- package/dist/types/current/util/media/mimeType.d.ts.map +1 -0
- package/dist/types/current/util/media/mimeType.js +13 -0
- package/dist/types/ts3.7/ad/AdBreakInfo.d.ts +160 -0
- package/dist/types/ts3.7/ad/AdController.d.ts +243 -0
- package/dist/types/ts3.7/ad/AdControllerImpl.d.ts +162 -0
- package/dist/types/ts3.7/ad/AdError.d.ts +6 -0
- package/dist/types/ts3.7/ad/AdsProvider.d.ts +28 -0
- package/dist/types/ts3.7/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
- package/dist/types/ts3.7/ad/discoverHlsInterstitials.d.ts +22 -0
- package/dist/types/ts3.7/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/ts3.7/playback/PlaybackControllerImpl.d.ts +1 -1
- package/dist/types/ts3.7/playback/createStallDetector.d.ts +43 -0
- package/dist/types/ts3.7/playback/createStallMonitor.d.ts +45 -0
- package/dist/types/ts3.7/streaming/AudioOptions.d.ts +66 -0
- package/dist/types/ts3.7/streaming/LoadMetric.d.ts +72 -0
- package/dist/types/ts3.7/streaming/ManifestControllerImpl.d.ts +40 -0
- package/dist/types/ts3.7/streaming/buffering/codecDenylist.d.ts +23 -0
- package/dist/types/ts3.7/streaming/createAllowedContentTypesValue.d.ts +30 -0
- package/dist/types/ts3.7/streaming/createTimelineContentTypesValue.d.ts +21 -0
- package/dist/types/ts3.7/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
- package/dist/types/ts3.7/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/ts3.7/text/SidecarTextTrackController.d.ts +103 -0
- package/dist/types/ts3.7/text/SidecarTextTrackLoader.d.ts +65 -0
- package/dist/types/ts3.7/text/TextTrack.d.ts +183 -0
- package/dist/types/ts3.7/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/ts3.7/text/VttCueStyle.d.ts +41 -0
- package/dist/types/ts3.7/text/discoverDashTextTracks.d.ts +24 -0
- package/dist/types/ts3.7/text/discoverHlsTextTracks.d.ts +19 -0
- package/dist/types/ts3.7/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/ts3.7/text/parseWebVtt.d.ts +60 -0
- package/dist/types/ts3.7/text/pickPreferredTextTrack.d.ts +15 -0
- package/dist/types/ts3.7/track/SeekRange.d.ts +9 -0
- package/dist/types/ts3.7/track/hls/HlsManifestData.d.ts +19 -0
- package/dist/types/ts3.7/track/hls/createHlsManifestProvider.d.ts +6 -0
- package/dist/types/ts3.7/track/inferLoadOptionsFromUri.d.ts +15 -0
- package/dist/types/ts3.7/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/ts3.7/util/media/codecOverrides.d.ts +33 -0
- package/dist/types/ts3.7/util/media/codecSupport.d.ts +6 -0
- package/dist/types/ts3.7/util/media/mimeType.d.ts +8 -0
- package/dist/types/ts4.1/ad/AdBreakInfo.d.ts +160 -0
- package/dist/types/ts4.1/ad/AdController.d.ts +243 -0
- package/dist/types/ts4.1/ad/AdControllerImpl.d.ts +162 -0
- package/dist/types/ts4.1/ad/AdError.d.ts +6 -0
- package/dist/types/ts4.1/ad/AdsProvider.d.ts +28 -0
- package/dist/types/ts4.1/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
- package/dist/types/ts4.1/ad/discoverHlsInterstitials.d.ts +22 -0
- package/dist/types/ts4.1/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/ts4.1/playback/PlaybackControllerImpl.d.ts +1 -1
- package/dist/types/ts4.1/playback/createStallDetector.d.ts +43 -0
- package/dist/types/ts4.1/playback/createStallMonitor.d.ts +45 -0
- package/dist/types/ts4.1/streaming/AudioOptions.d.ts +66 -0
- package/dist/types/ts4.1/streaming/LoadMetric.d.ts +72 -0
- package/dist/types/ts4.1/streaming/ManifestControllerImpl.d.ts +40 -0
- package/dist/types/ts4.1/streaming/buffering/codecDenylist.d.ts +23 -0
- package/dist/types/ts4.1/streaming/createAllowedContentTypesValue.d.ts +30 -0
- package/dist/types/ts4.1/streaming/createTimelineContentTypesValue.d.ts +21 -0
- package/dist/types/ts4.1/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
- package/dist/types/ts4.1/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/ts4.1/text/SidecarTextTrackController.d.ts +104 -0
- package/dist/types/ts4.1/text/SidecarTextTrackLoader.d.ts +65 -0
- package/dist/types/ts4.1/text/TextTrack.d.ts +183 -0
- package/dist/types/ts4.1/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/ts4.1/text/VttCueStyle.d.ts +41 -0
- package/dist/types/ts4.1/text/discoverDashTextTracks.d.ts +24 -0
- package/dist/types/ts4.1/text/discoverHlsTextTracks.d.ts +19 -0
- package/dist/types/ts4.1/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/ts4.1/text/parseWebVtt.d.ts +60 -0
- package/dist/types/ts4.1/text/pickPreferredTextTrack.d.ts +15 -0
- package/dist/types/ts4.1/track/SeekRange.d.ts +9 -0
- package/dist/types/ts4.1/track/hls/HlsManifestData.d.ts +19 -0
- package/dist/types/ts4.1/track/hls/createHlsManifestProvider.d.ts +6 -0
- package/dist/types/ts4.1/track/inferLoadOptionsFromUri.d.ts +15 -0
- package/dist/types/ts4.1/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/ts4.1/util/media/codecOverrides.d.ts +33 -0
- package/dist/types/ts4.1/util/media/codecSupport.d.ts +6 -0
- package/dist/types/ts4.1/util/media/mimeType.d.ts +8 -0
- package/dist/types/ts4.7/ad/AdBreakInfo.d.ts +160 -0
- package/dist/types/ts4.7/ad/AdController.d.ts +243 -0
- package/dist/types/ts4.7/ad/AdControllerImpl.d.ts +162 -0
- package/dist/types/ts4.7/ad/AdError.d.ts +6 -0
- package/dist/types/ts4.7/ad/AdsProvider.d.ts +28 -0
- package/dist/types/ts4.7/ad/defaultAdLoadOptionsResolver.d.ts +12 -0
- package/dist/types/ts4.7/ad/discoverHlsInterstitials.d.ts +22 -0
- package/dist/types/ts4.7/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/ts4.7/playback/PlaybackControllerImpl.d.ts +1 -1
- package/dist/types/ts4.7/playback/createStallDetector.d.ts +43 -0
- package/dist/types/ts4.7/playback/createStallMonitor.d.ts +45 -0
- package/dist/types/ts4.7/streaming/AudioOptions.d.ts +66 -0
- package/dist/types/ts4.7/streaming/LoadMetric.d.ts +72 -0
- package/dist/types/ts4.7/streaming/ManifestControllerImpl.d.ts +43 -0
- package/dist/types/ts4.7/streaming/buffering/codecDenylist.d.ts +23 -0
- package/dist/types/ts4.7/streaming/createAllowedContentTypesValue.d.ts +30 -0
- package/dist/types/ts4.7/streaming/createTimelineContentTypesValue.d.ts +21 -0
- package/dist/types/ts4.7/streaming/mediaTimelineAccessibilityFilter.d.ts +35 -0
- package/dist/types/ts4.7/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/ts4.7/text/SidecarTextTrackController.d.ts +103 -0
- package/dist/types/ts4.7/text/SidecarTextTrackLoader.d.ts +65 -0
- package/dist/types/ts4.7/text/TextTrack.d.ts +183 -0
- package/dist/types/ts4.7/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/ts4.7/text/VttCueStyle.d.ts +41 -0
- package/dist/types/ts4.7/text/discoverDashTextTracks.d.ts +24 -0
- package/dist/types/ts4.7/text/discoverHlsTextTracks.d.ts +19 -0
- package/dist/types/ts4.7/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/ts4.7/text/parseWebVtt.d.ts +60 -0
- package/dist/types/ts4.7/text/pickPreferredTextTrack.d.ts +15 -0
- package/dist/types/ts4.7/track/SeekRange.d.ts +9 -0
- package/dist/types/ts4.7/track/hls/HlsManifestData.d.ts +19 -0
- package/dist/types/ts4.7/track/hls/createHlsManifestProvider.d.ts +6 -0
- package/dist/types/ts4.7/track/inferLoadOptionsFromUri.d.ts +15 -0
- package/dist/types/ts4.7/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/ts4.7/util/media/codecOverrides.d.ts +33 -0
- package/dist/types/ts4.7/util/media/codecSupport.d.ts +6 -0
- package/dist/types/ts4.7/util/media/mimeType.d.ts +8 -0
- package/dist/unit/types/current/ad/AdController.test.d.ts +2 -0
- package/dist/unit/types/current/ad/AdController.test.d.ts.map +1 -0
- package/dist/unit/types/current/ad/AdController.test.js +10 -0
- package/dist/unit/types/current/ad/AdControllerImpl.test.d.ts +2 -0
- package/dist/unit/types/current/ad/AdControllerImpl.test.d.ts.map +1 -0
- package/dist/unit/types/current/ad/AdControllerImpl.test.js +1654 -0
- package/dist/unit/types/current/ad/defaultAdLoadOptionsResolver.test.d.ts +2 -0
- package/dist/unit/types/current/ad/defaultAdLoadOptionsResolver.test.d.ts.map +1 -0
- package/dist/unit/types/current/ad/defaultAdLoadOptionsResolver.test.js +56 -0
- package/dist/unit/types/current/ad/discoverHlsInterstitials.test.d.ts +2 -0
- package/dist/unit/types/current/ad/discoverHlsInterstitials.test.d.ts.map +1 -0
- package/dist/unit/types/current/ad/discoverHlsInterstitials.test.js +757 -0
- package/dist/unit/types/current/drm/DrmControllerImpl.test.js +96 -2
- package/dist/unit/types/current/playback/createStallDetector.test.d.ts +2 -0
- package/dist/unit/types/current/playback/createStallDetector.test.d.ts.map +1 -0
- package/dist/unit/types/current/playback/createStallDetector.test.js +163 -0
- package/dist/unit/types/current/playback/createStallMonitor.test.d.ts +2 -0
- package/dist/unit/types/current/playback/createStallMonitor.test.d.ts.map +1 -0
- package/dist/unit/types/current/playback/createStallMonitor.test.js +163 -0
- package/dist/unit/types/current/streaming/ManifestControllerImpl.test.d.ts +2 -0
- package/dist/unit/types/current/streaming/ManifestControllerImpl.test.d.ts.map +1 -0
- package/dist/unit/types/current/streaming/ManifestControllerImpl.test.js +197 -0
- package/dist/unit/types/current/streaming/MseTrack.test.js +15 -0
- package/dist/unit/types/current/streaming/buffering/codecDenylist.test.d.ts +2 -0
- package/dist/unit/types/current/streaming/buffering/codecDenylist.test.d.ts.map +1 -0
- package/dist/unit/types/current/streaming/buffering/codecDenylist.test.js +56 -0
- package/dist/unit/types/current/streaming/createAllowedContentTypesValue.test.d.ts +2 -0
- package/dist/unit/types/current/streaming/createAllowedContentTypesValue.test.d.ts.map +1 -0
- package/dist/unit/types/current/streaming/createAllowedContentTypesValue.test.js +77 -0
- package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.d.ts +2 -0
- package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.d.ts.map +1 -0
- package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.js +57 -0
- package/dist/unit/types/current/streaming/mediaTimelineAccessibilityFilter.test.d.ts +2 -0
- package/dist/unit/types/current/streaming/mediaTimelineAccessibilityFilter.test.d.ts.map +1 -0
- package/dist/unit/types/current/streaming/mediaTimelineAccessibilityFilter.test.js +99 -0
- package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts +2 -0
- package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.js +231 -0
- package/dist/unit/types/current/text/SidecarTextTrackController.test.d.ts +2 -0
- package/dist/unit/types/current/text/SidecarTextTrackController.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/SidecarTextTrackController.test.js +686 -0
- package/dist/unit/types/current/text/SidecarTextTrackLoader.test.d.ts +2 -0
- package/dist/unit/types/current/text/SidecarTextTrackLoader.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/SidecarTextTrackLoader.test.js +365 -0
- package/dist/unit/types/current/text/TextTrack.test.d.ts +2 -0
- package/dist/unit/types/current/text/TextTrack.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/TextTrack.test.js +12 -0
- package/dist/unit/types/current/text/VttCueStyle.test.d.ts +2 -0
- package/dist/unit/types/current/text/VttCueStyle.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/VttCueStyle.test.js +76 -0
- package/dist/unit/types/current/text/discoverDashTextTracks.test.d.ts +2 -0
- package/dist/unit/types/current/text/discoverDashTextTracks.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/discoverDashTextTracks.test.js +216 -0
- package/dist/unit/types/current/text/discoverHlsTextTracks.test.d.ts +2 -0
- package/dist/unit/types/current/text/discoverHlsTextTracks.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/discoverHlsTextTracks.test.js +177 -0
- package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts +2 -0
- package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/mediaTextTrackProvider.test.js +86 -0
- package/dist/unit/types/current/text/parseWebVtt.test.d.ts +2 -0
- package/dist/unit/types/current/text/parseWebVtt.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/parseWebVtt.test.js +419 -0
- package/dist/unit/types/current/text/pickPreferredTextTrack.test.d.ts +2 -0
- package/dist/unit/types/current/text/pickPreferredTextTrack.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/pickPreferredTextTrack.test.js +78 -0
- package/dist/unit/types/current/track/inferLoadOptionsFromUri.test.d.ts +2 -0
- package/dist/unit/types/current/track/inferLoadOptionsFromUri.test.d.ts.map +1 -0
- package/dist/unit/types/current/track/inferLoadOptionsFromUri.test.js +165 -0
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/unit/types/current/util/media/codecOverrides.test.d.ts +2 -0
- package/dist/unit/types/current/util/media/codecOverrides.test.d.ts.map +1 -0
- package/dist/unit/types/current/util/media/codecOverrides.test.js +42 -0
- package/dist/unit/types/current/util/media/codecSupport.test.d.ts +2 -0
- package/dist/unit/types/current/util/media/codecSupport.test.d.ts.map +1 -0
- package/dist/unit/types/current/util/media/codecSupport.test.js +26 -0
- package/dist/unit/types/current/util/media/mimeType.test.d.ts +2 -0
- package/dist/unit/types/current/util/media/mimeType.test.d.ts.map +1 -0
- package/dist/unit/types/current/util/media/mimeType.test.js +22 -0
- package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.d.ts +2 -0
- package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.d.ts.map +1 -0
- package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.js +142 -0
- package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.d.ts +2 -0
- package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.d.ts.map +1 -0
- package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.js +188 -0
- package/dist/vinylTestUtil/types/current/mock/ad/MockAdController.d.ts +15 -0
- package/dist/vinylTestUtil/types/current/mock/ad/MockAdController.d.ts.map +1 -0
- package/dist/vinylTestUtil/types/current/mock/ad/MockAdController.js +26 -0
- package/dist/vinylTestUtil/types/current/mock/dash/mockDashManifest.d.ts +84 -84
- package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts +10 -0
- package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts.map +1 -0
- package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.js +14 -0
- package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/vinylTestUtil/types/ts3.7/mock/ad/MockAdController.d.ts +15 -0
- package/dist/vinylTestUtil/types/ts3.7/mock/dash/mockDashManifest.d.ts +84 -84
- package/dist/vinylTestUtil/types/ts3.7/mock/text/MockTextTrackController.d.ts +10 -0
- package/dist/vinylTestUtil/types/ts4.1/mock/ad/MockAdController.d.ts +15 -0
- package/dist/vinylTestUtil/types/ts4.1/mock/dash/mockDashManifest.d.ts +84 -84
- package/dist/vinylTestUtil/types/ts4.1/mock/text/MockTextTrackController.d.ts +10 -0
- package/dist/vinylTestUtil/types/ts4.7/mock/ad/MockAdController.d.ts +15 -0
- package/dist/vinylTestUtil/types/ts4.7/mock/dash/mockDashManifest.d.ts +84 -84
- package/dist/vinylTestUtil/types/ts4.7/mock/text/MockTextTrackController.d.ts +10 -0
- package/package.json +10 -11
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ContentTypesValue } from './ContentTypesValue';
|
|
2
|
+
import type { MediaTimeline } from './MediaTimeline';
|
|
3
|
+
import type { ObservableValue } from '@amazon/vinyl-observable';
|
|
4
|
+
export interface TimelineContentTypesValueDeps {
|
|
5
|
+
/**
|
|
6
|
+
* The filtered, playable timeline. Content types are derived from the
|
|
7
|
+
* qualities that survive filtering, so a content type whose renditions are
|
|
8
|
+
* all filtered out (e.g. every audio rendition dropped by the sample-rate
|
|
9
|
+
* filter) is not reported — it never gates readiness and no source buffer
|
|
10
|
+
* is expected for it, so the remaining content types still play.
|
|
11
|
+
*/
|
|
12
|
+
readonly mediaTimelineTransformed: ObservableValue<Promise<MediaTimeline>>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Provides the MSE content types to create source buffers for, derived from the
|
|
16
|
+
* qualities that survive timeline filtering rather than the raw manifest. Only
|
|
17
|
+
* `'audio'`/`'video'` are reported; text is a sidecar pipeline, never an MSE
|
|
18
|
+
* source buffer.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createTimelineContentTypesValue(deps: TimelineContentTypesValueDeps): ContentTypesValue;
|
|
21
|
+
//# sourceMappingURL=createTimelineContentTypesValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTimelineContentTypesValue.d.ts","sourceRoot":"","sources":["../../../../src/streaming/createTimelineContentTypesValue.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D,MAAM,WAAW,6BAA6B;IAC1C;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,EAAE,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;CAC7E;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC3C,IAAI,EAAE,6BAA6B,GACpC,iBAAiB,CAgBnB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Provides the MSE content types to create source buffers for, derived from the
|
|
7
|
+
* qualities that survive timeline filtering rather than the raw manifest. Only
|
|
8
|
+
* `'audio'`/`'video'` are reported; text is a sidecar pipeline, never an MSE
|
|
9
|
+
* source buffer.
|
|
10
|
+
*/
|
|
11
|
+
export function createTimelineContentTypesValue(deps) {
|
|
12
|
+
return deps.mediaTimelineTransformed.map(async (timelinePromise) => {
|
|
13
|
+
const timeline = await timelinePromise;
|
|
14
|
+
const contentTypes = new Set();
|
|
15
|
+
for (const period of timeline.periods) {
|
|
16
|
+
for (const { metadata } of period.qualities) {
|
|
17
|
+
if (metadata.contentType === 'audio' ||
|
|
18
|
+
metadata.contentType === 'video') {
|
|
19
|
+
contentTypes.add(metadata.contentType);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return contentTypes;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { MediaQualityMetadata } from './MediaQualityMetadata';
|
|
2
|
+
import type { FilterPredicate } from '@amazon/vinyl-util';
|
|
3
|
+
/**
|
|
4
|
+
* Thrown if the audio-description filter ever emptied a period's audio. The
|
|
5
|
+
* filter keeps at least one audio rendition per period by design, so this is a
|
|
6
|
+
* defensive guard rather than an expected path.
|
|
7
|
+
*/
|
|
8
|
+
export declare function throwNoPlayableAudio(): never;
|
|
9
|
+
/**
|
|
10
|
+
* Characteristics that mark an audio rendition as an audio description (a.k.a.
|
|
11
|
+
* described video / DVS) — narration of on-screen action for viewers who cannot
|
|
12
|
+
* see it. HLS signals this with the `public.accessibility.describes-video`
|
|
13
|
+
* CHARACTERISTIC; DASH with a `description` Role. Such renditions must not be
|
|
14
|
+
* chosen as the default audio; they are an accessibility opt-in.
|
|
15
|
+
*/
|
|
16
|
+
export declare const AUDIO_DESCRIPTION_CHARACTERISTICS: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Whether an audio quality is an audio-description rendition.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isAudioDescription(quality: MediaQualityMetadata): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a filter that keeps audio-description renditions out of (or, when
|
|
23
|
+
* opted in, restricts audio to) the audio selection.
|
|
24
|
+
*
|
|
25
|
+
* - `preferDescription: false` (default): drop audio-description renditions
|
|
26
|
+
* from each period *when a non-description audio alternative exists*, so the
|
|
27
|
+
* main audio is chosen by default instead of the description track. If a
|
|
28
|
+
* period has only description audio, it is kept (playback is never stranded).
|
|
29
|
+
* - `preferDescription: true`: keep only description renditions when the period
|
|
30
|
+
* has any; otherwise keep all (again, never strand playback).
|
|
31
|
+
*
|
|
32
|
+
* Non-audio qualities are always kept.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createAudioDescriptionFilter(preferDescription: boolean): FilterPredicate<MediaQualityMetadata>;
|
|
35
|
+
//# sourceMappingURL=mediaTimelineAccessibilityFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaTimelineAccessibilityFilter.d.ts","sourceRoot":"","sources":["../../../../src/streaming/mediaTimelineAccessibilityFilter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGzD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,KAAK,CAE5C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,EAAE,SAAS,MAAM,EAG9D,CAAA;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAIzE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CACxC,iBAAiB,EAAE,OAAO,GAC3B,eAAe,CAAC,oBAAoB,CAAC,CA8BvC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { MediaUnsupportedError, memoize } from '@amazon/vinyl-util';
|
|
6
|
+
/**
|
|
7
|
+
* Thrown if the audio-description filter ever emptied a period's audio. The
|
|
8
|
+
* filter keeps at least one audio rendition per period by design, so this is a
|
|
9
|
+
* defensive guard rather than an expected path.
|
|
10
|
+
*/
|
|
11
|
+
export function throwNoPlayableAudio() {
|
|
12
|
+
throw new MediaUnsupportedError('No playable audio rendition', 'audio');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Characteristics that mark an audio rendition as an audio description (a.k.a.
|
|
16
|
+
* described video / DVS) — narration of on-screen action for viewers who cannot
|
|
17
|
+
* see it. HLS signals this with the `public.accessibility.describes-video`
|
|
18
|
+
* CHARACTERISTIC; DASH with a `description` Role. Such renditions must not be
|
|
19
|
+
* chosen as the default audio; they are an accessibility opt-in.
|
|
20
|
+
*/
|
|
21
|
+
export const AUDIO_DESCRIPTION_CHARACTERISTICS = [
|
|
22
|
+
'public.accessibility.describes-video',
|
|
23
|
+
'description',
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* Whether an audio quality is an audio-description rendition.
|
|
27
|
+
*/
|
|
28
|
+
export function isAudioDescription(quality) {
|
|
29
|
+
return quality.characteristics.some((c) => AUDIO_DESCRIPTION_CHARACTERISTICS.includes(c));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Creates a filter that keeps audio-description renditions out of (or, when
|
|
33
|
+
* opted in, restricts audio to) the audio selection.
|
|
34
|
+
*
|
|
35
|
+
* - `preferDescription: false` (default): drop audio-description renditions
|
|
36
|
+
* from each period *when a non-description audio alternative exists*, so the
|
|
37
|
+
* main audio is chosen by default instead of the description track. If a
|
|
38
|
+
* period has only description audio, it is kept (playback is never stranded).
|
|
39
|
+
* - `preferDescription: true`: keep only description renditions when the period
|
|
40
|
+
* has any; otherwise keep all (again, never strand playback).
|
|
41
|
+
*
|
|
42
|
+
* Non-audio qualities are always kept.
|
|
43
|
+
*/
|
|
44
|
+
export function createAudioDescriptionFilter(preferDescription) {
|
|
45
|
+
// Per period (per unique array reference): does it have description audio,
|
|
46
|
+
// and does it have non-description ("main") audio?
|
|
47
|
+
const periodFlags = memoize((array) => {
|
|
48
|
+
let hasDescription = false;
|
|
49
|
+
let hasMain = false;
|
|
50
|
+
for (const quality of Array.from(array)) {
|
|
51
|
+
if (quality.contentType !== 'audio')
|
|
52
|
+
continue;
|
|
53
|
+
if (isAudioDescription(quality))
|
|
54
|
+
hasDescription = true;
|
|
55
|
+
else
|
|
56
|
+
hasMain = true;
|
|
57
|
+
}
|
|
58
|
+
return { hasDescription, hasMain };
|
|
59
|
+
}, (array) => array, 1);
|
|
60
|
+
return (quality, _index, array) => {
|
|
61
|
+
if (quality.contentType !== 'audio')
|
|
62
|
+
return true;
|
|
63
|
+
const { hasDescription, hasMain } = periodFlags(array);
|
|
64
|
+
if (preferDescription) {
|
|
65
|
+
// Nothing to prefer; keep all rather than strand playback.
|
|
66
|
+
if (!hasDescription)
|
|
67
|
+
return true;
|
|
68
|
+
return isAudioDescription(quality);
|
|
69
|
+
}
|
|
70
|
+
// No main alternative; keep all rather than strand playback.
|
|
71
|
+
if (!hasMain)
|
|
72
|
+
return true;
|
|
73
|
+
return !isAudioDescription(quality);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Disposable } from '@amazon/vinyl-util';
|
|
2
|
+
import type { TextTrackRenderer } from './TextTrackRenderer';
|
|
3
|
+
/**
|
|
4
|
+
* The subset of a `VTTCue`'s positioning properties {@link computeCueLayout}
|
|
5
|
+
* reads. A native `VTTCue` satisfies this; a plain `TextTrackCue` (platforms
|
|
6
|
+
* without `VTTCue`) leaves them undefined and falls back to defaults.
|
|
7
|
+
*/
|
|
8
|
+
export interface CueGeometry {
|
|
9
|
+
readonly align?: string | null;
|
|
10
|
+
readonly line?: number | AutoKeyword;
|
|
11
|
+
readonly lineAlign?: LineAlignSetting;
|
|
12
|
+
readonly position?: number | AutoKeyword;
|
|
13
|
+
readonly positionAlign?: PositionAlignSetting;
|
|
14
|
+
readonly size?: number;
|
|
15
|
+
readonly snapToLines?: boolean;
|
|
16
|
+
readonly vertical?: DirectionSetting;
|
|
17
|
+
}
|
|
18
|
+
/** Inline styles (camelCase CSS properties) to apply to a rendered cue box. */
|
|
19
|
+
export type CueLayout = Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Maps a cue's WebVTT positioning settings to inline CSS. Pure and DOM-free so
|
|
22
|
+
* the (branchy) placement logic is unit-testable in isolation.
|
|
23
|
+
*
|
|
24
|
+
* A cue with neither `line` nor `position` set flows in the renderer's
|
|
25
|
+
* bottom-anchored, centered container (the common subtitle case). Otherwise it
|
|
26
|
+
* is absolutely positioned: `size` → width, `position`/`positionAlign` →
|
|
27
|
+
* horizontal, `line`/`lineAlign`/`snapToLines` → vertical (percentage lines, or
|
|
28
|
+
* whole rows counted from the bottom for negative integers), `align` → text
|
|
29
|
+
* alignment, `vertical` → writing mode.
|
|
30
|
+
*/
|
|
31
|
+
export declare function computeCueLayout(cue: CueGeometry): CueLayout;
|
|
32
|
+
/**
|
|
33
|
+
* Renders a cue's text payload as safe HTML. Text is escaped (so it can't
|
|
34
|
+
* inject nodes); newlines become `<br>`; and WebVTT cue tags are converted:
|
|
35
|
+
* `<c.foo>`→`<span class="foo">`, `<i>/<b>/<u>/<ruby>/<rt>` pass through,
|
|
36
|
+
* `<v Name>`→`<span title>`, `<lang xx>`→`<span lang>`, timestamp tags are
|
|
37
|
+
* dropped. Class-based styling requires matching app CSS (STYLE blocks in the
|
|
38
|
+
* VTT are not applied).
|
|
39
|
+
*/
|
|
40
|
+
export declare function renderCueText(text: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* A {@link TextTrackRenderer} that paints cues as HTML into {@link element}.
|
|
43
|
+
* Mount `element` over the video; it stacks cues at the bottom, centered, and
|
|
44
|
+
* positions any cue that carries explicit WebVTT settings. The DOM track is
|
|
45
|
+
* expected to be `'hidden'` so only this renderer paints.
|
|
46
|
+
*/
|
|
47
|
+
export declare class HtmlTextTrackRenderer implements TextTrackRenderer, Disposable {
|
|
48
|
+
/** The overlay container to mount over the video. */
|
|
49
|
+
readonly element: HTMLElement;
|
|
50
|
+
private track;
|
|
51
|
+
private readonly styleElement;
|
|
52
|
+
private readonly onCueChange;
|
|
53
|
+
constructor();
|
|
54
|
+
setTextTrack(track: TextTrack | null): void;
|
|
55
|
+
setStyles(styles: readonly string[]): void;
|
|
56
|
+
dispose(): void;
|
|
57
|
+
private renderActiveCues;
|
|
58
|
+
private createCueBox;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=HtmlTextTrackRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlTextTrackRenderer.d.ts","sourceRoot":"","sources":["../../../../src/text/HtmlTextTrackRenderer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D;;;;GAIG;AACH,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAA;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;IACxC,QAAQ,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAA;IAC7C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CACvC;AAED,+EAA+E;AAC/E,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAK9C;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,CAmD5D;AAmDD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoBlD;AAeD;;;;;GAKG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB,EAAE,UAAU;IACvE,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;IAE7B,OAAO,CAAC,KAAK,CAAyB;IAGtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkB;IAC/C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;;IAgB5D,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI;IAe3C,SAAS,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAI1C,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,YAAY;CAOvB"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/** Approximate row height for integer (snap-to-lines) `line` offsets. */
|
|
6
|
+
const ROW_EM = 1.5;
|
|
7
|
+
/**
|
|
8
|
+
* Maps a cue's WebVTT positioning settings to inline CSS. Pure and DOM-free so
|
|
9
|
+
* the (branchy) placement logic is unit-testable in isolation.
|
|
10
|
+
*
|
|
11
|
+
* A cue with neither `line` nor `position` set flows in the renderer's
|
|
12
|
+
* bottom-anchored, centered container (the common subtitle case). Otherwise it
|
|
13
|
+
* is absolutely positioned: `size` → width, `position`/`positionAlign` →
|
|
14
|
+
* horizontal, `line`/`lineAlign`/`snapToLines` → vertical (percentage lines, or
|
|
15
|
+
* whole rows counted from the bottom for negative integers), `align` → text
|
|
16
|
+
* alignment, `vertical` → writing mode.
|
|
17
|
+
*/
|
|
18
|
+
export function computeCueLayout(cue) {
|
|
19
|
+
const style = {};
|
|
20
|
+
// WebVTT's default text alignment is 'center'.
|
|
21
|
+
style.textAlign = cue.align || 'center';
|
|
22
|
+
if (cue.vertical === 'rl')
|
|
23
|
+
style.writingMode = 'vertical-rl';
|
|
24
|
+
else if (cue.vertical === 'lr')
|
|
25
|
+
style.writingMode = 'vertical-lr';
|
|
26
|
+
const size = typeof cue.size === 'number' ? cue.size : 100;
|
|
27
|
+
style.maxWidth = `${size}%`;
|
|
28
|
+
const line = typeof cue.line === 'number' ? cue.line : null;
|
|
29
|
+
const position = typeof cue.position === 'number' ? cue.position : null;
|
|
30
|
+
if (line == null && position == null)
|
|
31
|
+
return style;
|
|
32
|
+
style.position = 'absolute';
|
|
33
|
+
const transforms = [];
|
|
34
|
+
if (position == null) {
|
|
35
|
+
style.left = '50%';
|
|
36
|
+
transforms.push('translateX(-50%)');
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
if (cue.positionAlign === 'line-right') {
|
|
40
|
+
style.right = `${100 - position}%`;
|
|
41
|
+
}
|
|
42
|
+
else if (cue.positionAlign === 'line-left') {
|
|
43
|
+
style.left = `${position}%`;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
style.left = `${position}%`;
|
|
47
|
+
transforms.push('translateX(-50%)');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (line == null) {
|
|
51
|
+
style.bottom = '0';
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
if (cue.snapToLines === false) {
|
|
55
|
+
if (cue.lineAlign === 'end') {
|
|
56
|
+
style.bottom = `${100 - line}%`;
|
|
57
|
+
}
|
|
58
|
+
else if (cue.lineAlign === 'center') {
|
|
59
|
+
style.top = `${line}%`;
|
|
60
|
+
transforms.push('translateY(-50%)');
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
style.top = `${line}%`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else if (line < 0) {
|
|
67
|
+
style.bottom = `${(-line - 1) * ROW_EM}em`;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
style.top = `${line * ROW_EM}em`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (transforms.length > 0)
|
|
74
|
+
style.transform = transforms.join(' ');
|
|
75
|
+
return style;
|
|
76
|
+
}
|
|
77
|
+
const HTML_ESCAPE = {
|
|
78
|
+
'&': '&',
|
|
79
|
+
'<': '<',
|
|
80
|
+
'>': '>',
|
|
81
|
+
'"': '"',
|
|
82
|
+
};
|
|
83
|
+
/** Escapes text (and attribute values) for safe insertion via innerHTML. */
|
|
84
|
+
function escapeHtml(text) {
|
|
85
|
+
// Character class, no backtracking.
|
|
86
|
+
return text.replace(/["&<>]/g, (ch) => HTML_ESCAPE[ch]);
|
|
87
|
+
}
|
|
88
|
+
// WebVTT inline tags rendered as the matching HTML element.
|
|
89
|
+
const PASSTHROUGH_TAGS = new Set(['i', 'b', 'u', 'ruby', 'rt']);
|
|
90
|
+
// Tags rendered as a <span> (styling/metadata carried via class/attributes).
|
|
91
|
+
const SPAN_TAGS = new Set(['c', 'v', 'lang']);
|
|
92
|
+
/** Opening HTML for a WebVTT start tag `inner` (the text between `<` and `>`). */
|
|
93
|
+
function openTag(inner) {
|
|
94
|
+
// Timestamp tags (`<00:00:00.000>`) carry no styling — drop them.
|
|
95
|
+
if (/^\d/.test(inner))
|
|
96
|
+
return '';
|
|
97
|
+
// The head (before any annotation) is `name` plus `.class` segments.
|
|
98
|
+
const head = inner.split(/\s/, 1)[0];
|
|
99
|
+
const [name, ...classes] = head.split('.');
|
|
100
|
+
const annotation = inner.slice(head.length).trim();
|
|
101
|
+
const classAttr = classes.filter(Boolean).length
|
|
102
|
+
? ` class="${escapeHtml(classes.filter(Boolean).join(' '))}"`
|
|
103
|
+
: '';
|
|
104
|
+
if (PASSTHROUGH_TAGS.has(name))
|
|
105
|
+
return `<${name}${classAttr}>`;
|
|
106
|
+
if (name === 'v') {
|
|
107
|
+
const title = annotation ? ` title="${escapeHtml(annotation)}"` : '';
|
|
108
|
+
return `<span${classAttr}${title}>`;
|
|
109
|
+
}
|
|
110
|
+
if (name === 'lang') {
|
|
111
|
+
const lang = annotation ? ` lang="${escapeHtml(annotation)}"` : '';
|
|
112
|
+
return `<span${classAttr}${lang}>`;
|
|
113
|
+
}
|
|
114
|
+
if (name === 'c')
|
|
115
|
+
return `<span${classAttr}>`;
|
|
116
|
+
return ''; // unknown tag: drop
|
|
117
|
+
}
|
|
118
|
+
/** Closing HTML for a WebVTT end tag named `name`. */
|
|
119
|
+
function closeTag(name) {
|
|
120
|
+
if (PASSTHROUGH_TAGS.has(name))
|
|
121
|
+
return `</${name}>`;
|
|
122
|
+
if (SPAN_TAGS.has(name))
|
|
123
|
+
return '</span>';
|
|
124
|
+
return '';
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Renders a cue's text payload as safe HTML. Text is escaped (so it can't
|
|
128
|
+
* inject nodes); newlines become `<br>`; and WebVTT cue tags are converted:
|
|
129
|
+
* `<c.foo>`→`<span class="foo">`, `<i>/<b>/<u>/<ruby>/<rt>` pass through,
|
|
130
|
+
* `<v Name>`→`<span title>`, `<lang xx>`→`<span lang>`, timestamp tags are
|
|
131
|
+
* dropped. Class-based styling requires matching app CSS (STYLE blocks in the
|
|
132
|
+
* VTT are not applied).
|
|
133
|
+
*/
|
|
134
|
+
export function renderCueText(text) {
|
|
135
|
+
let html = '';
|
|
136
|
+
// Each match is one tag (`<…>`), a run of non-`<` text, or a stray `<`.
|
|
137
|
+
// The tag body excludes `<` (as well as `>`) so a failed tag match on a
|
|
138
|
+
// `<`-heavy string bails after one char rather than scanning to the end —
|
|
139
|
+
// keeping this linear (no polynomial backtracking) on adversarial input.
|
|
140
|
+
for (const token of text.match(/<[^<>]*>|[^<]+|</g) ?? []) {
|
|
141
|
+
if (token[0] !== '<' || token === '<') {
|
|
142
|
+
html += escapeHtml(token).replace(/\n/g, '<br>');
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
const inner = token.slice(1, -1);
|
|
146
|
+
html +=
|
|
147
|
+
inner[0] === '/'
|
|
148
|
+
? closeTag(inner.slice(1).split(/[.\s]/, 1)[0].toLowerCase())
|
|
149
|
+
: openTag(inner);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return html;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Rewrites a WebVTT `STYLE` block's `::cue` selectors to target this renderer's
|
|
156
|
+
* HTML cue elements: `::cue(<sel>)` → `.vinyl-text-cue <sel>` (cue components
|
|
157
|
+
* become descendants of the cue box) and bare `::cue` → `.vinyl-text-cue`.
|
|
158
|
+
* Rules are global to `.vinyl-text-cue`, so concurrent players share them.
|
|
159
|
+
*/
|
|
160
|
+
function scopeCueRules(css) {
|
|
161
|
+
// Bounded character classes; no nested quantifiers, so no backtracking blowup.
|
|
162
|
+
return css
|
|
163
|
+
.replace(/::cue\(([^)]*)\)/g, '.vinyl-text-cue $1')
|
|
164
|
+
.replace(/::cue\b/g, '.vinyl-text-cue');
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* A {@link TextTrackRenderer} that paints cues as HTML into {@link element}.
|
|
168
|
+
* Mount `element` over the video; it stacks cues at the bottom, centered, and
|
|
169
|
+
* positions any cue that carries explicit WebVTT settings. The DOM track is
|
|
170
|
+
* expected to be `'hidden'` so only this renderer paints.
|
|
171
|
+
*/
|
|
172
|
+
export class HtmlTextTrackRenderer {
|
|
173
|
+
/** The overlay container to mount over the video. */
|
|
174
|
+
element;
|
|
175
|
+
track = null;
|
|
176
|
+
// Holds the authored STYLE-block CSS (::cue rules rewritten to target our
|
|
177
|
+
// cue elements). A <style> renders nothing itself, so it lives in-container.
|
|
178
|
+
styleElement;
|
|
179
|
+
onCueChange = () => this.renderActiveCues();
|
|
180
|
+
constructor() {
|
|
181
|
+
this.element = document.createElement('div');
|
|
182
|
+
this.element.className = 'vinyl-text-container';
|
|
183
|
+
Object.assign(this.element.style, {
|
|
184
|
+
display: 'flex',
|
|
185
|
+
flexDirection: 'column',
|
|
186
|
+
justifyContent: 'flex-end',
|
|
187
|
+
alignItems: 'center',
|
|
188
|
+
pointerEvents: 'none',
|
|
189
|
+
});
|
|
190
|
+
this.styleElement = document.createElement('style');
|
|
191
|
+
this.element.appendChild(this.styleElement);
|
|
192
|
+
}
|
|
193
|
+
setTextTrack(track) {
|
|
194
|
+
if (track === this.track)
|
|
195
|
+
return;
|
|
196
|
+
this.track?.removeEventListener('cuechange', this.onCueChange);
|
|
197
|
+
this.track = track;
|
|
198
|
+
// Drop the previous track's authored styles; the new one supplies its
|
|
199
|
+
// own via setStyles once loaded.
|
|
200
|
+
this.styleElement.textContent = '';
|
|
201
|
+
if (!track) {
|
|
202
|
+
this.element.replaceChildren(this.styleElement);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
track.addEventListener('cuechange', this.onCueChange);
|
|
206
|
+
this.renderActiveCues();
|
|
207
|
+
}
|
|
208
|
+
setStyles(styles) {
|
|
209
|
+
this.styleElement.textContent = styles.map(scopeCueRules).join('\n');
|
|
210
|
+
}
|
|
211
|
+
dispose() {
|
|
212
|
+
this.setTextTrack(null);
|
|
213
|
+
}
|
|
214
|
+
renderActiveCues() {
|
|
215
|
+
// Only invoked while a track is attached (from setTextTrack / cuechange).
|
|
216
|
+
const active = this.track.activeCues ?? [];
|
|
217
|
+
// Keep the <style> element; replace only the cue boxes.
|
|
218
|
+
const children = [this.styleElement];
|
|
219
|
+
for (let i = 0; i < active.length; i++) {
|
|
220
|
+
children.push(this.createCueBox(active[i]));
|
|
221
|
+
}
|
|
222
|
+
this.element.replaceChildren(...children);
|
|
223
|
+
}
|
|
224
|
+
createCueBox(cue) {
|
|
225
|
+
const box = document.createElement('div');
|
|
226
|
+
box.className = 'vinyl-text-cue';
|
|
227
|
+
Object.assign(box.style, computeCueLayout(cue));
|
|
228
|
+
box.innerHTML = renderCueText(cue.text ?? '');
|
|
229
|
+
return box;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { EventHostImpl, type Maybe, type RequestInitOptions } from '@amazon/vinyl-util';
|
|
2
|
+
import type { TextTrackController, TextTrackControllerOptions, TextTrackEventMap, TextTrackInfo } from './TextTrack';
|
|
3
|
+
import type { ObservableValue } from '@amazon/vinyl-observable';
|
|
4
|
+
import type { MediaTextTrackProvider } from './mediaTextTrackProvider';
|
|
5
|
+
import type { ReadonlyPlaybackController } from '../playback/ReadonlyPlaybackController';
|
|
6
|
+
import type { TextTrackRenderer } from './TextTrackRenderer';
|
|
7
|
+
export interface SidecarTextTrackControllerDeps {
|
|
8
|
+
/**
|
|
9
|
+
* Hands out (memoized) DOM text tracks. Text tracks can only be created on a
|
|
10
|
+
* media element and never removed, so the provider reuses one track per
|
|
11
|
+
* rendition rather than accumulating them.
|
|
12
|
+
*/
|
|
13
|
+
readonly textTrackProvider: MediaTextTrackProvider;
|
|
14
|
+
/**
|
|
15
|
+
* Optional request init options forwarded with each VTT fetch (e.g. CORS).
|
|
16
|
+
*/
|
|
17
|
+
readonly requestInit?: Maybe<RequestInitOptions>;
|
|
18
|
+
/**
|
|
19
|
+
* The discovered text tracks, re-emitted whenever the manifest changes.
|
|
20
|
+
*/
|
|
21
|
+
readonly textTracks: ObservableValue<Promise<readonly TextTrackInfo[]>>;
|
|
22
|
+
/**
|
|
23
|
+
* Declarative selection / rendering configuration. Re-applied on change.
|
|
24
|
+
*/
|
|
25
|
+
readonly options: ObservableValue<TextTrackControllerOptions>;
|
|
26
|
+
/**
|
|
27
|
+
* Supplies the current playhead used to fetch caption segments in a window
|
|
28
|
+
* around it.
|
|
29
|
+
*/
|
|
30
|
+
readonly playbackController: ReadonlyPlaybackController;
|
|
31
|
+
/**
|
|
32
|
+
* Optional renderer that paints cues itself (HTML overlay). When provided,
|
|
33
|
+
* the DOM text track is kept `'hidden'` (timing only) and the renderer is
|
|
34
|
+
* handed the active track; without one, the track renders natively
|
|
35
|
+
* (`'showing'`).
|
|
36
|
+
*/
|
|
37
|
+
readonly textTrackRenderer?: Maybe<TextTrackRenderer>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Selects the text track that matches the given options, or null for none.
|
|
41
|
+
*
|
|
42
|
+
* The `enabled` mode gates everything: `'off'` renders nothing (default is
|
|
43
|
+
* `'forced'`). Otherwise an explicit {@link TextTrackSelection.id} wins; else
|
|
44
|
+
* the best language match is chosen among tracks filtered by kind and
|
|
45
|
+
* forced-ness. Forced-ness comes from {@link TextTrackSelection.forced} when
|
|
46
|
+
* set, otherwise from the mode (`'forced'` keeps only forced tracks, `'on'`
|
|
47
|
+
* only full tracks).
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveSelectedTrack(tracks: readonly TextTrackInfo[], options: TextTrackControllerOptions): TextTrackInfo | null;
|
|
52
|
+
/**
|
|
53
|
+
* Manages a sidecar WebVTT-based text track lifecycle:
|
|
54
|
+
*
|
|
55
|
+
* - tracks the discovered {@link TextTrackInfo} list (from the `textTracks`
|
|
56
|
+
* observable) and the current selection (from the `options` observable)
|
|
57
|
+
* - on selection, fetches the chosen track's WebVTT and pushes cues to a DOM
|
|
58
|
+
* `TextTrack` obtained from the {@link MediaTextTrackProvider}
|
|
59
|
+
* - clears cues and hides the DOM track when the selection changes or clears
|
|
60
|
+
*
|
|
61
|
+
* The controller is agnostic of HLS/DASH discovery details; its inputs are the
|
|
62
|
+
* observables supplied by the manifest layer.
|
|
63
|
+
*/
|
|
64
|
+
export declare class SidecarTextTrackController extends EventHostImpl<TextTrackEventMap> implements TextTrackController {
|
|
65
|
+
private readonly deps;
|
|
66
|
+
get [Symbol.toStringTag](): string;
|
|
67
|
+
private _active;
|
|
68
|
+
private _tracks;
|
|
69
|
+
private _activeTextTrack;
|
|
70
|
+
private _ref;
|
|
71
|
+
private readonly loadAbort;
|
|
72
|
+
private readonly disposer;
|
|
73
|
+
constructor(deps: SidecarTextTrackControllerDeps);
|
|
74
|
+
get textTracks(): readonly TextTrackInfo[];
|
|
75
|
+
get activeTextTrack(): TextTrackInfo | null;
|
|
76
|
+
get active(): boolean;
|
|
77
|
+
get disposed(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Replaces the discovered track list, emits `textTracksChange`, then
|
|
80
|
+
* re-applies the current selection against the new list.
|
|
81
|
+
*/
|
|
82
|
+
private setTracks;
|
|
83
|
+
/**
|
|
84
|
+
* Recomputes the selection from the current options and track list,
|
|
85
|
+
* emitting `activeTextTrackChange` on change and (re)rendering when active.
|
|
86
|
+
*/
|
|
87
|
+
private refreshSelection;
|
|
88
|
+
deactivate(): void;
|
|
89
|
+
activate(): void;
|
|
90
|
+
private startLoad;
|
|
91
|
+
private appendCues;
|
|
92
|
+
/**
|
|
93
|
+
* Clears cues from the current DOM track and hides it, keeping the track for
|
|
94
|
+
* later reuse via the provider.
|
|
95
|
+
*/
|
|
96
|
+
private hideCurrent;
|
|
97
|
+
/**
|
|
98
|
+
* Cancels any in-flight load, hides the DOM text track, and resets state.
|
|
99
|
+
* Called by the host when the underlying media is unloaded.
|
|
100
|
+
*/
|
|
101
|
+
dispose(): void;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=SidecarTextTrackController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidecarTextTrackController.d.ts","sourceRoot":"","sources":["../../../../src/text/SidecarTextTrackController.ts"],"names":[],"mappings":"AAKA,OAAO,EAKH,aAAa,EAEb,KAAK,KAAK,EACV,KAAK,kBAAkB,EAC1B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EACR,mBAAmB,EACnB,0BAA0B,EAC1B,iBAAiB,EACjB,aAAa,EAChB,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAG/D,OAAO,KAAK,EACR,sBAAsB,EAEzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAA;AACxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,MAAM,WAAW,8BAA8B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,EAAE,sBAAsB,CAAA;IAElD;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAA;IAEhD;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAAC,CAAA;IAEvE;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,0BAA0B,CAAC,CAAA;IAE7D;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,EAAE,0BAA0B,CAAA;IAEvD;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAA;CACxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,OAAO,EAAE,0BAA0B,GACpC,aAAa,GAAG,IAAI,CAiBtB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,0BACT,SAAQ,aAAa,CAAC,iBAAiB,CACvC,YAAW,mBAAmB;IAkBlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAhBjC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;IAID,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,gBAAgB,CAA6B;IAGrD,OAAO,CAAC,IAAI,CAA4B;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;IACzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;gBAEf,IAAI,EAAE,8BAA8B;IAmBjE,IAAI,UAAU,IAAI,SAAS,aAAa,EAAE,CAEzC;IAED,IAAI,eAAe,IAAI,aAAa,GAAG,IAAI,CAE1C;IAED,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;OAGG;IACH,OAAO,CAAC,SAAS;IASjB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAqBxB,UAAU,IAAI,IAAI;IAKlB,QAAQ,IAAI,IAAI;IAOhB,OAAO,CAAC,SAAS;IAwDjB,OAAO,CAAC,UAAU;IAqBlB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAYnB;;;OAGG;IACH,OAAO,IAAI,IAAI;CASlB"}
|