@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.
- package/dist/index.cjs +1103 -1042
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +810 -739
- package/dist/index.js.map +4 -4
- package/dist/test/benchmark.js.map +2 -2
- package/dist/test/integ.es5.js +394 -388
- package/dist/test/integ.js +2626 -2032
- package/dist/test/integ.js.map +4 -4
- package/dist/test/jasmine.css +50 -3
- package/dist/test/jasmineHtml.es5.js +195 -155
- package/dist/test/jasmineHtml.js +2938 -1833
- package/dist/test/jasmineHtml.js.map +3 -3
- package/dist/types/current/ad/AdControllerImpl.d.ts.map +1 -1
- package/dist/types/current/ad/AdControllerImpl.js +4 -1
- package/dist/types/current/ad/discoverHlsInterstitials.d.ts.map +1 -1
- package/dist/types/current/ad/discoverHlsInterstitials.js +2 -2
- package/dist/types/current/drm/DrmControllerImpl.d.ts +19 -1
- package/dist/types/current/drm/DrmControllerImpl.d.ts.map +1 -1
- package/dist/types/current/drm/DrmControllerImpl.js +101 -58
- package/dist/types/current/drm/licenseProvider/defaultLicenseProvider.d.ts.map +1 -1
- package/dist/types/current/drm/licenseProvider/defaultLicenseProvider.js +2 -2
- package/dist/types/current/index.d.ts +3 -6
- package/dist/types/current/index.d.ts.map +1 -1
- package/dist/types/current/index.js +3 -6
- package/dist/types/current/playback/PlaybackControllerImpl.d.ts +15 -0
- package/dist/types/current/playback/PlaybackControllerImpl.d.ts.map +1 -1
- package/dist/types/current/playback/PlaybackControllerImpl.js +100 -9
- package/dist/types/current/playback/ReadonlyPlaybackController.d.ts +27 -1
- package/dist/types/current/playback/ReadonlyPlaybackController.d.ts.map +1 -1
- package/dist/types/current/playback/ReadonlyPlaybackController.js +16 -0
- 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 +94 -0
- package/dist/types/current/streaming/AudioOptions.d.ts +27 -0
- package/dist/types/current/streaming/AudioOptions.d.ts.map +1 -1
- package/dist/types/current/streaming/AudioOptions.js +5 -1
- package/dist/types/current/streaming/ContentStream.d.ts +0 -5
- package/dist/types/current/streaming/ContentStream.d.ts.map +1 -1
- package/dist/types/current/streaming/ContentStream.js +0 -4
- package/dist/types/current/streaming/LoadMetric.d.ts +15 -1
- package/dist/types/current/streaming/LoadMetric.d.ts.map +1 -1
- package/dist/types/current/streaming/StreamingEventMap.d.ts +1 -5
- package/dist/types/current/streaming/StreamingEventMap.d.ts.map +1 -1
- package/dist/types/current/streaming/StreamingEventMap.js +0 -1
- package/dist/types/current/streaming/buffering/BufferingController.d.ts +0 -11
- package/dist/types/current/streaming/buffering/BufferingController.d.ts.map +1 -1
- package/dist/types/current/streaming/buffering/BufferingController.js +0 -13
- package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.d.ts.map +1 -1
- package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.js +13 -4
- package/dist/types/current/streaming/mediaTimelineFilter.d.ts +4 -2
- package/dist/types/current/streaming/mediaTimelineFilter.d.ts.map +1 -1
- package/dist/types/current/streaming/mediaTimelineFilter.js +23 -8
- package/dist/types/current/text/SidecarTextTrackLoader.d.ts.map +1 -1
- package/dist/types/current/text/SidecarTextTrackLoader.js +4 -4
- package/dist/types/current/text/TextTrack.d.ts.map +1 -1
- package/dist/types/current/track/TrackController.d.ts.map +1 -1
- package/dist/types/current/track/TrackController.js +8 -2
- package/dist/types/current/track/createSegmentDataProvider.d.ts.map +1 -1
- package/dist/types/current/track/createSegmentDataProvider.js +6 -3
- package/dist/types/current/track/dash/DashMediaQualityMetadataResolver.d.ts +10 -6
- package/dist/types/current/track/dash/DashMediaQualityMetadataResolver.d.ts.map +1 -1
- package/dist/types/current/track/dash/DashMediaQualityMetadataResolver.js +13 -8
- package/dist/types/current/track/dash/createDashFactories.d.ts +1 -1
- package/dist/types/current/track/dash/timeline/DashRepresentationSegmentProvider.d.ts.map +1 -1
- package/dist/types/current/track/dash/timeline/DashRepresentationSegmentProvider.js +71 -3
- package/dist/types/current/track/dash/urlDashManifestProvider.js +2 -2
- package/dist/types/current/track/dash/util/mpd.d.ts +6 -0
- package/dist/types/current/track/dash/util/mpd.d.ts.map +1 -1
- package/dist/types/current/track/dash/util/mpd.js +24 -3
- package/dist/types/current/track/filters/resourceTypeFilter.d.ts +4 -0
- package/dist/types/current/track/filters/resourceTypeFilter.d.ts.map +1 -1
- package/dist/types/current/track/filters/resourceTypeFilter.js +4 -0
- package/dist/types/current/track/filters/sampleRateFilter.d.ts +25 -7
- package/dist/types/current/track/filters/sampleRateFilter.d.ts.map +1 -1
- package/dist/types/current/track/filters/sampleRateFilter.js +52 -24
- package/dist/types/current/track/hls/createHlsFactories.d.ts +1 -1
- package/dist/types/current/track/hls/createUrlHlsManifestProvider.d.ts.map +1 -1
- package/dist/types/current/track/hls/createUrlHlsManifestProvider.js +3 -3
- package/dist/types/current/track/mse/MseTrack.d.ts +0 -17
- package/dist/types/current/track/mse/MseTrack.d.ts.map +1 -1
- package/dist/types/current/track/mse/MseTrack.js +1 -45
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- 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/current/vinyl/VinylPlayer.d.ts +5 -0
- package/dist/types/current/vinyl/VinylPlayer.d.ts.map +1 -1
- package/dist/types/current/vinyl/VinylPlayer.js +23 -1
- package/dist/types/current/vinyl/createVinylFactories.d.ts +7 -16
- package/dist/types/current/vinyl/createVinylFactories.d.ts.map +1 -1
- package/dist/types/current/vinyl/createVinylFactories.js +2 -12
- package/dist/types/ts3.7/drm/DrmControllerImpl.d.ts +19 -1
- package/dist/types/ts3.7/index.d.ts +3 -6
- package/dist/types/ts3.7/playback/PlaybackControllerImpl.d.ts +15 -0
- package/dist/types/ts3.7/playback/ReadonlyPlaybackController.d.ts +28 -0
- 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 +27 -0
- package/dist/types/ts3.7/streaming/ContentStream.d.ts +0 -5
- package/dist/types/ts3.7/streaming/LoadMetric.d.ts +15 -1
- package/dist/types/ts3.7/streaming/StreamingEventMap.d.ts +0 -5
- package/dist/types/ts3.7/streaming/buffering/BufferingController.d.ts +0 -11
- package/dist/types/ts3.7/streaming/mediaTimelineFilter.d.ts +4 -2
- package/dist/types/ts3.7/track/dash/DashMediaQualityMetadataResolver.d.ts +10 -6
- package/dist/types/ts3.7/track/dash/createDashFactories.d.ts +1 -1
- package/dist/types/ts3.7/track/dash/util/mpd.d.ts +6 -0
- package/dist/types/ts3.7/track/filters/resourceTypeFilter.d.ts +4 -0
- package/dist/types/ts3.7/track/filters/sampleRateFilter.d.ts +25 -7
- package/dist/types/ts3.7/track/hls/createHlsFactories.d.ts +1 -1
- package/dist/types/ts3.7/track/mse/MseTrack.d.ts +0 -17
- package/dist/types/ts3.7/util/media/mimeType.d.ts +8 -0
- package/dist/types/ts3.7/vinyl/VinylPlayer.d.ts +5 -0
- package/dist/types/ts3.7/vinyl/createVinylFactories.d.ts +7 -16
- package/dist/types/ts4.1/drm/DrmControllerImpl.d.ts +19 -1
- package/dist/types/ts4.1/index.d.ts +3 -6
- package/dist/types/ts4.1/playback/PlaybackControllerImpl.d.ts +15 -0
- package/dist/types/ts4.1/playback/ReadonlyPlaybackController.d.ts +28 -0
- 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 +27 -0
- package/dist/types/ts4.1/streaming/ContentStream.d.ts +0 -5
- package/dist/types/ts4.1/streaming/LoadMetric.d.ts +15 -1
- package/dist/types/ts4.1/streaming/StreamingEventMap.d.ts +0 -5
- package/dist/types/ts4.1/streaming/buffering/BufferingController.d.ts +0 -11
- package/dist/types/ts4.1/streaming/mediaTimelineFilter.d.ts +4 -2
- package/dist/types/ts4.1/track/dash/DashMediaQualityMetadataResolver.d.ts +10 -6
- package/dist/types/ts4.1/track/dash/createDashFactories.d.ts +1 -1
- package/dist/types/ts4.1/track/dash/util/mpd.d.ts +6 -0
- package/dist/types/ts4.1/track/filters/resourceTypeFilter.d.ts +4 -0
- package/dist/types/ts4.1/track/filters/sampleRateFilter.d.ts +25 -7
- package/dist/types/ts4.1/track/hls/createHlsFactories.d.ts +1 -1
- package/dist/types/ts4.1/track/mse/MseTrack.d.ts +0 -17
- package/dist/types/ts4.1/util/media/mimeType.d.ts +8 -0
- package/dist/types/ts4.1/vinyl/VinylPlayer.d.ts +5 -0
- package/dist/types/ts4.1/vinyl/createVinylFactories.d.ts +7 -16
- package/dist/types/ts4.7/drm/DrmControllerImpl.d.ts +19 -1
- package/dist/types/ts4.7/index.d.ts +3 -6
- package/dist/types/ts4.7/playback/PlaybackControllerImpl.d.ts +15 -0
- package/dist/types/ts4.7/playback/ReadonlyPlaybackController.d.ts +28 -0
- 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 +27 -0
- package/dist/types/ts4.7/streaming/ContentStream.d.ts +0 -5
- package/dist/types/ts4.7/streaming/LoadMetric.d.ts +15 -1
- package/dist/types/ts4.7/streaming/StreamingEventMap.d.ts +0 -5
- package/dist/types/ts4.7/streaming/buffering/BufferingController.d.ts +0 -11
- package/dist/types/ts4.7/streaming/mediaTimelineFilter.d.ts +4 -2
- package/dist/types/ts4.7/track/dash/DashMediaQualityMetadataResolver.d.ts +10 -6
- package/dist/types/ts4.7/track/dash/createDashFactories.d.ts +1 -1
- package/dist/types/ts4.7/track/dash/util/mpd.d.ts +6 -0
- package/dist/types/ts4.7/track/filters/resourceTypeFilter.d.ts +4 -0
- package/dist/types/ts4.7/track/filters/sampleRateFilter.d.ts +25 -7
- package/dist/types/ts4.7/track/hls/createHlsFactories.d.ts +1 -1
- package/dist/types/ts4.7/track/mse/MseTrack.d.ts +0 -17
- package/dist/types/ts4.7/util/media/mimeType.d.ts +8 -0
- package/dist/types/ts4.7/vinyl/VinylPlayer.d.ts +5 -0
- package/dist/types/ts4.7/vinyl/createVinylFactories.d.ts +7 -16
- package/dist/unit/types/current/ad/AdControllerImpl.test.js +27 -1
- package/dist/unit/types/current/drm/DrmControllerImpl.test.js +146 -9
- package/dist/unit/types/current/index.d.ts +3 -4
- package/dist/unit/types/current/index.d.ts.map +1 -1
- package/dist/unit/types/current/index.js +3 -4
- package/dist/unit/types/current/playback/PlaybackControllerImpl.test.js +165 -0
- 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 +125 -0
- package/dist/unit/types/current/streaming/ContentStream.test.js +0 -11
- package/dist/unit/types/current/streaming/MseTrack.test.js +49 -73
- package/dist/unit/types/current/streaming/abr/QualitySelectorImpl.test.js +1 -1
- package/dist/unit/types/current/streaming/buffering/BufferingController.test.js +0 -21
- package/dist/unit/types/current/streaming/createDefaultMediaTimelineTransformer.test.js +133 -0
- package/dist/unit/types/current/streaming/mediaTimelineFilter.test.js +60 -54
- package/dist/unit/types/current/track/TrackController.test.js +61 -1
- package/dist/unit/types/current/track/createSegmentDataProvider.test.js +18 -0
- package/dist/unit/types/current/track/dash/DashMediaQualityMetadataResolver.test.js +46 -14
- package/dist/unit/types/current/track/dash/createSegmentControllerFactory.test.js +1 -0
- package/dist/unit/types/current/track/dash/timeline/DashRepresentationSegmentProvider.test.js +114 -0
- package/dist/unit/types/current/track/dash/util/mpd.test.js +37 -0
- package/dist/unit/types/current/track/filters/resourceTypeFilter.test.js +7 -0
- package/dist/unit/types/current/track/filters/sampleRateFilter.test.js +211 -34
- package/dist/unit/types/current/track/source/SourceObjectTrack.test.js +1 -1
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- 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/VinylPlayer.test.js +33 -2
- package/dist/unit/types/current/vinyl/createVinylFactories.test.js +2 -36
- package/dist/vinylTestUtil/index.js +6 -4
- package/dist/vinylTestUtil/index.js.map +2 -2
- package/dist/vinylTestUtil/types/current/assets/vinylTestAssets.d.ts +1 -0
- package/dist/vinylTestUtil/types/current/assets/vinylTestAssets.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/assets/vinylTestAssets.js +1 -0
- package/dist/vinylTestUtil/types/current/media/FrequencyAnalyzer.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/streaming/MockContentStream.d.ts +0 -1
- package/dist/vinylTestUtil/types/current/mock/streaming/MockContentStream.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/streaming/MockContentStream.js +0 -1
- package/dist/vinylTestUtil/types/current/mock/streaming/buffering/MockBufferingController.d.ts +0 -1
- package/dist/vinylTestUtil/types/current/mock/streaming/buffering/MockBufferingController.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/streaming/buffering/MockBufferingController.js +0 -1
- package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/vinylTestUtil/types/current/util/playback/eventPromises.js +1 -1
- package/dist/vinylTestUtil/types/current/util/playback/expectTrackCanSeek.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/util/playback/expectTrackCanSeek.js +9 -1
- package/dist/vinylTestUtil/types/ts3.7/assets/vinylTestAssets.d.ts +1 -0
- package/dist/vinylTestUtil/types/ts3.7/mock/streaming/MockContentStream.d.ts +0 -1
- package/dist/vinylTestUtil/types/ts3.7/mock/streaming/buffering/MockBufferingController.d.ts +0 -1
- package/dist/vinylTestUtil/types/ts4.1/assets/vinylTestAssets.d.ts +1 -0
- package/dist/vinylTestUtil/types/ts4.1/mock/streaming/MockContentStream.d.ts +0 -1
- package/dist/vinylTestUtil/types/ts4.1/mock/streaming/buffering/MockBufferingController.d.ts +0 -1
- package/dist/vinylTestUtil/types/ts4.7/assets/vinylTestAssets.d.ts +1 -0
- package/dist/vinylTestUtil/types/ts4.7/mock/streaming/MockContentStream.d.ts +0 -1
- package/dist/vinylTestUtil/types/ts4.7/mock/streaming/buffering/MockBufferingController.d.ts +0 -1
- package/docs/USAGE.md +29 -0
- package/package.json +11 -10
- package/dist/types/current/patch/media/HtmlMediaElementPatch.d.ts +0 -3
- package/dist/types/current/patch/media/HtmlMediaElementPatch.d.ts.map +0 -1
- package/dist/types/current/patch/media/HtmlMediaElementPatch.js +0 -5
- package/dist/types/current/patch/media/MediaElementPatchOptions.d.ts +0 -19
- package/dist/types/current/patch/media/MediaElementPatchOptions.d.ts.map +0 -1
- package/dist/types/current/patch/media/MediaElementPatchOptions.js +0 -16
- package/dist/types/current/patch/media/patchMediaElement.d.ts +0 -9
- package/dist/types/current/patch/media/patchMediaElement.d.ts.map +0 -1
- package/dist/types/current/patch/media/patchMediaElement.js +0 -15
- package/dist/types/current/patch/media/patches/createPreventStallsPatch.d.ts +0 -17
- package/dist/types/current/patch/media/patches/createPreventStallsPatch.d.ts.map +0 -1
- package/dist/types/current/patch/media/patches/createPreventStallsPatch.js +0 -55
- package/dist/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts +0 -26
- package/dist/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts.map +0 -1
- package/dist/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.js +0 -218
- package/dist/types/current/vinyl/VinylPatchOptions.d.ts +0 -10
- package/dist/types/current/vinyl/VinylPatchOptions.d.ts.map +0 -1
- package/dist/types/current/vinyl/VinylPatchOptions.js +0 -11
- package/dist/types/ts3.7/patch/media/HtmlMediaElementPatch.d.ts +0 -3
- package/dist/types/ts3.7/patch/media/MediaElementPatchOptions.d.ts +0 -19
- package/dist/types/ts3.7/patch/media/patchMediaElement.d.ts +0 -9
- package/dist/types/ts3.7/patch/media/patches/createPreventStallsPatch.d.ts +0 -17
- package/dist/types/ts3.7/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts +0 -26
- package/dist/types/ts3.7/vinyl/VinylPatchOptions.d.ts +0 -10
- package/dist/types/ts4.1/patch/media/HtmlMediaElementPatch.d.ts +0 -3
- package/dist/types/ts4.1/patch/media/MediaElementPatchOptions.d.ts +0 -19
- package/dist/types/ts4.1/patch/media/patchMediaElement.d.ts +0 -9
- package/dist/types/ts4.1/patch/media/patches/createPreventStallsPatch.d.ts +0 -17
- package/dist/types/ts4.1/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts +0 -26
- package/dist/types/ts4.1/vinyl/VinylPatchOptions.d.ts +0 -10
- package/dist/types/ts4.7/patch/media/HtmlMediaElementPatch.d.ts +0 -3
- package/dist/types/ts4.7/patch/media/MediaElementPatchOptions.d.ts +0 -19
- package/dist/types/ts4.7/patch/media/patchMediaElement.d.ts +0 -9
- package/dist/types/ts4.7/patch/media/patches/createPreventStallsPatch.d.ts +0 -17
- package/dist/types/ts4.7/patch/media/patches/createUnreliablePlaybackEventsPatch.d.ts +0 -26
- package/dist/types/ts4.7/vinyl/VinylPatchOptions.d.ts +0 -10
- package/dist/unit/types/current/patch/media/MediaElementPatchOptions.test.d.ts +0 -2
- package/dist/unit/types/current/patch/media/MediaElementPatchOptions.test.d.ts.map +0 -1
- package/dist/unit/types/current/patch/media/MediaElementPatchOptions.test.js +0 -17
- package/dist/unit/types/current/patch/media/patchMediaElement.test.d.ts +0 -2
- package/dist/unit/types/current/patch/media/patchMediaElement.test.d.ts.map +0 -1
- package/dist/unit/types/current/patch/media/patchMediaElement.test.js +0 -36
- package/dist/unit/types/current/patch/media/patches/createPreventStallsPatch.test.d.ts +0 -2
- package/dist/unit/types/current/patch/media/patches/createPreventStallsPatch.test.d.ts.map +0 -1
- package/dist/unit/types/current/patch/media/patches/createPreventStallsPatch.test.js +0 -93
- package/dist/unit/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.test.d.ts +0 -2
- package/dist/unit/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.test.d.ts.map +0 -1
- package/dist/unit/types/current/patch/media/patches/createUnreliablePlaybackEventsPatch.test.js +0 -423
package/dist/index.cjs
CHANGED
|
@@ -74,10 +74,7 @@ __export(index_exports, {
|
|
|
74
74
|
LICENSE_TIMEOUT: () => LICENSE_TIMEOUT,
|
|
75
75
|
LIVE_DURATION: () => LIVE_DURATION,
|
|
76
76
|
LoudnessNormalizationControllerImpl: () => LoudnessNormalizationControllerImpl,
|
|
77
|
-
MAX_UNCHANGED_COUNT: () => MAX_UNCHANGED_COUNT,
|
|
78
77
|
MIN_APPEND_SIZE: () => MIN_APPEND_SIZE,
|
|
79
|
-
MIN_PLAYING_BEFORE_FAB: () => MIN_PLAYING_BEFORE_FAB,
|
|
80
|
-
MIN_STALLED_BEFORE_FAB: () => MIN_STALLED_BEFORE_FAB,
|
|
81
78
|
ManifestControllerImpl: () => ManifestControllerImpl,
|
|
82
79
|
MediaKeySessionErrorType: () => MediaKeySessionErrorType,
|
|
83
80
|
MediaSourceControllerImpl: () => MediaSourceControllerImpl,
|
|
@@ -87,7 +84,6 @@ __export(index_exports, {
|
|
|
87
84
|
MsCommonMediaKeySystemAccess: () => MsCommonMediaKeySystemAccess,
|
|
88
85
|
MsCommonMediaKeys: () => MsCommonMediaKeys,
|
|
89
86
|
MseTrack: () => MseTrack,
|
|
90
|
-
PLAYHEAD_NUDGE: () => PLAYHEAD_NUDGE,
|
|
91
87
|
PLAY_READY_KEY_SYSTEMS: () => PLAY_READY_KEY_SYSTEMS,
|
|
92
88
|
POLL_BUFFER_THROTTLE: () => POLL_BUFFER_THROTTLE,
|
|
93
89
|
PREFETCH_POLL_THROTTLE: () => PREFETCH_POLL_THROTTLE,
|
|
@@ -102,7 +98,6 @@ __export(index_exports, {
|
|
|
102
98
|
READY_TO_APPEND_TIMEOUT: () => READY_TO_APPEND_TIMEOUT,
|
|
103
99
|
RESTRICTABLE_CONTENT_TYPES: () => RESTRICTABLE_CONTENT_TYPES,
|
|
104
100
|
ReportableMediaError: () => ReportableMediaError,
|
|
105
|
-
SEEKING_STALL_TIME_CHECK: () => SEEKING_STALL_TIME_CHECK,
|
|
106
101
|
SEGMENT_START_AFFORDANCE: () => SEGMENT_START_AFFORDANCE,
|
|
107
102
|
SegmentControllerImpl: () => SegmentControllerImpl,
|
|
108
103
|
SegmentDataSlot: () => SegmentDataSlot,
|
|
@@ -113,6 +108,7 @@ __export(index_exports, {
|
|
|
113
108
|
SourceObjectTrack: () => SourceObjectTrack,
|
|
114
109
|
SourceTrack: () => SourceTrack,
|
|
115
110
|
SourceTrackBase: () => SourceTrackBase,
|
|
111
|
+
StallEndedReason: () => StallEndedReason,
|
|
116
112
|
StandardCommonEme: () => StandardCommonEme,
|
|
117
113
|
StandardCommonMediaKeySession: () => StandardCommonMediaKeySession,
|
|
118
114
|
StandardCommonMediaKeySystemAccess: () => StandardCommonMediaKeySystemAccess,
|
|
@@ -120,7 +116,6 @@ __export(index_exports, {
|
|
|
120
116
|
TIMEUPDATE_THROTTLE: () => TIMEUPDATE_THROTTLE,
|
|
121
117
|
TrackBase: () => TrackBase,
|
|
122
118
|
TrackControllerImpl: () => TrackControllerImpl,
|
|
123
|
-
UNRELIABLE_EVENTS_POLL_INTERVAL: () => UNRELIABLE_EVENTS_POLL_INTERVAL,
|
|
124
119
|
UnresolvableAdError: () => UnresolvableAdError,
|
|
125
120
|
VinylGlobal: () => VinylGlobal,
|
|
126
121
|
VinylPlayer: () => VinylPlayer,
|
|
@@ -182,14 +177,14 @@ __export(index_exports, {
|
|
|
182
177
|
createMediaQualityMetadataFromDashRepresentation: () => createMediaQualityMetadataFromDashRepresentation,
|
|
183
178
|
createMediaSource: () => createMediaSource,
|
|
184
179
|
createMediaTextTrackProvider: () => createMediaTextTrackProvider,
|
|
185
|
-
createPreventStallsPatch: () => createPreventStallsPatch,
|
|
186
180
|
createSegmentControllerFactory: () => createSegmentControllerFactory,
|
|
187
181
|
createSegmentDataProvider: () => createSegmentDataProvider,
|
|
188
182
|
createSourceObjectTrackFactory: () => createSourceObjectTrackFactory,
|
|
189
183
|
createSourceTrackFactory: () => createSourceTrackFactory,
|
|
184
|
+
createStallDetector: () => createStallDetector,
|
|
185
|
+
createStallMonitor: () => createStallMonitor,
|
|
190
186
|
createTrackFactory: () => createTrackFactory,
|
|
191
187
|
createTrackLoadOptionsFromUrl: () => createTrackLoadOptionsFromUrl,
|
|
192
|
-
createUnreliablePlaybackEventsPatch: () => createUnreliablePlaybackEventsPatch,
|
|
193
188
|
createUrlHlsManifestProvider: () => createUrlHlsManifestProvider,
|
|
194
189
|
createVinylFactories: () => createVinylFactories,
|
|
195
190
|
createVinylPlayer: () => createVinylPlayer,
|
|
@@ -200,8 +195,6 @@ __export(index_exports, {
|
|
|
200
195
|
defaultDrmKeySystemResolver: () => defaultDrmKeySystemResolver,
|
|
201
196
|
defaultLicenseProvider: () => defaultLicenseProvider,
|
|
202
197
|
defaultLoudnessNormalizationControllerImplOptions: () => defaultLoudnessNormalizationControllerImplOptions,
|
|
203
|
-
defaultMediaElementPatchOptions: () => defaultMediaElementPatchOptions,
|
|
204
|
-
defaultPatchOptions: () => defaultPatchOptions,
|
|
205
198
|
defaultPlaybackControllerImplOptions: () => defaultPlaybackControllerImplOptions,
|
|
206
199
|
defaultQualitySelectorImplOptions: () => defaultQualitySelectorImplOptions,
|
|
207
200
|
defaultResetControllerOptions: () => defaultResetControllerOptions,
|
|
@@ -271,6 +264,7 @@ __export(index_exports, {
|
|
|
271
264
|
mediaFormatMetadataValidator: () => mediaFormatMetadataValidator,
|
|
272
265
|
mediaKeySupportRef: () => mediaKeySupportRef,
|
|
273
266
|
mediaQualityMetadataValidator: () => mediaQualityMetadataValidator,
|
|
267
|
+
mimeSubtype: () => mimeSubtype,
|
|
274
268
|
msErrorCodeToStr: () => msErrorCodeToStr,
|
|
275
269
|
nextHasMetadata: () => nextHasMetadata,
|
|
276
270
|
nextMediaSourceEnded: () => nextMediaSourceEnded,
|
|
@@ -281,7 +275,6 @@ __export(index_exports, {
|
|
|
281
275
|
parseCencEncryptionScheme: () => parseCencEncryptionScheme,
|
|
282
276
|
parsePlayReadyKeyMessage: () => parsePlayReadyKeyMessage,
|
|
283
277
|
parseWebVtt: () => parseWebVtt,
|
|
284
|
-
patchMediaElement: () => patchMediaElement,
|
|
285
278
|
pickFirstBaseUrlSelector: () => pickFirstBaseUrlSelector,
|
|
286
279
|
pickPreferredTextTrack: () => pickPreferredTextTrack,
|
|
287
280
|
playbackStateLoggingHandler: () => playbackStateLoggingHandler,
|
|
@@ -291,8 +284,6 @@ __export(index_exports, {
|
|
|
291
284
|
prefetchPriorityQueuesRef: () => prefetchPriorityQueuesRef,
|
|
292
285
|
qualitySelectorImplOptionsValidator: () => qualitySelectorImplOptionsValidator,
|
|
293
286
|
renderCueText: () => renderCueText,
|
|
294
|
-
requiresPreventStallsPatch: () => requiresPreventStallsPatch,
|
|
295
|
-
requiresUnreliablePlaybackEventsPatch: () => requiresUnreliablePlaybackEventsPatch,
|
|
296
287
|
resolveCodecOverride: () => resolveCodecOverride,
|
|
297
288
|
resolveDashUri: () => resolveDashUri,
|
|
298
289
|
resolvePreferredLanguages: () => resolvePreferredLanguages,
|
|
@@ -303,7 +294,6 @@ __export(index_exports, {
|
|
|
303
294
|
sortDashAdaptationSets: () => sortDashAdaptationSets,
|
|
304
295
|
sortDashRepresentations: () => sortDashRepresentations,
|
|
305
296
|
sourceTrackBaseOptionsValidator: () => sourceTrackBaseOptionsValidator,
|
|
306
|
-
supportsAudioSamplingRate: () => supportsAudioSamplingRate,
|
|
307
297
|
supportsMsEme: () => supportsMsEme,
|
|
308
298
|
supportsMse: () => supportsMse,
|
|
309
299
|
supportsStandardEme: () => supportsStandardEme,
|
|
@@ -324,7 +314,8 @@ __export(index_exports, {
|
|
|
324
314
|
vinylVersion: () => vinylVersion,
|
|
325
315
|
vttCueStyleValidator: () => vttCueStyleValidator,
|
|
326
316
|
waitedReasons: () => waitedReasons,
|
|
327
|
-
webkitErrorCodeToStr: () => webkitErrorCodeToStr
|
|
317
|
+
webkitErrorCodeToStr: () => webkitErrorCodeToStr,
|
|
318
|
+
withinAudioSampleRateRange: () => withinAudioSampleRateRange
|
|
328
319
|
});
|
|
329
320
|
module.exports = __toCommonJS(index_exports);
|
|
330
321
|
|
|
@@ -530,7 +521,7 @@ var AdControllerImpl = class extends import_vinyl_util2.EventHostImpl {
|
|
|
530
521
|
*/
|
|
531
522
|
providerInterrupted() {
|
|
532
523
|
const provider = this.adsProvider;
|
|
533
|
-
return () => provider !== this.adsProvider;
|
|
524
|
+
return () => this.disposed || provider !== this.adsProvider;
|
|
534
525
|
}
|
|
535
526
|
setAdsProvider(provider) {
|
|
536
527
|
var _a;
|
|
@@ -909,7 +900,9 @@ var AdControllerImpl = class extends import_vinyl_util2.EventHostImpl {
|
|
|
909
900
|
* Disposes this controller, removes all listeners.
|
|
910
901
|
*/
|
|
911
902
|
dispose() {
|
|
903
|
+
var _a;
|
|
912
904
|
super.dispose();
|
|
905
|
+
(_a = this.adsProviderSub) == null ? void 0 : _a.call(this);
|
|
913
906
|
this.disposer.dispose();
|
|
914
907
|
this.adBreakState = null;
|
|
915
908
|
}
|
|
@@ -1218,7 +1211,7 @@ async function resolveHlsAssetList({
|
|
|
1218
1211
|
var _a;
|
|
1219
1212
|
const url = (0, import_vinyl_util5.resolveUrl)(assetListUrl, baseUrl);
|
|
1220
1213
|
const response = await (0, import_vinyl_util5.requestWithRetry)(url);
|
|
1221
|
-
const json = await response
|
|
1214
|
+
const json = await (0, import_vinyl_util5.readResponseBody)(response, "json");
|
|
1222
1215
|
const assets = (_a = json.ASSETS) != null ? _a : [];
|
|
1223
1216
|
const ads = assets.map((asset, i) => {
|
|
1224
1217
|
var _a2;
|
|
@@ -2047,7 +2040,7 @@ var defaultLicenseProvider = async (keySystem, serverOptions, challenge, abort)
|
|
|
2047
2040
|
}),
|
|
2048
2041
|
{ abort }
|
|
2049
2042
|
);
|
|
2050
|
-
return await res
|
|
2043
|
+
return await (0, import_vinyl_util19.readResponseBody)(res, "arrayBuffer");
|
|
2051
2044
|
};
|
|
2052
2045
|
|
|
2053
2046
|
// src/drm/util/extractContentId.ts
|
|
@@ -2111,6 +2104,10 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2111
2104
|
__publicField(this, "bufferingTrackUri", null);
|
|
2112
2105
|
__publicField(this, "sessionAbort", null);
|
|
2113
2106
|
__publicField(this, "pendingMessageProps", null);
|
|
2107
|
+
// Armed per track load; latches on the first session so only the
|
|
2108
|
+
// critical-path session's EME/CDM setup is measured.
|
|
2109
|
+
__publicField(this, "keySetupSpanArmed", true);
|
|
2110
|
+
__publicField(this, "keySetupSpanStart", null);
|
|
2114
2111
|
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util24.createDisposer)());
|
|
2115
2112
|
__publicField(this, "checkIsSupportedCached", /* @__PURE__ */ (0, import_vinyl_util24.memoize)(
|
|
2116
2113
|
async (params) => {
|
|
@@ -2145,6 +2142,11 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2145
2142
|
));
|
|
2146
2143
|
__publicField(this, "handleEncryptedEvent", (event) => {
|
|
2147
2144
|
if (this.disposed) return;
|
|
2145
|
+
if (this.manifestProvidesInitData()) {
|
|
2146
|
+
(0, import_vinyl_util24.logDebug)(this, "ignoring encrypted event; manifest provides pssh");
|
|
2147
|
+
return;
|
|
2148
|
+
}
|
|
2149
|
+
;
|
|
2148
2150
|
(async () => {
|
|
2149
2151
|
var _a;
|
|
2150
2152
|
const { initData, initDataType } = event;
|
|
@@ -2266,11 +2268,12 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2266
2268
|
* The new session will be added to the current sessions list.
|
|
2267
2269
|
*/
|
|
2268
2270
|
async maybeCreateSession(options) {
|
|
2269
|
-
var _a;
|
|
2271
|
+
var _a, _b;
|
|
2270
2272
|
const { drmInfo, initDataType, initData, trackUri, abort } = options;
|
|
2271
2273
|
if (!hasMimeType(drmInfo)) {
|
|
2272
2274
|
throw new DrmError("Encrypted content must have a mimeType.");
|
|
2273
2275
|
}
|
|
2276
|
+
this.markKeySetupStart();
|
|
2274
2277
|
const mediaKeys = await this.attachMediaKeys(drmInfo);
|
|
2275
2278
|
this.abortIfDisposed();
|
|
2276
2279
|
const keySystemOptions = (_a = this.options.keySystems[mediaKeys.keySystem]) != null ? _a : this.options.keySystems["*"];
|
|
@@ -2279,33 +2282,63 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2279
2282
|
licenseServerOptionsProvider != null ? licenseServerOptionsProvider : {}
|
|
2280
2283
|
);
|
|
2281
2284
|
this.abortIfDisposed();
|
|
2282
|
-
const
|
|
2285
|
+
const certBytes = toCertBytes(licenseServerOptions.serverCertificate);
|
|
2286
|
+
if (certBytes) {
|
|
2287
|
+
await mediaKeys.setServerCertificate(certBytes);
|
|
2288
|
+
this.abortIfDisposed();
|
|
2289
|
+
}
|
|
2290
|
+
const transform = (_b = keySystemOptions == null ? void 0 : keySystemOptions.initDataTransformer) != null ? _b : defaultInitDataTransformer(mediaKeys.keySystem, certBytes);
|
|
2291
|
+
const transformedInitData = transform(
|
|
2292
|
+
(0, import_vinyl_util24.bufferToByteArray)(initData),
|
|
2293
|
+
initDataType,
|
|
2294
|
+
drmInfo
|
|
2295
|
+
);
|
|
2296
|
+
const existingSession = this.getSessionByInitData(transformedInitData);
|
|
2283
2297
|
if (existingSession) {
|
|
2284
2298
|
(0, import_vinyl_util24.logDebug)(this, "reusing session");
|
|
2285
2299
|
return existingSession;
|
|
2286
|
-
} else {
|
|
2287
|
-
const newSession = await this.createNewSession({
|
|
2288
|
-
serverCertificate: licenseServerOptions.serverCertificate,
|
|
2289
|
-
mediaKeys,
|
|
2290
|
-
initData,
|
|
2291
|
-
initDataType,
|
|
2292
|
-
drmInfo,
|
|
2293
|
-
trackUri,
|
|
2294
|
-
initDataTransformer: keySystemOptions == null ? void 0 : keySystemOptions.initDataTransformer
|
|
2295
|
-
});
|
|
2296
|
-
this.sessions.push(newSession);
|
|
2297
|
-
this.dispatch("sessionCreate", {
|
|
2298
|
-
initDataType: newSession.initDataType,
|
|
2299
|
-
mimeType: newSession.mimeType
|
|
2300
|
-
});
|
|
2301
|
-
newSession.on("closed", () => this.closeSession(newSession));
|
|
2302
|
-
abort == null ? void 0 : abort.onAborted(() => {
|
|
2303
|
-
if (this.disposed) return;
|
|
2304
|
-
(0, import_vinyl_util24.logDebug)(this, "abort session");
|
|
2305
|
-
this.closeSession(newSession);
|
|
2306
|
-
});
|
|
2307
|
-
return newSession;
|
|
2308
2300
|
}
|
|
2301
|
+
const newSession = this.createNewSession({
|
|
2302
|
+
mediaKeys,
|
|
2303
|
+
initData: transformedInitData,
|
|
2304
|
+
initDataType,
|
|
2305
|
+
drmInfo,
|
|
2306
|
+
trackUri
|
|
2307
|
+
});
|
|
2308
|
+
this.sessions.push(newSession);
|
|
2309
|
+
this.dispatch("sessionCreate", {
|
|
2310
|
+
initDataType: newSession.initDataType,
|
|
2311
|
+
mimeType: newSession.mimeType
|
|
2312
|
+
});
|
|
2313
|
+
newSession.on("closed", () => this.closeSession(newSession));
|
|
2314
|
+
abort == null ? void 0 : abort.onAborted(() => {
|
|
2315
|
+
if (this.disposed) return;
|
|
2316
|
+
(0, import_vinyl_util24.logDebug)(this, "abort session");
|
|
2317
|
+
this.closeSession(newSession);
|
|
2318
|
+
});
|
|
2319
|
+
return newSession;
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Captures the key-setup span start at the top of the session-creation path
|
|
2323
|
+
* (before media keys are attached), latching so only the first session of
|
|
2324
|
+
* the current track load is measured.
|
|
2325
|
+
*/
|
|
2326
|
+
markKeySetupStart() {
|
|
2327
|
+
if (!this.keySetupSpanArmed) return;
|
|
2328
|
+
this.keySetupSpanArmed = false;
|
|
2329
|
+
this.keySetupSpanStart = Date.now();
|
|
2330
|
+
}
|
|
2331
|
+
dispatchLoadSpan(kind, startTime, endTime, messageProps) {
|
|
2332
|
+
this.dispatch("loadSpanMeasured", __spreadValues(__spreadValues({
|
|
2333
|
+
kind,
|
|
2334
|
+
startTime,
|
|
2335
|
+
endTime,
|
|
2336
|
+
mimeType: messageProps.mimeType
|
|
2337
|
+
}, messageProps.trackUri != null && {
|
|
2338
|
+
trackUri: messageProps.trackUri
|
|
2339
|
+
}), messageProps.contentType != null && {
|
|
2340
|
+
contentType: messageProps.contentType
|
|
2341
|
+
}));
|
|
2309
2342
|
}
|
|
2310
2343
|
initializeForPlayback(drmInfo, options) {
|
|
2311
2344
|
var _a;
|
|
@@ -2318,6 +2351,11 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2318
2351
|
).catch(this.handleError);
|
|
2319
2352
|
}
|
|
2320
2353
|
}
|
|
2354
|
+
/** True when the manifest carried pssh (sessions come from it, not events). */
|
|
2355
|
+
manifestProvidesInitData() {
|
|
2356
|
+
var _a, _b;
|
|
2357
|
+
return (_b = (_a = this.drmInfo) == null ? void 0 : _a.contentProtections.some((cP) => cP.pssh != null)) != null ? _b : false;
|
|
2358
|
+
}
|
|
2321
2359
|
setBufferingDrmInfo(drmInfo, options) {
|
|
2322
2360
|
var _a, _b;
|
|
2323
2361
|
(0, import_vinyl_util24.logDebug)(this, "setBufferingDrmInfo", drmInfo);
|
|
@@ -2325,6 +2363,8 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2325
2363
|
this.drmInfo = drmInfo;
|
|
2326
2364
|
this.bufferingTrackUri = (_a = options == null ? void 0 : options.trackUri) != null ? _a : null;
|
|
2327
2365
|
this.sessionAbort = (_b = options == null ? void 0 : options.abort) != null ? _b : null;
|
|
2366
|
+
this.keySetupSpanArmed = true;
|
|
2367
|
+
this.keySetupSpanStart = null;
|
|
2328
2368
|
}
|
|
2329
2369
|
/**
|
|
2330
2370
|
* If the drm metadata contains initialization data for the current key system, create a new session.
|
|
@@ -2336,6 +2376,7 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2336
2376
|
this.handleError(new DrmError("DRM not supported."));
|
|
2337
2377
|
return;
|
|
2338
2378
|
}
|
|
2379
|
+
this.markKeySetupStart();
|
|
2339
2380
|
const mediaKeys = await this.attachMediaKeys(drmInfo);
|
|
2340
2381
|
const drmProtection = (_a = drmInfo.contentProtections.find((cP) => {
|
|
2341
2382
|
return cP.keySystem === mediaKeys.keySystem;
|
|
@@ -2457,24 +2498,10 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2457
2498
|
/**
|
|
2458
2499
|
* Creates a new key session and adds a message handler.
|
|
2459
2500
|
*/
|
|
2460
|
-
|
|
2461
|
-
const {
|
|
2462
|
-
serverCertificate,
|
|
2463
|
-
mediaKeys,
|
|
2464
|
-
initDataType,
|
|
2465
|
-
drmInfo,
|
|
2466
|
-
trackUri,
|
|
2467
|
-
initDataTransformer
|
|
2468
|
-
} = options;
|
|
2469
|
-
let initData = options.initData;
|
|
2470
|
-
const certBytes = serverCertificate ? typeof serverCertificate === "string" ? (0, import_vinyl_util24.base64ToByteArray)(serverCertificate) : (0, import_vinyl_util24.bufferToByteArray)(serverCertificate) : null;
|
|
2471
|
-
if (certBytes) {
|
|
2472
|
-
await mediaKeys.setServerCertificate(certBytes);
|
|
2473
|
-
}
|
|
2474
|
-
const transform = initDataTransformer != null ? initDataTransformer : defaultInitDataTransformer(mediaKeys.keySystem, certBytes);
|
|
2475
|
-
initData = transform((0, import_vinyl_util24.bufferToByteArray)(initData), initDataType, drmInfo);
|
|
2501
|
+
createNewSession(options) {
|
|
2502
|
+
const { mediaKeys, initData, initDataType, drmInfo, trackUri } = options;
|
|
2476
2503
|
this.abortIfDisposed();
|
|
2477
|
-
(0, import_vinyl_util24.logDebug)(this, "createSession", drmInfo.mimeType, initDataType);
|
|
2504
|
+
(0, import_vinyl_util24.logDebug)(this, "createSession", drmInfo.mimeType, initDataType, drmInfo);
|
|
2478
2505
|
const session = mediaKeys.createSession(
|
|
2479
2506
|
drmInfo.mimeType,
|
|
2480
2507
|
initDataType,
|
|
@@ -2488,7 +2515,9 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2488
2515
|
event,
|
|
2489
2516
|
// Captured per session, so a concurrent preloaded track's
|
|
2490
2517
|
// license exchange keeps its own attribution.
|
|
2491
|
-
trackUri
|
|
2518
|
+
trackUri,
|
|
2519
|
+
mimeType: drmInfo.mimeType,
|
|
2520
|
+
contentType: drmInfo.contentType
|
|
2492
2521
|
}),
|
|
2493
2522
|
LICENSE_TIMEOUT,
|
|
2494
2523
|
{ message: LICENSE_TIMEOUT_MESSAGE }
|
|
@@ -2504,15 +2533,24 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2504
2533
|
* Invoked when the content decryption module needs to interact with the license server.
|
|
2505
2534
|
*/
|
|
2506
2535
|
async messageHandler(messageProps) {
|
|
2507
|
-
var _a, _b;
|
|
2536
|
+
var _a, _b, _c;
|
|
2508
2537
|
const { mediaKeys, session, event } = messageProps;
|
|
2509
2538
|
messageEventValidator.assert(event);
|
|
2510
2539
|
this.pendingMessageProps = messageProps;
|
|
2511
2540
|
const keySystem = mediaKeys.keySystem;
|
|
2512
2541
|
(0, import_vinyl_util24.logDebug)(this, "message", keySystem, event.message.byteLength);
|
|
2513
|
-
|
|
2542
|
+
if (this.keySetupSpanStart != null) {
|
|
2543
|
+
this.dispatchLoadSpan(
|
|
2544
|
+
"keySetup",
|
|
2545
|
+
this.keySetupSpanStart,
|
|
2546
|
+
Date.now(),
|
|
2547
|
+
messageProps
|
|
2548
|
+
);
|
|
2549
|
+
this.keySetupSpanStart = null;
|
|
2550
|
+
}
|
|
2551
|
+
const keySystemOptions = (_a = this.options.keySystems[keySystem]) != null ? _a : this.options.keySystems["*"];
|
|
2514
2552
|
const licenseServerOptionsProvider = keySystemOptions == null ? void 0 : keySystemOptions.licenseServer;
|
|
2515
|
-
const licenseServerOptions = (
|
|
2553
|
+
const licenseServerOptions = (_b = (0, import_vinyl_util24.clone)(await (0, import_vinyl_util24.resolveValueProvider)(licenseServerOptionsProvider))) != null ? _b : {};
|
|
2516
2554
|
this.abortIfDisposed();
|
|
2517
2555
|
let challenge = event.message;
|
|
2518
2556
|
if (isPlayReady(keySystem)) {
|
|
@@ -2521,7 +2559,7 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2521
2559
|
if (licenseServerOptions.init == null)
|
|
2522
2560
|
licenseServerOptions.init = {};
|
|
2523
2561
|
licenseServerOptions.init.headers = __spreadValues(__spreadValues({}, (0, import_vinyl_util24.normalizeHeadersInit)(
|
|
2524
|
-
(
|
|
2562
|
+
(_c = licenseServerOptions.init.headers) != null ? _c : {}
|
|
2525
2563
|
)), unpacked.headers);
|
|
2526
2564
|
}
|
|
2527
2565
|
const licenseSpanStart = Date.now();
|
|
@@ -2530,13 +2568,13 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2530
2568
|
licenseServerOptions,
|
|
2531
2569
|
challenge
|
|
2532
2570
|
);
|
|
2533
|
-
this.
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2571
|
+
if (this.disposed) return;
|
|
2572
|
+
this.dispatchLoadSpan(
|
|
2573
|
+
"license",
|
|
2574
|
+
licenseSpanStart,
|
|
2575
|
+
Date.now(),
|
|
2576
|
+
messageProps
|
|
2577
|
+
);
|
|
2540
2578
|
this.pendingMessageProps = null;
|
|
2541
2579
|
if (session.disposed) return;
|
|
2542
2580
|
(0, import_vinyl_util24.logDebug)(this, "update");
|
|
@@ -2619,9 +2657,9 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2619
2657
|
}
|
|
2620
2658
|
getSessionByInitData(initData) {
|
|
2621
2659
|
var _a;
|
|
2622
|
-
return (_a = this.sessions.find(
|
|
2623
|
-
|
|
2624
|
-
|
|
2660
|
+
return (_a = this.sessions.find(
|
|
2661
|
+
(session) => (0, import_vinyl_util24.buffersEqual)(session.initData, initData)
|
|
2662
|
+
)) != null ? _a : null;
|
|
2625
2663
|
}
|
|
2626
2664
|
};
|
|
2627
2665
|
var messageEventValidator = /* @__PURE__ */ (0, import_vinyl_validation4.object)({
|
|
@@ -2630,6 +2668,10 @@ var messageEventValidator = /* @__PURE__ */ (0, import_vinyl_validation4.object)
|
|
|
2630
2668
|
function hasMimeType(drmInfo) {
|
|
2631
2669
|
return drmInfo.mimeType != null;
|
|
2632
2670
|
}
|
|
2671
|
+
function toCertBytes(serverCertificate) {
|
|
2672
|
+
if (!serverCertificate) return null;
|
|
2673
|
+
return typeof serverCertificate === "string" ? (0, import_vinyl_util24.base64ToByteArray)(serverCertificate) : (0, import_vinyl_util24.bufferToByteArray)(serverCertificate);
|
|
2674
|
+
}
|
|
2633
2675
|
function defaultInitDataTransformer(keySystem, certBytes) {
|
|
2634
2676
|
return (initData) => {
|
|
2635
2677
|
if (keySystem === "com.apple.fps.1_0" /* FAIR_PLAY_1_0 */) {
|
|
@@ -2775,7 +2817,7 @@ function configureVinylGlobal(options) {
|
|
|
2775
2817
|
var import_vinyl_util27 = require("@amazon/vinyl-util");
|
|
2776
2818
|
var vinylVersion = /* @__PURE__ */ (0, import_vinyl_util27.parseVersion)(
|
|
2777
2819
|
/* istanbul ignore next */
|
|
2778
|
-
"3.0
|
|
2820
|
+
"3.2.0"
|
|
2779
2821
|
);
|
|
2780
2822
|
|
|
2781
2823
|
// src/global/globalRef.ts
|
|
@@ -2824,232 +2866,231 @@ function initializeVinylGlobal() {
|
|
|
2824
2866
|
vinylGlobalRef.initialize();
|
|
2825
2867
|
}
|
|
2826
2868
|
|
|
2827
|
-
// src/
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
var MIN_SEEKING_DELTA = 0.5;
|
|
2838
|
-
function createUnreliablePlaybackEventsPatch(media) {
|
|
2839
|
-
const { add, dispose } = (0, import_vinyl_util31.createDisposer)();
|
|
2840
|
-
const domEvents = add(new import_vinyl_util31.DomEventHost(media));
|
|
2841
|
-
const eventFabricated = add(new import_vinyl_util31.SignalImpl());
|
|
2842
|
-
let stateChangedAt = Date.now();
|
|
2843
|
-
let currentApparentState = 1 /* STOPPED */;
|
|
2844
|
-
function setApparentState(state, changedAt = Date.now()) {
|
|
2845
|
-
if (currentApparentState !== state) {
|
|
2846
|
-
currentApparentState = state;
|
|
2847
|
-
stateChangedAt = changedAt;
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
function elapsedStateTime() {
|
|
2851
|
-
return (Date.now() - stateChangedAt) / 1e3;
|
|
2852
|
-
}
|
|
2853
|
-
let lastTimestamp = Date.now();
|
|
2869
|
+
// src/playback/createStallDetector.ts
|
|
2870
|
+
function createStallDetector(media, options) {
|
|
2871
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2872
|
+
const { fabricatePlaying } = options;
|
|
2873
|
+
const pollInterval = (_a = options.pollInterval) != null ? _a : 0.25;
|
|
2874
|
+
const stallThreshold = (_b = options.stallThreshold) != null ? _b : 0.75;
|
|
2875
|
+
const bufferEndMargin = (_c = options.bufferEndMargin) != null ? _c : 0.5;
|
|
2876
|
+
const stallSkip = (_d = options.stallSkip) != null ? _d : 0.1;
|
|
2877
|
+
const maxAttempts = (_e = options.maxAttempts) != null ? _e : 3;
|
|
2878
|
+
const nudgeUnbuffered = (_f = options.nudgeUnbuffered) != null ? _f : false;
|
|
2854
2879
|
let lastTime = media.currentTime;
|
|
2855
|
-
let
|
|
2856
|
-
let
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
waiting = false;
|
|
2862
|
-
}
|
|
2863
|
-
);
|
|
2864
|
-
let playing = false;
|
|
2865
|
-
(0, import_vinyl_util31.onAny)(
|
|
2866
|
-
domEvents,
|
|
2867
|
-
["emptied", "ended", "pause", "seeking", "waiting"],
|
|
2868
|
-
() => {
|
|
2869
|
-
playing = false;
|
|
2870
|
-
}
|
|
2871
|
-
);
|
|
2872
|
-
domEvents.on("seeking", () => {
|
|
2873
|
-
seeking = true;
|
|
2874
|
-
});
|
|
2875
|
-
domEvents.on("seeked", () => {
|
|
2876
|
-
seeking = false;
|
|
2877
|
-
setApparentState(2 /* SEEKING */);
|
|
2878
|
-
});
|
|
2879
|
-
domEvents.on("play", () => {
|
|
2880
|
-
stateChangedAt = Date.now();
|
|
2881
|
-
});
|
|
2882
|
-
const readyStateEvents = [
|
|
2883
|
-
"emptied",
|
|
2884
|
-
"loadeddata",
|
|
2885
|
-
"loadedmetadata",
|
|
2886
|
-
"waiting"
|
|
2887
|
-
];
|
|
2888
|
-
let lastReadyStateEvent = "emptied";
|
|
2889
|
-
add(
|
|
2890
|
-
(0, import_vinyl_util31.onAny)(domEvents, readyStateEvents, (_, type) => {
|
|
2891
|
-
lastReadyStateEvent = type;
|
|
2892
|
-
})
|
|
2893
|
-
);
|
|
2894
|
-
const checkApparentState = () => {
|
|
2895
|
-
const progressed = (media.currentTime - lastTime) / media.playbackRate;
|
|
2896
|
-
const now = Date.now();
|
|
2897
|
-
if (Math.abs(progressed) > MIN_SEEKING_DELTA) {
|
|
2898
|
-
setApparentState(2 /* SEEKING */, lastTimestamp);
|
|
2899
|
-
} else if (progressed >= MIN_PLAYING_DELTA) {
|
|
2900
|
-
setApparentState(0 /* PLAYING */, lastTimestamp);
|
|
2901
|
-
} else if ((0, import_vinyl_util31.closeTo)(progressed, 0, MIN_PLAYING_DELTA)) {
|
|
2902
|
-
setApparentState(1 /* STOPPED */, lastTimestamp);
|
|
2903
|
-
}
|
|
2904
|
-
lastTime = media.currentTime;
|
|
2905
|
-
lastTimestamp = now;
|
|
2906
|
-
if (!playing && !seeking && !media.paused && !media.ended && media.readyState >= media.HAVE_FUTURE_DATA && currentApparentState === 0 /* PLAYING */ && elapsedStateTime() >= MIN_PLAYING_BEFORE_FAB) {
|
|
2907
|
-
waiting = false;
|
|
2908
|
-
playing = true;
|
|
2909
|
-
if (lastReadyStateEvent !== "canplay" && lastReadyStateEvent !== "canplaythrough") {
|
|
2910
|
-
lastReadyStateEvent = "canplay";
|
|
2911
|
-
eventFabricated.dispatch(new CustomEvent("canplay"));
|
|
2912
|
-
}
|
|
2913
|
-
if (media.readyState >= media.HAVE_ENOUGH_DATA) {
|
|
2914
|
-
if (lastReadyStateEvent !== "canplaythrough") {
|
|
2915
|
-
lastReadyStateEvent = "canplaythrough";
|
|
2916
|
-
eventFabricated.dispatch(new CustomEvent("canplaythrough"));
|
|
2917
|
-
}
|
|
2918
|
-
}
|
|
2919
|
-
eventFabricated.dispatch(new CustomEvent("playing"));
|
|
2920
|
-
}
|
|
2921
|
-
if (!waiting && !media.paused && !media.ended && currentApparentState === 1 /* STOPPED */ && elapsedStateTime() >= MIN_STALLED_BEFORE_FAB) {
|
|
2922
|
-
waiting = true;
|
|
2923
|
-
playing = false;
|
|
2924
|
-
eventFabricated.dispatch(new CustomEvent("waiting"));
|
|
2925
|
-
}
|
|
2880
|
+
let stalledFor = 0;
|
|
2881
|
+
let attempts = 0;
|
|
2882
|
+
let sawPlaying = false;
|
|
2883
|
+
let recovered = false;
|
|
2884
|
+
const onPlaying = () => {
|
|
2885
|
+
sawPlaying = true;
|
|
2926
2886
|
};
|
|
2927
|
-
const
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
)
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
return {
|
|
2935
|
-
eventFabricated,
|
|
2936
|
-
properties: {
|
|
2937
|
-
/**
|
|
2938
|
-
* Platforms that have unreliable waiting events, also have unreliable ready state
|
|
2939
|
-
* when the end of buffered data has been reached. If the media is in a waiting state,
|
|
2940
|
-
* the highest ready state that is possible is HAVE_METADATA.
|
|
2941
|
-
*/
|
|
2942
|
-
readyState: {
|
|
2943
|
-
get() {
|
|
2944
|
-
return waiting ? Math.min(media.readyState, media.HAVE_METADATA) : media.readyState;
|
|
2945
|
-
}
|
|
2946
|
-
}
|
|
2947
|
-
},
|
|
2948
|
-
events: {
|
|
2949
|
-
canplay(event) {
|
|
2950
|
-
const eventOrNull = lastReadyStateEvent === "canplay" ? null : event;
|
|
2951
|
-
lastReadyStateEvent = "canplay";
|
|
2952
|
-
return eventOrNull;
|
|
2953
|
-
},
|
|
2954
|
-
canplaythrough(event) {
|
|
2955
|
-
const eventOrNull = lastReadyStateEvent === "canplaythrough" ? null : event;
|
|
2956
|
-
lastReadyStateEvent = "canplaythrough";
|
|
2957
|
-
return eventOrNull;
|
|
2958
|
-
},
|
|
2959
|
-
playing(event) {
|
|
2960
|
-
if (playing) {
|
|
2961
|
-
return null;
|
|
2962
|
-
}
|
|
2963
|
-
setApparentState(0 /* PLAYING */);
|
|
2964
|
-
playing = true;
|
|
2965
|
-
return event;
|
|
2966
|
-
},
|
|
2967
|
-
waiting(event) {
|
|
2968
|
-
if (waiting) {
|
|
2969
|
-
return null;
|
|
2970
|
-
}
|
|
2971
|
-
waiting = true;
|
|
2972
|
-
setApparentState(1 /* STOPPED */);
|
|
2973
|
-
return event;
|
|
2974
|
-
}
|
|
2975
|
-
},
|
|
2976
|
-
dispose
|
|
2887
|
+
const onEmptied = () => stop();
|
|
2888
|
+
media.addEventListener("playing", onPlaying);
|
|
2889
|
+
media.addEventListener("emptied", onEmptied);
|
|
2890
|
+
const stop = () => {
|
|
2891
|
+
clearInterval(id);
|
|
2892
|
+
media.removeEventListener("playing", onPlaying);
|
|
2893
|
+
media.removeEventListener("emptied", onEmptied);
|
|
2977
2894
|
};
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2895
|
+
const id = setInterval(() => {
|
|
2896
|
+
if (media.paused || media.ended) return stop();
|
|
2897
|
+
if (media.currentTime !== lastTime) {
|
|
2898
|
+
lastTime = media.currentTime;
|
|
2899
|
+
if (!sawPlaying || recovered) fabricatePlaying();
|
|
2900
|
+
return stop();
|
|
2901
|
+
}
|
|
2902
|
+
if (!nudgeUnbuffered && !withinBufferedData(media, bufferEndMargin)) {
|
|
2903
|
+
stalledFor = 0;
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
stalledFor += pollInterval;
|
|
2907
|
+
if (stalledFor < stallThreshold) return;
|
|
2908
|
+
stalledFor = 0;
|
|
2909
|
+
if (attempts++ >= maxAttempts) return stop();
|
|
2910
|
+
recovered = true;
|
|
2911
|
+
media.currentTime += stallSkip;
|
|
2912
|
+
lastTime = media.currentTime;
|
|
2913
|
+
}, pollInterval * 1e3);
|
|
2914
|
+
return stop;
|
|
2915
|
+
}
|
|
2916
|
+
function withinBufferedData(media, endMargin) {
|
|
2917
|
+
const t = media.currentTime;
|
|
2918
|
+
const duration = media.duration;
|
|
2919
|
+
const buffered = media.buffered;
|
|
2920
|
+
for (let i = 0; i < buffered.length; i++) {
|
|
2921
|
+
const end = buffered.end(i);
|
|
2922
|
+
const isEndOfMedia = Number.isFinite(duration) && duration > 0 && end >= duration - endMargin;
|
|
2923
|
+
if (t >= buffered.start(i) && (t < end - endMargin || isEndOfMedia))
|
|
2924
|
+
return true;
|
|
2925
|
+
}
|
|
2926
|
+
return false;
|
|
2981
2927
|
}
|
|
2982
2928
|
|
|
2983
|
-
// src/
|
|
2984
|
-
var
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2929
|
+
// src/playback/createStallMonitor.ts
|
|
2930
|
+
var import_vinyl_util30 = require("@amazon/vinyl-util");
|
|
2931
|
+
|
|
2932
|
+
// src/playback/ReadonlyPlaybackController.ts
|
|
2933
|
+
var PlayedReason = /* @__PURE__ */ ((PlayedReason2) => {
|
|
2934
|
+
PlayedReason2["EMPTIED"] = "emptied";
|
|
2935
|
+
PlayedReason2["ENDED"] = "ended";
|
|
2936
|
+
PlayedReason2["PAUSE"] = "pause";
|
|
2937
|
+
PlayedReason2["SEEKING"] = "seeking";
|
|
2938
|
+
PlayedReason2["WAITING"] = "waiting";
|
|
2939
|
+
return PlayedReason2;
|
|
2940
|
+
})(PlayedReason || {});
|
|
2941
|
+
var playedReasons = [
|
|
2942
|
+
"emptied" /* EMPTIED */,
|
|
2943
|
+
"ended" /* ENDED */,
|
|
2944
|
+
"pause" /* PAUSE */,
|
|
2945
|
+
"seeking" /* SEEKING */,
|
|
2946
|
+
"waiting" /* WAITING */
|
|
2947
|
+
];
|
|
2948
|
+
var WaitedReason = /* @__PURE__ */ ((WaitedReason2) => {
|
|
2949
|
+
WaitedReason2["PLAYING"] = "playing";
|
|
2950
|
+
WaitedReason2["PAUSE"] = "pause";
|
|
2951
|
+
WaitedReason2["EMPTIED"] = "emptied";
|
|
2952
|
+
WaitedReason2["SEEKING"] = "seeking";
|
|
2953
|
+
return WaitedReason2;
|
|
2954
|
+
})(WaitedReason || {});
|
|
2955
|
+
var waitedReasons = [
|
|
2956
|
+
"playing" /* PLAYING */,
|
|
2957
|
+
"pause" /* PAUSE */,
|
|
2958
|
+
"emptied" /* EMPTIED */,
|
|
2959
|
+
"seeking" /* SEEKING */
|
|
2960
|
+
];
|
|
2961
|
+
var StallEndedReason = /* @__PURE__ */ ((StallEndedReason2) => {
|
|
2962
|
+
StallEndedReason2["PLAYING"] = "playing";
|
|
2963
|
+
StallEndedReason2["PAUSE"] = "pause";
|
|
2964
|
+
StallEndedReason2["SEEKING"] = "seeking";
|
|
2965
|
+
StallEndedReason2["EMPTIED"] = "emptied";
|
|
2966
|
+
return StallEndedReason2;
|
|
2967
|
+
})(StallEndedReason || {});
|
|
2968
|
+
var ALL_PLAYBACK_STATE_EVENTS = [
|
|
2969
|
+
"abort",
|
|
2970
|
+
"canPlay",
|
|
2971
|
+
"canPlayThrough",
|
|
2972
|
+
"durationChange",
|
|
2973
|
+
"emptied",
|
|
2974
|
+
"ended",
|
|
2975
|
+
"error",
|
|
2976
|
+
"playIsPendingChange",
|
|
2977
|
+
"loadedData",
|
|
2978
|
+
"loadedMetadata",
|
|
2979
|
+
"loadStart",
|
|
2980
|
+
"looped",
|
|
2981
|
+
"mutedChange",
|
|
2982
|
+
"pause",
|
|
2983
|
+
"play",
|
|
2984
|
+
"playRejected",
|
|
2985
|
+
"played",
|
|
2986
|
+
"playing",
|
|
2987
|
+
"progress",
|
|
2988
|
+
"rateChange",
|
|
2989
|
+
"readyStateChange",
|
|
2990
|
+
"reset",
|
|
2991
|
+
"resize",
|
|
2992
|
+
"seeked",
|
|
2993
|
+
"seeking",
|
|
2994
|
+
"stallEntered",
|
|
2995
|
+
"stallEnded",
|
|
2996
|
+
"timeUpdate",
|
|
2997
|
+
"volumeChange",
|
|
2998
|
+
"waited",
|
|
2999
|
+
"waiting",
|
|
3000
|
+
"waitingForKey"
|
|
3001
|
+
];
|
|
3002
|
+
var PlaybackReadyState = /* @__PURE__ */ ((PlaybackReadyState2) => {
|
|
3003
|
+
PlaybackReadyState2[PlaybackReadyState2["HAVE_NOTHING"] = 0] = "HAVE_NOTHING";
|
|
3004
|
+
PlaybackReadyState2[PlaybackReadyState2["HAVE_METADATA"] = 1] = "HAVE_METADATA";
|
|
3005
|
+
PlaybackReadyState2[PlaybackReadyState2["HAVE_CURRENT_DATA"] = 2] = "HAVE_CURRENT_DATA";
|
|
3006
|
+
PlaybackReadyState2[PlaybackReadyState2["HAVE_FUTURE_DATA"] = 3] = "HAVE_FUTURE_DATA";
|
|
3007
|
+
PlaybackReadyState2[PlaybackReadyState2["HAVE_ENOUGH_DATA"] = 4] = "HAVE_ENOUGH_DATA";
|
|
3008
|
+
return PlaybackReadyState2;
|
|
3009
|
+
})(PlaybackReadyState || {});
|
|
3010
|
+
var PlaybackNetworkState = /* @__PURE__ */ ((PlaybackNetworkState2) => {
|
|
3011
|
+
PlaybackNetworkState2[PlaybackNetworkState2["NETWORK_EMPTY"] = 0] = "NETWORK_EMPTY";
|
|
3012
|
+
PlaybackNetworkState2[PlaybackNetworkState2["NETWORK_IDLE"] = 1] = "NETWORK_IDLE";
|
|
3013
|
+
PlaybackNetworkState2[PlaybackNetworkState2["NETWORK_LOADING"] = 2] = "NETWORK_LOADING";
|
|
3014
|
+
PlaybackNetworkState2[PlaybackNetworkState2["NETWORK_NO_SOURCE"] = 3] = "NETWORK_NO_SOURCE";
|
|
3015
|
+
return PlaybackNetworkState2;
|
|
3016
|
+
})(PlaybackNetworkState || {});
|
|
3017
|
+
|
|
3018
|
+
// src/playback/createStallMonitor.ts
|
|
3019
|
+
function createStallMonitor(controller, callbacks, options = {}) {
|
|
3020
|
+
var _a, _b;
|
|
3021
|
+
const stallThresholdMs = ((_a = options.stallThreshold) != null ? _a : 1) * 1e3;
|
|
3022
|
+
const pollIntervalMs = ((_b = options.pollInterval) != null ? _b : 0.25) * 1e3;
|
|
3023
|
+
let observedPlaying = false;
|
|
3024
|
+
let lastProgressAt = Date.now();
|
|
3025
|
+
let inStall = false;
|
|
3026
|
+
let pollId = null;
|
|
3027
|
+
const endStall = (reason) => {
|
|
3028
|
+
if (!inStall) return;
|
|
3029
|
+
inStall = false;
|
|
3030
|
+
const ended = Date.now();
|
|
3031
|
+
callbacks.onStallEnded({
|
|
3032
|
+
started: lastProgressAt,
|
|
3033
|
+
ended,
|
|
3034
|
+
duration: (ended - lastProgressAt) / 1e3,
|
|
3035
|
+
reason
|
|
3036
|
+
});
|
|
2991
3037
|
};
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
unchangedCount = 0;
|
|
3005
|
-
media.pause();
|
|
3006
|
-
media.play().catch(import_vinyl_util32.noop);
|
|
3007
|
-
}
|
|
3008
|
-
} else {
|
|
3009
|
-
if (attemptedFix) {
|
|
3010
|
-
(0, import_vinyl_util32.logInfo)(pathTarget, "stall ended");
|
|
3011
|
-
attemptedFix = false;
|
|
3038
|
+
const stopPoll = () => {
|
|
3039
|
+
if (pollId == null) return;
|
|
3040
|
+
clearInterval(pollId);
|
|
3041
|
+
pollId = null;
|
|
3042
|
+
};
|
|
3043
|
+
const startPoll = () => {
|
|
3044
|
+
if (pollId != null) return;
|
|
3045
|
+
pollId = setInterval(() => {
|
|
3046
|
+
if (inStall || !observedPlaying) return;
|
|
3047
|
+
if (Date.now() - lastProgressAt >= stallThresholdMs) {
|
|
3048
|
+
inStall = true;
|
|
3049
|
+
callbacks.onStallEntered();
|
|
3012
3050
|
}
|
|
3013
|
-
|
|
3014
|
-
previousTime = media.currentTime;
|
|
3015
|
-
}
|
|
3016
|
-
});
|
|
3017
|
-
return {
|
|
3018
|
-
dispose
|
|
3051
|
+
}, pollIntervalMs);
|
|
3019
3052
|
};
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
// src/patch/media/MediaElementPatchOptions.ts
|
|
3026
|
-
var defaultMediaElementPatchOptions = /* @__PURE__ */ (0, import_vinyl_util33.lazy)(() => {
|
|
3027
|
-
return {
|
|
3028
|
-
unreliablePlaybackEvents: requiresUnreliablePlaybackEventsPatch(),
|
|
3029
|
-
preventStalls: requiresPreventStallsPatch()
|
|
3053
|
+
const suspend = (reason) => {
|
|
3054
|
+
endStall(reason);
|
|
3055
|
+
observedPlaying = false;
|
|
3056
|
+
stopPoll();
|
|
3030
3057
|
};
|
|
3031
|
-
});
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3058
|
+
const { add, dispose } = (0, import_vinyl_util30.createDisposer)();
|
|
3059
|
+
add(
|
|
3060
|
+
controller.on("playing", () => {
|
|
3061
|
+
if (inStall) endStall("playing" /* PLAYING */);
|
|
3062
|
+
else lastProgressAt = Date.now();
|
|
3063
|
+
observedPlaying = true;
|
|
3064
|
+
startPoll();
|
|
3065
|
+
})
|
|
3066
|
+
);
|
|
3067
|
+
add(
|
|
3068
|
+
controller.on("timeUpdate", () => {
|
|
3069
|
+
if (inStall) endStall("playing" /* PLAYING */);
|
|
3070
|
+
lastProgressAt = Date.now();
|
|
3071
|
+
})
|
|
3041
3072
|
);
|
|
3073
|
+
add(controller.on("pause", () => suspend("pause" /* PAUSE */)));
|
|
3074
|
+
add(controller.on("seeking", () => suspend("seeking" /* SEEKING */)));
|
|
3075
|
+
add(controller.on("emptied", () => suspend("emptied" /* EMPTIED */)));
|
|
3076
|
+
let stopped = false;
|
|
3077
|
+
return () => {
|
|
3078
|
+
if (stopped) return;
|
|
3079
|
+
stopped = true;
|
|
3080
|
+
stopPoll();
|
|
3081
|
+
dispose();
|
|
3082
|
+
};
|
|
3042
3083
|
}
|
|
3043
3084
|
|
|
3044
3085
|
// src/playback/error/InvalidSeekError.ts
|
|
3045
|
-
var
|
|
3046
|
-
var
|
|
3047
|
-
var InvalidSeekError = class _InvalidSeekError extends
|
|
3086
|
+
var import_vinyl_util31 = require("@amazon/vinyl-util");
|
|
3087
|
+
var import_vinyl_util32 = require("@amazon/vinyl-util");
|
|
3088
|
+
var InvalidSeekError = class _InvalidSeekError extends import_vinyl_util31.ReportableError {
|
|
3048
3089
|
constructor(time, seekable, tolerance) {
|
|
3049
3090
|
super(
|
|
3050
3091
|
`Could not seek to time: ${time}, outside of seekable ranges ${seekable} with tolerance ${tolerance}`,
|
|
3051
|
-
|
|
3052
|
-
|
|
3092
|
+
import_vinyl_util32.ErrorOrigin.API,
|
|
3093
|
+
import_vinyl_util31.ErrorLevel.WARN
|
|
3053
3094
|
);
|
|
3054
3095
|
__publicField(this, "time", time);
|
|
3055
3096
|
__publicField(this, "seekable", seekable);
|
|
@@ -3068,7 +3109,7 @@ var InvalidSeekError = class _InvalidSeekError extends import_vinyl_util35.Repor
|
|
|
3068
3109
|
};
|
|
3069
3110
|
|
|
3070
3111
|
// src/playback/error/ReportableMediaError.ts
|
|
3071
|
-
var
|
|
3112
|
+
var import_vinyl_util33 = require("@amazon/vinyl-util");
|
|
3072
3113
|
|
|
3073
3114
|
// src/playback/logging/mediaErrorToJson.ts
|
|
3074
3115
|
function mediaErrorToJson(error) {
|
|
@@ -3108,11 +3149,11 @@ function mediaErrorToJson(error) {
|
|
|
3108
3149
|
}
|
|
3109
3150
|
|
|
3110
3151
|
// src/playback/error/ReportableMediaError.ts
|
|
3111
|
-
var _ReportableMediaError = class _ReportableMediaError extends
|
|
3152
|
+
var _ReportableMediaError = class _ReportableMediaError extends import_vinyl_util33.ReportableError {
|
|
3112
3153
|
constructor(error) {
|
|
3113
3154
|
const { name, code, message } = mediaErrorToJson(error);
|
|
3114
|
-
const level = error == null || code === _ReportableMediaError.MEDIA_ERR_ABORTED ?
|
|
3115
|
-
super(message,
|
|
3155
|
+
const level = error == null || code === _ReportableMediaError.MEDIA_ERR_ABORTED ? import_vinyl_util33.ErrorLevel.SILENT : import_vinyl_util33.ErrorLevel.FATAL;
|
|
3156
|
+
super(message, import_vinyl_util33.ErrorOrigin.MEDIA, level);
|
|
3116
3157
|
__publicField(this, "reason");
|
|
3117
3158
|
__publicField(this, "code");
|
|
3118
3159
|
this.reason = name;
|
|
@@ -3137,90 +3178,11 @@ __publicField(_ReportableMediaError, "MEDIA_ERR_SRC_NOT_SUPPORTED", 4);
|
|
|
3137
3178
|
var ReportableMediaError = _ReportableMediaError;
|
|
3138
3179
|
|
|
3139
3180
|
// src/playback/logging/playbackStateLoggingHandler.ts
|
|
3181
|
+
var import_vinyl_util34 = require("@amazon/vinyl-util");
|
|
3182
|
+
var import_vinyl_util35 = require("@amazon/vinyl-util");
|
|
3183
|
+
var import_vinyl_util36 = require("@amazon/vinyl-util");
|
|
3184
|
+
var import_vinyl_util37 = require("@amazon/vinyl-util");
|
|
3140
3185
|
var import_vinyl_util38 = require("@amazon/vinyl-util");
|
|
3141
|
-
var import_vinyl_util39 = require("@amazon/vinyl-util");
|
|
3142
|
-
|
|
3143
|
-
// src/playback/ReadonlyPlaybackController.ts
|
|
3144
|
-
var PlayedReason = /* @__PURE__ */ ((PlayedReason2) => {
|
|
3145
|
-
PlayedReason2["EMPTIED"] = "emptied";
|
|
3146
|
-
PlayedReason2["ENDED"] = "ended";
|
|
3147
|
-
PlayedReason2["PAUSE"] = "pause";
|
|
3148
|
-
PlayedReason2["SEEKING"] = "seeking";
|
|
3149
|
-
PlayedReason2["WAITING"] = "waiting";
|
|
3150
|
-
return PlayedReason2;
|
|
3151
|
-
})(PlayedReason || {});
|
|
3152
|
-
var playedReasons = [
|
|
3153
|
-
"emptied" /* EMPTIED */,
|
|
3154
|
-
"ended" /* ENDED */,
|
|
3155
|
-
"pause" /* PAUSE */,
|
|
3156
|
-
"seeking" /* SEEKING */,
|
|
3157
|
-
"waiting" /* WAITING */
|
|
3158
|
-
];
|
|
3159
|
-
var WaitedReason = /* @__PURE__ */ ((WaitedReason2) => {
|
|
3160
|
-
WaitedReason2["PLAYING"] = "playing";
|
|
3161
|
-
WaitedReason2["PAUSE"] = "pause";
|
|
3162
|
-
WaitedReason2["EMPTIED"] = "emptied";
|
|
3163
|
-
WaitedReason2["SEEKING"] = "seeking";
|
|
3164
|
-
return WaitedReason2;
|
|
3165
|
-
})(WaitedReason || {});
|
|
3166
|
-
var waitedReasons = [
|
|
3167
|
-
"playing" /* PLAYING */,
|
|
3168
|
-
"pause" /* PAUSE */,
|
|
3169
|
-
"emptied" /* EMPTIED */,
|
|
3170
|
-
"seeking" /* SEEKING */
|
|
3171
|
-
];
|
|
3172
|
-
var ALL_PLAYBACK_STATE_EVENTS = [
|
|
3173
|
-
"abort",
|
|
3174
|
-
"canPlay",
|
|
3175
|
-
"canPlayThrough",
|
|
3176
|
-
"durationChange",
|
|
3177
|
-
"emptied",
|
|
3178
|
-
"ended",
|
|
3179
|
-
"error",
|
|
3180
|
-
"playIsPendingChange",
|
|
3181
|
-
"loadedData",
|
|
3182
|
-
"loadedMetadata",
|
|
3183
|
-
"loadStart",
|
|
3184
|
-
"looped",
|
|
3185
|
-
"mutedChange",
|
|
3186
|
-
"pause",
|
|
3187
|
-
"play",
|
|
3188
|
-
"playRejected",
|
|
3189
|
-
"played",
|
|
3190
|
-
"playing",
|
|
3191
|
-
"progress",
|
|
3192
|
-
"rateChange",
|
|
3193
|
-
"readyStateChange",
|
|
3194
|
-
"reset",
|
|
3195
|
-
"resize",
|
|
3196
|
-
"seeked",
|
|
3197
|
-
"seeking",
|
|
3198
|
-
"timeUpdate",
|
|
3199
|
-
"volumeChange",
|
|
3200
|
-
"waited",
|
|
3201
|
-
"waiting",
|
|
3202
|
-
"waitingForKey"
|
|
3203
|
-
];
|
|
3204
|
-
var PlaybackReadyState = /* @__PURE__ */ ((PlaybackReadyState2) => {
|
|
3205
|
-
PlaybackReadyState2[PlaybackReadyState2["HAVE_NOTHING"] = 0] = "HAVE_NOTHING";
|
|
3206
|
-
PlaybackReadyState2[PlaybackReadyState2["HAVE_METADATA"] = 1] = "HAVE_METADATA";
|
|
3207
|
-
PlaybackReadyState2[PlaybackReadyState2["HAVE_CURRENT_DATA"] = 2] = "HAVE_CURRENT_DATA";
|
|
3208
|
-
PlaybackReadyState2[PlaybackReadyState2["HAVE_FUTURE_DATA"] = 3] = "HAVE_FUTURE_DATA";
|
|
3209
|
-
PlaybackReadyState2[PlaybackReadyState2["HAVE_ENOUGH_DATA"] = 4] = "HAVE_ENOUGH_DATA";
|
|
3210
|
-
return PlaybackReadyState2;
|
|
3211
|
-
})(PlaybackReadyState || {});
|
|
3212
|
-
var PlaybackNetworkState = /* @__PURE__ */ ((PlaybackNetworkState2) => {
|
|
3213
|
-
PlaybackNetworkState2[PlaybackNetworkState2["NETWORK_EMPTY"] = 0] = "NETWORK_EMPTY";
|
|
3214
|
-
PlaybackNetworkState2[PlaybackNetworkState2["NETWORK_IDLE"] = 1] = "NETWORK_IDLE";
|
|
3215
|
-
PlaybackNetworkState2[PlaybackNetworkState2["NETWORK_LOADING"] = 2] = "NETWORK_LOADING";
|
|
3216
|
-
PlaybackNetworkState2[PlaybackNetworkState2["NETWORK_NO_SOURCE"] = 3] = "NETWORK_NO_SOURCE";
|
|
3217
|
-
return PlaybackNetworkState2;
|
|
3218
|
-
})(PlaybackNetworkState || {});
|
|
3219
|
-
|
|
3220
|
-
// src/playback/logging/playbackStateLoggingHandler.ts
|
|
3221
|
-
var import_vinyl_util40 = require("@amazon/vinyl-util");
|
|
3222
|
-
var import_vinyl_util41 = require("@amazon/vinyl-util");
|
|
3223
|
-
var import_vinyl_util42 = require("@amazon/vinyl-util");
|
|
3224
3186
|
var TIMEUPDATE_THROTTLE = 5;
|
|
3225
3187
|
var locale2 = {
|
|
3226
3188
|
/**
|
|
@@ -3234,18 +3196,18 @@ var locale2 = {
|
|
|
3234
3196
|
};
|
|
3235
3197
|
function playbackStateLoggingHandler(playbackState) {
|
|
3236
3198
|
const target = {
|
|
3237
|
-
logPrefix: (0,
|
|
3199
|
+
logPrefix: (0, import_vinyl_util38.createLogPrefix)("Playback")
|
|
3238
3200
|
};
|
|
3239
|
-
const disposer = (0,
|
|
3201
|
+
const disposer = (0, import_vinyl_util34.createDisposer)();
|
|
3240
3202
|
const { add } = disposer;
|
|
3241
3203
|
let timeUpdateCount = 0;
|
|
3242
3204
|
let startTime = null;
|
|
3243
3205
|
const logTimeupdateBatch = () => {
|
|
3244
3206
|
if (startTime == null) return;
|
|
3245
3207
|
const currentTime = playbackState.currentTime;
|
|
3246
|
-
(0,
|
|
3208
|
+
(0, import_vinyl_util35.logDebug)(
|
|
3247
3209
|
target,
|
|
3248
|
-
(0,
|
|
3210
|
+
(0, import_vinyl_util37.substitute)(locale2.timeupdateLogBatch, {
|
|
3249
3211
|
start: startTime.toFixed(1),
|
|
3250
3212
|
end: currentTime.toFixed(1),
|
|
3251
3213
|
count: timeUpdateCount
|
|
@@ -3255,7 +3217,7 @@ function playbackStateLoggingHandler(playbackState) {
|
|
|
3255
3217
|
startTime = null;
|
|
3256
3218
|
};
|
|
3257
3219
|
const logTimeupdateBatchThrottled = add(
|
|
3258
|
-
(0,
|
|
3220
|
+
(0, import_vinyl_util36.throttle)(logTimeupdateBatch, TIMEUPDATE_THROTTLE, { trailing: true })
|
|
3259
3221
|
);
|
|
3260
3222
|
add(
|
|
3261
3223
|
playbackState.on("timeUpdate", () => {
|
|
@@ -3269,7 +3231,7 @@ function playbackStateLoggingHandler(playbackState) {
|
|
|
3269
3231
|
add(
|
|
3270
3232
|
playbackState.on(type, (event) => {
|
|
3271
3233
|
logTimeupdateBatch();
|
|
3272
|
-
(0,
|
|
3234
|
+
(0, import_vinyl_util35.logDebug)(target, type, event);
|
|
3273
3235
|
})
|
|
3274
3236
|
);
|
|
3275
3237
|
}
|
|
@@ -3277,8 +3239,8 @@ function playbackStateLoggingHandler(playbackState) {
|
|
|
3277
3239
|
}
|
|
3278
3240
|
|
|
3279
3241
|
// src/playback/loudness/LoudnessNormalizationControllerImpl.ts
|
|
3280
|
-
var
|
|
3281
|
-
var
|
|
3242
|
+
var import_vinyl_util39 = require("@amazon/vinyl-util");
|
|
3243
|
+
var import_vinyl_util40 = require("@amazon/vinyl-util");
|
|
3282
3244
|
|
|
3283
3245
|
// src/playback/loudness/LoudnessNormalizationControllerImplOptions.ts
|
|
3284
3246
|
var import_vinyl_validation6 = require("@amazon/vinyl-validation");
|
|
@@ -3296,13 +3258,13 @@ var loudnessNormalizationControllerImplOptionsValidator = /* @__PURE__ */ (0, im
|
|
|
3296
3258
|
// src/playback/loudness/LoudnessNormalizationControllerImpl.ts
|
|
3297
3259
|
var DECIBEL_EXPONENT_BASE = /* @__PURE__ */ Math.pow(10, 1 / 10);
|
|
3298
3260
|
var MAX_GAIN_LEVEL = 1;
|
|
3299
|
-
var LoudnessNormalizationControllerImpl = class extends
|
|
3261
|
+
var LoudnessNormalizationControllerImpl = class extends import_vinyl_util40.EventHostImpl {
|
|
3300
3262
|
constructor(deps) {
|
|
3301
3263
|
super();
|
|
3302
3264
|
__publicField(this, "deps", deps);
|
|
3303
|
-
__publicField(this, "logPrefix", /* @__PURE__ */ (0,
|
|
3265
|
+
__publicField(this, "logPrefix", /* @__PURE__ */ (0, import_vinyl_util40.createLogPrefix)(this));
|
|
3304
3266
|
__publicField(this, "_gain", MAX_GAIN_LEVEL);
|
|
3305
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
3267
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util39.createDisposer)());
|
|
3306
3268
|
__publicField(this, "trackLoudness", null);
|
|
3307
3269
|
__publicField(this, "_options", defaultLoudnessNormalizationControllerImplOptions);
|
|
3308
3270
|
const { add } = this.disposer;
|
|
@@ -3336,9 +3298,9 @@ var LoudnessNormalizationControllerImpl = class extends import_vinyl_util44.Even
|
|
|
3336
3298
|
*/
|
|
3337
3299
|
set gain(value) {
|
|
3338
3300
|
const previousGain = this._gain;
|
|
3339
|
-
if (!(0,
|
|
3301
|
+
if (!(0, import_vinyl_util40.closeTo)(previousGain, value)) {
|
|
3340
3302
|
this._gain = value;
|
|
3341
|
-
(0,
|
|
3303
|
+
(0, import_vinyl_util40.logDebug)(this, "loudness gain adjustment:", {
|
|
3342
3304
|
trackLoudness: this.trackLoudness,
|
|
3343
3305
|
targetLufs: this.options.targetLufs,
|
|
3344
3306
|
gain: value
|
|
@@ -3375,65 +3337,72 @@ var LoudnessNormalizationControllerImpl = class extends import_vinyl_util44.Even
|
|
|
3375
3337
|
};
|
|
3376
3338
|
|
|
3377
3339
|
// src/playback/nextHasMetadata.ts
|
|
3378
|
-
var
|
|
3340
|
+
var import_vinyl_util41 = require("@amazon/vinyl-util");
|
|
3379
3341
|
function nextHasMetadata(controller, options) {
|
|
3380
3342
|
if (controller.hasMetadata) return Promise.resolve({});
|
|
3381
|
-
return (0,
|
|
3343
|
+
return (0, import_vinyl_util41.nextEventAsPromise)(controller, "loadedMetadata", options);
|
|
3382
3344
|
}
|
|
3383
3345
|
|
|
3384
3346
|
// src/playback/PlaybackController.ts
|
|
3385
3347
|
var LIVE_DURATION = 4294967296;
|
|
3386
3348
|
|
|
3387
3349
|
// src/playback/PlaybackControllerImpl.ts
|
|
3388
|
-
var
|
|
3350
|
+
var import_vinyl_util42 = require("@amazon/vinyl-util");
|
|
3389
3351
|
var defaultPlaybackControllerImplOptions = {
|
|
3390
3352
|
loopTimeAffordance: 2,
|
|
3391
3353
|
minSeekableBuffer: -1,
|
|
3392
3354
|
// Default comes from getMinSeekableBufferDefault()
|
|
3393
3355
|
playTimeout: 30,
|
|
3394
|
-
seekTimeout: 30
|
|
3356
|
+
seekTimeout: 30,
|
|
3357
|
+
stallThreshold: 1
|
|
3395
3358
|
};
|
|
3396
3359
|
function getMinSeekableBufferDefault() {
|
|
3397
|
-
return !(0,
|
|
3360
|
+
return !(0, import_vinyl_util42.hasBrowser)(import_vinyl_util42.Browser.CHROMIUM) ? 5 : 2;
|
|
3398
3361
|
}
|
|
3399
|
-
var
|
|
3362
|
+
var SEEK_RETRY_LIMIT = 2;
|
|
3363
|
+
var SEEK_ATTEMPT_TIMEOUT = 4;
|
|
3364
|
+
var PlaybackControllerImpl = class extends import_vinyl_util42.EventHostImpl {
|
|
3400
3365
|
constructor(deps, options) {
|
|
3401
3366
|
super();
|
|
3402
3367
|
__publicField(this, "loudnessNormalizationController");
|
|
3403
3368
|
__publicField(this, "_error", null);
|
|
3404
3369
|
__publicField(this, "media");
|
|
3405
3370
|
__publicField(this, "domEvents");
|
|
3406
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
3371
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util42.createDisposer)());
|
|
3407
3372
|
__publicField(this, "_playing", false);
|
|
3408
3373
|
__publicField(this, "_seeking", false);
|
|
3409
3374
|
__publicField(this, "_waiting", false);
|
|
3410
3375
|
// Monotonic counter identifying the most recent seekTo call.
|
|
3411
3376
|
__publicField(this, "_seekId", 0);
|
|
3377
|
+
// Stops the stall detector started after the last seek, if any.
|
|
3378
|
+
__publicField(this, "stopStallDetection", null);
|
|
3412
3379
|
// default user volume (0.0 to 1.0 scale)
|
|
3413
3380
|
__publicField(this, "userVolume", 1);
|
|
3414
3381
|
__publicField(this, "_pendingPlay", null);
|
|
3415
3382
|
__publicField(this, "playAbort", null);
|
|
3416
|
-
__publicField(this, "disposeAbort", /* @__PURE__ */ new
|
|
3383
|
+
__publicField(this, "disposeAbort", /* @__PURE__ */ new import_vinyl_util42.Abort());
|
|
3417
3384
|
__publicField(this, "options");
|
|
3418
3385
|
this.options = __spreadValues(__spreadProps(__spreadValues({}, defaultPlaybackControllerImplOptions), {
|
|
3419
3386
|
minSeekableBuffer: getMinSeekableBufferDefault()
|
|
3420
3387
|
}), options);
|
|
3421
3388
|
this.loudnessNormalizationController = deps.loudnessNormalizationController;
|
|
3422
|
-
(0,
|
|
3389
|
+
(0, import_vinyl_util42.logInfo)(this, "constructed", this.options);
|
|
3423
3390
|
this.media = deps.media;
|
|
3424
3391
|
const { add } = this.disposer;
|
|
3425
3392
|
add(() => {
|
|
3393
|
+
var _a;
|
|
3426
3394
|
this.disposeAbort.abort();
|
|
3427
3395
|
this.disposeAbort.dispose();
|
|
3396
|
+
(_a = this.stopStallDetection) == null ? void 0 : _a.call(this);
|
|
3428
3397
|
});
|
|
3429
3398
|
this.domEvents = add(
|
|
3430
|
-
new
|
|
3399
|
+
new import_vinyl_util42.DomEventHost(deps.media)
|
|
3431
3400
|
);
|
|
3432
3401
|
add(playbackStateLoggingHandler(this));
|
|
3433
3402
|
this.domEvents.on("error", (_) => {
|
|
3434
3403
|
const error = new ReportableMediaError(this.media.error);
|
|
3435
|
-
if (error.level ===
|
|
3436
|
-
(0,
|
|
3404
|
+
if (error.level === import_vinyl_util42.ErrorLevel.SILENT) {
|
|
3405
|
+
(0, import_vinyl_util42.logInfo)(this, error.message);
|
|
3437
3406
|
return;
|
|
3438
3407
|
}
|
|
3439
3408
|
this._error = error;
|
|
@@ -3443,6 +3412,16 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3443
3412
|
});
|
|
3444
3413
|
});
|
|
3445
3414
|
this.initializeEvents();
|
|
3415
|
+
add(
|
|
3416
|
+
createStallMonitor(
|
|
3417
|
+
this,
|
|
3418
|
+
{
|
|
3419
|
+
onStallEntered: () => this.dispatch("stallEntered", {}),
|
|
3420
|
+
onStallEnded: (info) => this.dispatch("stallEnded", info)
|
|
3421
|
+
},
|
|
3422
|
+
{ stallThreshold: this.options.stallThreshold }
|
|
3423
|
+
)
|
|
3424
|
+
);
|
|
3446
3425
|
add(
|
|
3447
3426
|
this.loudnessNormalizationController.on("change", () => {
|
|
3448
3427
|
this.refreshVolume();
|
|
@@ -3459,7 +3438,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3459
3438
|
refreshVolume() {
|
|
3460
3439
|
const effectiveVolume = this.userVolume * this.loudnessNormalizationController.gain;
|
|
3461
3440
|
this.media.volume = Math.min(1, effectiveVolume);
|
|
3462
|
-
(0,
|
|
3441
|
+
(0, import_vinyl_util42.logDebug)(this, "refreshVolume", {
|
|
3463
3442
|
userVolume: this.userVolume,
|
|
3464
3443
|
lnGain: this.loudnessNormalizationController.gain,
|
|
3465
3444
|
effectiveVolume: this.media.volume
|
|
@@ -3500,7 +3479,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3500
3479
|
"waiting",
|
|
3501
3480
|
"waitingForKey"
|
|
3502
3481
|
]) {
|
|
3503
|
-
this.domEvents.on((0,
|
|
3482
|
+
this.domEvents.on((0, import_vinyl_util42.toLowerCase)(key), () => this.dispatch(key, {}));
|
|
3504
3483
|
}
|
|
3505
3484
|
this.domEvents.on("progress", (e) => {
|
|
3506
3485
|
this.dispatch("progress", { loaded: e.loaded, total: e.total });
|
|
@@ -3518,9 +3497,9 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3518
3497
|
volumeChange: () => this.volume,
|
|
3519
3498
|
rateChange: () => this.playbackRate
|
|
3520
3499
|
};
|
|
3521
|
-
for (const key of (0,
|
|
3500
|
+
for (const key of (0, import_vinyl_util42.ownKeys)(changeEventGetters)) {
|
|
3522
3501
|
this.domEvents.on(
|
|
3523
|
-
(0,
|
|
3502
|
+
(0, import_vinyl_util42.toLowerCase)(key),
|
|
3524
3503
|
createChangeEventTrigger(changeEventGetters[key], (event) => {
|
|
3525
3504
|
this.dispatch(key, event);
|
|
3526
3505
|
})
|
|
@@ -3600,7 +3579,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3600
3579
|
started = true;
|
|
3601
3580
|
startedAt = Date.now();
|
|
3602
3581
|
});
|
|
3603
|
-
(0,
|
|
3582
|
+
(0, import_vinyl_util42.onAny)(host, endEvents, (_, event) => {
|
|
3604
3583
|
if (started) {
|
|
3605
3584
|
started = false;
|
|
3606
3585
|
const now = Date.now();
|
|
@@ -3632,7 +3611,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3632
3611
|
current: this.muted
|
|
3633
3612
|
});
|
|
3634
3613
|
};
|
|
3635
|
-
const mutedTimeoutSlot = add(new
|
|
3614
|
+
const mutedTimeoutSlot = add(new import_vinyl_util42.TimeoutSlot());
|
|
3636
3615
|
this.on("volumeChange", () => {
|
|
3637
3616
|
maybeDispatchMutedChange();
|
|
3638
3617
|
mutedTimeoutSlot.set(maybeDispatchMutedChange, 0.2);
|
|
@@ -3649,10 +3628,9 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3649
3628
|
initializeLoopedEvent() {
|
|
3650
3629
|
let lastTime = 0;
|
|
3651
3630
|
this.on("timeUpdate", () => {
|
|
3652
|
-
var _a;
|
|
3653
3631
|
if (this.loop && !this.paused && this.currentTime <= this.options.loopTimeAffordance && lastTime >= this.duration - this.options.loopTimeAffordance) {
|
|
3654
|
-
if ((
|
|
3655
|
-
(0,
|
|
3632
|
+
if ((0, import_vinyl_util42.hasBrowser)(import_vinyl_util42.Browser.FIREFOX)) {
|
|
3633
|
+
(0, import_vinyl_util42.logDebug)(this, "fabricating Firefox playing event on loop");
|
|
3656
3634
|
this.dispatch("playing", {});
|
|
3657
3635
|
}
|
|
3658
3636
|
this.dispatch("looped", {});
|
|
@@ -3661,7 +3639,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3661
3639
|
});
|
|
3662
3640
|
}
|
|
3663
3641
|
get buffered() {
|
|
3664
|
-
return (0,
|
|
3642
|
+
return (0, import_vinyl_util42.createTimeRangesReader)(this.media.buffered);
|
|
3665
3643
|
}
|
|
3666
3644
|
get currentTime() {
|
|
3667
3645
|
return this.media.currentTime;
|
|
@@ -3673,7 +3651,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3673
3651
|
return this.media.defaultPlaybackRate;
|
|
3674
3652
|
}
|
|
3675
3653
|
set defaultPlaybackRate(value) {
|
|
3676
|
-
(0,
|
|
3654
|
+
(0, import_vinyl_util42.logDebug)(this, `defaultPlaybackRate set to ${value}`);
|
|
3677
3655
|
this.media.defaultPlaybackRate = value;
|
|
3678
3656
|
}
|
|
3679
3657
|
get duration() {
|
|
@@ -3691,14 +3669,14 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3691
3669
|
return this.media.loop;
|
|
3692
3670
|
}
|
|
3693
3671
|
set loop(value) {
|
|
3694
|
-
(0,
|
|
3672
|
+
(0, import_vinyl_util42.logDebug)(this, `loop set to ${value}`);
|
|
3695
3673
|
this.media.loop = value;
|
|
3696
3674
|
}
|
|
3697
3675
|
get muted() {
|
|
3698
3676
|
return this.media.muted;
|
|
3699
3677
|
}
|
|
3700
3678
|
set muted(value) {
|
|
3701
|
-
(0,
|
|
3679
|
+
(0, import_vinyl_util42.logDebug)(this, `muted set to ${value}`);
|
|
3702
3680
|
this.media.muted = value;
|
|
3703
3681
|
}
|
|
3704
3682
|
get networkState() {
|
|
@@ -3711,7 +3689,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3711
3689
|
return this.media.playbackRate;
|
|
3712
3690
|
}
|
|
3713
3691
|
set playbackRate(value) {
|
|
3714
|
-
(0,
|
|
3692
|
+
(0, import_vinyl_util42.logDebug)(this, `playbackRate set to ${value}`);
|
|
3715
3693
|
this.media.playbackRate = value;
|
|
3716
3694
|
}
|
|
3717
3695
|
get playing() {
|
|
@@ -3721,14 +3699,14 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3721
3699
|
return this.media.preservesPitch;
|
|
3722
3700
|
}
|
|
3723
3701
|
set preservesPitch(value) {
|
|
3724
|
-
(0,
|
|
3702
|
+
(0, import_vinyl_util42.logDebug)(this, `preservesPitch set to ${value}`);
|
|
3725
3703
|
this.media.preservesPitch = value;
|
|
3726
3704
|
}
|
|
3727
3705
|
get readyState() {
|
|
3728
3706
|
return this.media.readyState;
|
|
3729
3707
|
}
|
|
3730
3708
|
get seekable() {
|
|
3731
|
-
return (0,
|
|
3709
|
+
return (0, import_vinyl_util42.createTimeRangesReader)(this.media.seekable);
|
|
3732
3710
|
}
|
|
3733
3711
|
get seeking() {
|
|
3734
3712
|
return this._seeking;
|
|
@@ -3737,7 +3715,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3737
3715
|
return this.userVolume;
|
|
3738
3716
|
}
|
|
3739
3717
|
set volume(value) {
|
|
3740
|
-
(0,
|
|
3718
|
+
(0, import_vinyl_util42.logDebug)(this, `volume set to ${value}`);
|
|
3741
3719
|
this.userVolume = value;
|
|
3742
3720
|
this.refreshVolume();
|
|
3743
3721
|
}
|
|
@@ -3746,9 +3724,9 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3746
3724
|
}
|
|
3747
3725
|
pause() {
|
|
3748
3726
|
var _a;
|
|
3749
|
-
(0,
|
|
3727
|
+
(0, import_vinyl_util42.logDebug)(this, "pause");
|
|
3750
3728
|
(_a = this.playAbort) == null ? void 0 : _a.abort(
|
|
3751
|
-
new
|
|
3729
|
+
new import_vinyl_util42.AbortError(
|
|
3752
3730
|
"The play() request was interrupted by a call to pause()."
|
|
3753
3731
|
)
|
|
3754
3732
|
);
|
|
@@ -3765,22 +3743,39 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3765
3743
|
current: value != null
|
|
3766
3744
|
});
|
|
3767
3745
|
}
|
|
3746
|
+
/**
|
|
3747
|
+
* Starts (or restarts) the stall detector: recovers a play head that stays frozen when it
|
|
3748
|
+
* should be advancing — some WebKit versions never resume after a seek or a play, e.g. after a
|
|
3749
|
+
* buffer-flushing seek. Superseded by the next seek/play and stopped on dispose.
|
|
3750
|
+
* @private
|
|
3751
|
+
*/
|
|
3752
|
+
startStallDetection() {
|
|
3753
|
+
var _a;
|
|
3754
|
+
(_a = this.stopStallDetection) == null ? void 0 : _a.call(this);
|
|
3755
|
+
this.stopStallDetection = createStallDetector(this.media, {
|
|
3756
|
+
fabricatePlaying: () => this.dispatch("playing", {}),
|
|
3757
|
+
// Safari/iOS can leave a seek on a freshly-attached source pending
|
|
3758
|
+
// with a stale empty `buffered`; re-issue the seek to un-stick it.
|
|
3759
|
+
nudgeUnbuffered: (0, import_vinyl_util42.hasBrowser)(import_vinyl_util42.Browser.WEBKIT)
|
|
3760
|
+
});
|
|
3761
|
+
}
|
|
3768
3762
|
play() {
|
|
3769
|
-
(0,
|
|
3763
|
+
(0, import_vinyl_util42.logDebug)(this, "play");
|
|
3764
|
+
this.startStallDetection();
|
|
3770
3765
|
if (!this.pendingPlay) {
|
|
3771
|
-
const playAbort = new
|
|
3766
|
+
const playAbort = new import_vinyl_util42.Abort();
|
|
3772
3767
|
this.playAbort = playAbort;
|
|
3773
|
-
this.pendingPlay = (0,
|
|
3768
|
+
this.pendingPlay = (0, import_vinyl_util42.withAbort)(
|
|
3774
3769
|
(async () => {
|
|
3775
3770
|
await nextHasMetadata(this);
|
|
3776
3771
|
playAbort.throwIfAborted();
|
|
3777
|
-
await (0,
|
|
3772
|
+
await (0, import_vinyl_util42.withTimeout)(
|
|
3778
3773
|
this.media.play(),
|
|
3779
3774
|
this.options.playTimeout,
|
|
3780
3775
|
{
|
|
3781
3776
|
message: "play() timed out after {time}s",
|
|
3782
|
-
origin:
|
|
3783
|
-
level:
|
|
3777
|
+
origin: import_vinyl_util42.ErrorOrigin.INTERNAL,
|
|
3778
|
+
level: import_vinyl_util42.ErrorLevel.SILENT
|
|
3784
3779
|
}
|
|
3785
3780
|
);
|
|
3786
3781
|
})(),
|
|
@@ -3808,19 +3803,23 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3808
3803
|
return this.pendingPlay != null;
|
|
3809
3804
|
}
|
|
3810
3805
|
async seekTo(time, tolerance = 0.5) {
|
|
3811
|
-
|
|
3806
|
+
var _a;
|
|
3807
|
+
(0, import_vinyl_util42.logDebug)(this, `seekTo: ${time}`);
|
|
3812
3808
|
const seekId = ++this._seekId;
|
|
3809
|
+
(_a = this.stopStallDetection) == null ? void 0 : _a.call(this);
|
|
3810
|
+
this.stopStallDetection = null;
|
|
3813
3811
|
const superseded = () => {
|
|
3814
3812
|
if (this._seekId === seekId) return false;
|
|
3815
|
-
(0,
|
|
3813
|
+
(0, import_vinyl_util42.logDebug)(this, `seekTo: ${time} superseded by a newer seek`);
|
|
3816
3814
|
return true;
|
|
3817
3815
|
};
|
|
3818
|
-
const nextEvent = (type) => {
|
|
3819
|
-
|
|
3820
|
-
|
|
3816
|
+
const nextEvent = (type, options) => {
|
|
3817
|
+
var _a2;
|
|
3818
|
+
return (0, import_vinyl_util42.nextEventAsPromise)(this, type, {
|
|
3819
|
+
timeout: (_a2 = options == null ? void 0 : options.timeout) != null ? _a2 : this.options.seekTimeout,
|
|
3821
3820
|
timeoutMessage: `seek timed out on ${type} event after {time}s`,
|
|
3822
|
-
timeoutOrigin:
|
|
3823
|
-
timeoutLevel:
|
|
3821
|
+
timeoutOrigin: import_vinyl_util42.ErrorOrigin.INTERNAL,
|
|
3822
|
+
timeoutLevel: import_vinyl_util42.ErrorLevel.WARN,
|
|
3824
3823
|
abort: this.disposeAbort
|
|
3825
3824
|
});
|
|
3826
3825
|
};
|
|
@@ -3830,11 +3829,11 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3830
3829
|
}
|
|
3831
3830
|
const seekable = this.seekable;
|
|
3832
3831
|
const range = seekable.getRangeAt(
|
|
3833
|
-
(0,
|
|
3832
|
+
(0, import_vinyl_util42.clamp)(time, 0, this.duration),
|
|
3834
3833
|
tolerance
|
|
3835
3834
|
);
|
|
3836
3835
|
if (range == null) {
|
|
3837
|
-
(0,
|
|
3836
|
+
(0, import_vinyl_util42.logWarn)(
|
|
3838
3837
|
this,
|
|
3839
3838
|
`seekTo: seek outside of seekable ranges, seek ignored`,
|
|
3840
3839
|
seekable.ranges
|
|
@@ -3846,23 +3845,40 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3846
3845
|
Math.min(time, range[1] - seekableBuffer),
|
|
3847
3846
|
range[0]
|
|
3848
3847
|
);
|
|
3849
|
-
(0,
|
|
3848
|
+
(0, import_vinyl_util42.logDebug)(
|
|
3850
3849
|
this,
|
|
3851
3850
|
`seekTo operation, requested: ${time}, actual: ${clampedTime}`
|
|
3852
3851
|
);
|
|
3853
|
-
if ((0,
|
|
3854
|
-
(0,
|
|
3852
|
+
if ((0, import_vinyl_util42.closeTo)(clampedTime, this.currentTime, tolerance)) {
|
|
3853
|
+
(0, import_vinyl_util42.logDebug)(
|
|
3855
3854
|
this,
|
|
3856
3855
|
`seekTo: requested: ${time}, actual: ${clampedTime} no-op`
|
|
3857
3856
|
);
|
|
3858
3857
|
} else {
|
|
3859
|
-
const
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3858
|
+
const nullIfStuck = (error) => {
|
|
3859
|
+
if (this.disposeAbort.aborted()) throw error;
|
|
3860
|
+
return null;
|
|
3861
|
+
};
|
|
3862
|
+
const seekOnce = async (reSeeking) => {
|
|
3863
|
+
const seeking = reSeeking ? nextEvent("seeking", {
|
|
3864
|
+
timeout: SEEK_ATTEMPT_TIMEOUT
|
|
3865
|
+
}).catch(nullIfStuck) : nextEvent("seeking");
|
|
3866
|
+
this.media.currentTime = clampedTime;
|
|
3867
|
+
if (await seeking === null) return null;
|
|
3868
|
+
return nextEvent("seeked", {
|
|
3869
|
+
timeout: SEEK_ATTEMPT_TIMEOUT
|
|
3870
|
+
}).catch(nullIfStuck);
|
|
3871
|
+
};
|
|
3872
|
+
let seekedEvent = await seekOnce(false);
|
|
3873
|
+
for (let attempt = 0; !superseded() && attempt < SEEK_RETRY_LIMIT && (seekedEvent === null || seekedEvent.reason === "seeked" && !(0, import_vinyl_util42.closeTo)(clampedTime, this.currentTime, tolerance)); attempt++) {
|
|
3874
|
+
if (seekedEvent === null) void this.media.play().catch(import_vinyl_util42.noop);
|
|
3875
|
+
(0, import_vinyl_util42.logDebug)(this, `seekTo: re-seeking to ${clampedTime}`);
|
|
3876
|
+
seekedEvent = await seekOnce(true);
|
|
3865
3877
|
}
|
|
3878
|
+
if ((seekedEvent == null ? void 0 : seekedEvent.reason) === "emptied") {
|
|
3879
|
+
throw new import_vinyl_util42.AbortError();
|
|
3880
|
+
}
|
|
3881
|
+
if (!this.paused) this.startStallDetection();
|
|
3866
3882
|
}
|
|
3867
3883
|
}
|
|
3868
3884
|
/**
|
|
@@ -3871,7 +3887,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3871
3887
|
*/
|
|
3872
3888
|
initializeReadyStateChangeEvent() {
|
|
3873
3889
|
let previous = this.readyState;
|
|
3874
|
-
(0,
|
|
3890
|
+
(0, import_vinyl_util42.onAny)(
|
|
3875
3891
|
this,
|
|
3876
3892
|
[
|
|
3877
3893
|
"canPlay",
|
|
@@ -3895,10 +3911,10 @@ var PlaybackControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
|
3895
3911
|
}
|
|
3896
3912
|
reset() {
|
|
3897
3913
|
if (this._error == null) {
|
|
3898
|
-
(0,
|
|
3914
|
+
(0, import_vinyl_util42.logDebug)(this, "reset no-op");
|
|
3899
3915
|
return;
|
|
3900
3916
|
}
|
|
3901
|
-
(0,
|
|
3917
|
+
(0, import_vinyl_util42.logDebug)(this, "reset");
|
|
3902
3918
|
this._error = null;
|
|
3903
3919
|
this.dispatch("reset", {});
|
|
3904
3920
|
}
|
|
@@ -3956,7 +3972,7 @@ var PlaybackSourceImpl = class {
|
|
|
3956
3972
|
};
|
|
3957
3973
|
|
|
3958
3974
|
// src/streaming/abr/QualitySelectorImpl.ts
|
|
3959
|
-
var
|
|
3975
|
+
var import_vinyl_util43 = require("@amazon/vinyl-util");
|
|
3960
3976
|
var import_vinyl_validation7 = require("@amazon/vinyl-validation");
|
|
3961
3977
|
var AbrStrategy = /* @__PURE__ */ ((AbrStrategy2) => {
|
|
3962
3978
|
AbrStrategy2["LOWEST"] = "lowest";
|
|
@@ -3989,9 +4005,9 @@ var defaultQualitySelectorImplOptions = {
|
|
|
3989
4005
|
};
|
|
3990
4006
|
var QualitySelectorImpl = class {
|
|
3991
4007
|
constructor(deps) {
|
|
3992
|
-
__publicField(this, "logPrefix", /* @__PURE__ */ (0,
|
|
4008
|
+
__publicField(this, "logPrefix", /* @__PURE__ */ (0, import_vinyl_util43.createLogPrefix)(this));
|
|
3993
4009
|
__publicField(this, "_options", defaultQualitySelectorImplOptions);
|
|
3994
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
4010
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util43.createDisposer)());
|
|
3995
4011
|
const { add } = this.disposer;
|
|
3996
4012
|
add(
|
|
3997
4013
|
deps.options.onData((v) => {
|
|
@@ -4030,9 +4046,9 @@ var QualitySelectorImpl = class {
|
|
|
4030
4046
|
if (previousIndex >= 0) return previousIndex;
|
|
4031
4047
|
}
|
|
4032
4048
|
const fetchedTime = prefetchState.fetchedTime;
|
|
4033
|
-
const bandwidthEstimate = (0,
|
|
4034
|
-
const bufferRatio = highBufferThreshold > 0 ? (0,
|
|
4035
|
-
const bandwidthMultiplier = prefetchState.active ? (0,
|
|
4049
|
+
const bandwidthEstimate = (0, import_vinyl_util43.getNetworkMetrics)().estimatedDownlinkBandwidth;
|
|
4050
|
+
const bufferRatio = highBufferThreshold > 0 ? (0, import_vinyl_util43.clamp)(fetchedTime / highBufferThreshold, 0, 1) : 1;
|
|
4051
|
+
const bandwidthMultiplier = prefetchState.active ? (0, import_vinyl_util43.lerp)(bandwidthMultiplierLow, bandwidthMultiplierHigh, bufferRatio) : bandwidthMultiplierHigh;
|
|
4036
4052
|
let bandwidth = (prefetchState.active ? Math.min(bandwidthEstimate.ewmaLow, bandwidthEstimate.latest) : bandwidthEstimate.ewmaLow) * bandwidthMultiplier;
|
|
4037
4053
|
if (maxBandwidth != null && maxBandwidth < bandwidth) {
|
|
4038
4054
|
bandwidth = maxBandwidth;
|
|
@@ -4081,30 +4097,34 @@ var QualitySelectorImpl = class {
|
|
|
4081
4097
|
// src/streaming/AudioOptions.ts
|
|
4082
4098
|
var import_vinyl_validation8 = require("@amazon/vinyl-validation");
|
|
4083
4099
|
var defaultAudioOptions = {
|
|
4084
|
-
selection: { language: null, descriptive: false }
|
|
4100
|
+
selection: { language: null, descriptive: false },
|
|
4101
|
+
disableSampleRateFilter: false
|
|
4085
4102
|
};
|
|
4086
4103
|
var audioSelectionValidator = /* @__PURE__ */ (0, import_vinyl_validation8.object)({
|
|
4087
4104
|
language: /* @__PURE__ */ (0, import_vinyl_validation8.string)().or(/* @__PURE__ */ (0, import_vinyl_validation8.array)(/* @__PURE__ */ (0, import_vinyl_validation8.string)()).readonly()).orNull().optional(),
|
|
4088
4105
|
descriptive: /* @__PURE__ */ (0, import_vinyl_validation8.boolean)().optional()
|
|
4089
4106
|
});
|
|
4090
4107
|
var audioOptionsValidator = /* @__PURE__ */ (0, import_vinyl_validation8.object)({
|
|
4091
|
-
selection: /* @__PURE__ */ audioSelectionValidator.optional()
|
|
4108
|
+
selection: /* @__PURE__ */ audioSelectionValidator.optional(),
|
|
4109
|
+
disableSampleRateFilter: /* @__PURE__ */ (0, import_vinyl_validation8.boolean)().optional(),
|
|
4110
|
+
maxSampleRate: /* @__PURE__ */ (0, import_vinyl_validation8.number)().maybe().optional(),
|
|
4111
|
+
minSampleRate: /* @__PURE__ */ (0, import_vinyl_validation8.number)().maybe().optional()
|
|
4092
4112
|
});
|
|
4093
4113
|
|
|
4094
4114
|
// src/streaming/buffering/BufferingController.ts
|
|
4095
|
-
var
|
|
4115
|
+
var import_vinyl_util46 = require("@amazon/vinyl-util");
|
|
4096
4116
|
|
|
4097
4117
|
// src/streaming/SegmentController.ts
|
|
4098
4118
|
var SEGMENT_START_AFFORDANCE = 0.2;
|
|
4099
4119
|
|
|
4100
4120
|
// src/streaming/buffering/error/SourceBufferError.ts
|
|
4101
|
-
var
|
|
4102
|
-
var
|
|
4103
|
-
var SourceBufferError = class _SourceBufferError extends
|
|
4121
|
+
var import_vinyl_util44 = require("@amazon/vinyl-util");
|
|
4122
|
+
var import_vinyl_util45 = require("@amazon/vinyl-util");
|
|
4123
|
+
var SourceBufferError = class _SourceBufferError extends import_vinyl_util45.ReportableError {
|
|
4104
4124
|
get [Symbol.toStringTag]() {
|
|
4105
4125
|
return "SourceBufferError";
|
|
4106
4126
|
}
|
|
4107
|
-
constructor(message = `A SourceBuffer error has occurred.`, origin =
|
|
4127
|
+
constructor(message = `A SourceBuffer error has occurred.`, origin = import_vinyl_util44.ErrorOrigin.MEDIA) {
|
|
4108
4128
|
super(message, origin);
|
|
4109
4129
|
Object.setPrototypeOf(this, _SourceBufferError.prototype);
|
|
4110
4130
|
}
|
|
@@ -4164,7 +4184,7 @@ var defaultBufferingControllerOptions = {
|
|
|
4164
4184
|
// 150 * 1024 * 1024
|
|
4165
4185
|
}
|
|
4166
4186
|
};
|
|
4167
|
-
var BufferingControllerImpl = class extends
|
|
4187
|
+
var BufferingControllerImpl = class extends import_vinyl_util46.EventHostImpl {
|
|
4168
4188
|
constructor(deps, contentType2, options) {
|
|
4169
4189
|
super();
|
|
4170
4190
|
__publicField(this, "deps", deps);
|
|
@@ -4181,7 +4201,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4181
4201
|
/**
|
|
4182
4202
|
* The currently buffered segments.
|
|
4183
4203
|
*/
|
|
4184
|
-
__publicField(this, "buffered", /* @__PURE__ */ new
|
|
4204
|
+
__publicField(this, "buffered", /* @__PURE__ */ new import_vinyl_util46.LinkedList());
|
|
4185
4205
|
__publicField(this, "appendOffset", 0);
|
|
4186
4206
|
/**
|
|
4187
4207
|
* The currently buffering quality.
|
|
@@ -4195,12 +4215,11 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4195
4215
|
__publicField(this, "reopen", false);
|
|
4196
4216
|
__publicField(this, "_error", null);
|
|
4197
4217
|
__publicField(this, "_bufferingEnded", false);
|
|
4198
|
-
__publicField(this, "
|
|
4199
|
-
__publicField(this, "
|
|
4200
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util50.createDisposer)());
|
|
4218
|
+
__publicField(this, "queue", /* @__PURE__ */ (0, import_vinyl_util46.createTaskQueue)());
|
|
4219
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util46.createDisposer)());
|
|
4201
4220
|
__publicField(this, "_active", false);
|
|
4202
4221
|
__publicField(this, "activateDisposer", null);
|
|
4203
|
-
__publicField(this, "segmentAbort", /* @__PURE__ */ (0,
|
|
4222
|
+
__publicField(this, "segmentAbort", /* @__PURE__ */ (0, import_vinyl_util46.createAbortSlot)());
|
|
4204
4223
|
/**
|
|
4205
4224
|
* Resets the throttle and polls the buffer on the next frame.
|
|
4206
4225
|
*/
|
|
@@ -4217,11 +4236,11 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4217
4236
|
* @private
|
|
4218
4237
|
*/
|
|
4219
4238
|
__publicField(this, "pollBuffer", /* @__PURE__ */ this.disposer.add(
|
|
4220
|
-
/* @__PURE__ */ (0,
|
|
4239
|
+
/* @__PURE__ */ (0, import_vinyl_util46.throttle)(
|
|
4221
4240
|
() => {
|
|
4222
4241
|
const time = this.playbackController.currentTime;
|
|
4223
|
-
if ((0,
|
|
4224
|
-
(0,
|
|
4242
|
+
if ((0, import_vinyl_util46.getLogLevel)() === import_vinyl_util46.LogLevel.VERBOSE) {
|
|
4243
|
+
(0, import_vinyl_util46.logVerbose)(
|
|
4225
4244
|
this,
|
|
4226
4245
|
`pollBuffer time: ${time}, bufferedTime: ${this.getBufferedTime()}, busy: ${this.busy}, error: ${this.error != null}, readyState: ${this.mediaSourceController.readyState}`
|
|
4227
4246
|
);
|
|
@@ -4251,7 +4270,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4251
4270
|
const newAppendSize = this.getMaxAppendSize(contentType2) * QUOTA_REACHED_SCALE;
|
|
4252
4271
|
if (newAppendSize >= MIN_APPEND_SIZE) {
|
|
4253
4272
|
sourceBufferQuotas.set(contentType2, newAppendSize);
|
|
4254
|
-
(0,
|
|
4273
|
+
(0, import_vinyl_util46.logWarn)(
|
|
4255
4274
|
this,
|
|
4256
4275
|
"QuotaExceededError, new source buffer limit:",
|
|
4257
4276
|
(newAppendSize / 1024 / 1024).toFixed(1) + " MiB"
|
|
@@ -4267,7 +4286,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4267
4286
|
if (this.tryCodecFallback(error)) {
|
|
4268
4287
|
return;
|
|
4269
4288
|
}
|
|
4270
|
-
if (!(0,
|
|
4289
|
+
if (!(0, import_vinyl_util46.isSilentError)(error)) {
|
|
4271
4290
|
this._error = error;
|
|
4272
4291
|
this.dispatch("error", {
|
|
4273
4292
|
target: this,
|
|
@@ -4280,13 +4299,13 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4280
4299
|
*/
|
|
4281
4300
|
__publicField(this, "finishAndClearBuffers", async () => {
|
|
4282
4301
|
if (!this.active) return;
|
|
4283
|
-
(0,
|
|
4302
|
+
(0, import_vinyl_util46.logVerbose)(this, "finishAndClearBuffers");
|
|
4284
4303
|
await this.sourceBufferController.clear();
|
|
4285
|
-
(0,
|
|
4304
|
+
(0, import_vinyl_util46.logVerbose)(this, "finishAndClearBuffers complete");
|
|
4286
4305
|
});
|
|
4287
|
-
this.logPrefix = (0,
|
|
4306
|
+
this.logPrefix = (0, import_vinyl_util46.createLogPrefix)(`Buffering_${contentType2}`);
|
|
4288
4307
|
this.options = __spreadValues(__spreadValues({}, defaultBufferingControllerOptions), options);
|
|
4289
|
-
(0,
|
|
4308
|
+
(0, import_vinyl_util46.logDebug)(this, "constructed", this.options);
|
|
4290
4309
|
this.mediaSourceController = deps.mediaSourceController;
|
|
4291
4310
|
this.playbackController = deps.playbackController;
|
|
4292
4311
|
this.segmentController = deps.segmentController;
|
|
@@ -4303,8 +4322,8 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4303
4322
|
activate() {
|
|
4304
4323
|
if (this._active) return;
|
|
4305
4324
|
this._active = true;
|
|
4306
|
-
(0,
|
|
4307
|
-
this.activateDisposer = (0,
|
|
4325
|
+
(0, import_vinyl_util46.logDebug)(this, "activate");
|
|
4326
|
+
this.activateDisposer = (0, import_vinyl_util46.createDisposer)();
|
|
4308
4327
|
const { add } = this.activateDisposer;
|
|
4309
4328
|
this.sourceBufferController = add(
|
|
4310
4329
|
this.deps.sourceBufferControllerFactory()
|
|
@@ -4317,7 +4336,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4317
4336
|
})
|
|
4318
4337
|
);
|
|
4319
4338
|
const onMediaSourceOpen2 = () => {
|
|
4320
|
-
(0,
|
|
4339
|
+
(0, import_vinyl_util46.logDebug)(this, "media source opened");
|
|
4321
4340
|
this.pollBufferImmediate();
|
|
4322
4341
|
};
|
|
4323
4342
|
if (this.mediaSourceOpen) {
|
|
@@ -4334,7 +4353,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4334
4353
|
}
|
|
4335
4354
|
deactivate() {
|
|
4336
4355
|
if (!this._active) return;
|
|
4337
|
-
(0,
|
|
4356
|
+
(0, import_vinyl_util46.logDebug)(this, "deactivate");
|
|
4338
4357
|
this.abortCurrentSegment();
|
|
4339
4358
|
this.resetBufferedState();
|
|
4340
4359
|
this.activateDisposer.dispose();
|
|
@@ -4344,10 +4363,10 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4344
4363
|
}
|
|
4345
4364
|
reset() {
|
|
4346
4365
|
if (!this._error) {
|
|
4347
|
-
(0,
|
|
4366
|
+
(0, import_vinyl_util46.logDebug)(this, "reset no-op");
|
|
4348
4367
|
return;
|
|
4349
4368
|
}
|
|
4350
|
-
(0,
|
|
4369
|
+
(0, import_vinyl_util46.logDebug)(this, "reset");
|
|
4351
4370
|
this._error = null;
|
|
4352
4371
|
this.pollBufferImmediate();
|
|
4353
4372
|
}
|
|
@@ -4377,7 +4396,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4377
4396
|
}
|
|
4378
4397
|
async appendNext() {
|
|
4379
4398
|
var _a;
|
|
4380
|
-
(0,
|
|
4399
|
+
(0, import_vinyl_util46.logVerbose)(this, "appendNext");
|
|
4381
4400
|
const sourceBufferController = this.sourceBufferController;
|
|
4382
4401
|
const time = this.playbackController.currentTime;
|
|
4383
4402
|
const tail = this.tail;
|
|
@@ -4391,7 +4410,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4391
4410
|
(_a = tail == null ? void 0 : tail.endTime) != null ? _a : time - SEGMENT_START_AFFORDANCE,
|
|
4392
4411
|
this.segmentAbort.value
|
|
4393
4412
|
);
|
|
4394
|
-
(0,
|
|
4413
|
+
(0, import_vinyl_util46.logVerbose)(this, "streamingSegment", streamingSegment);
|
|
4395
4414
|
if (streamingSegment) this.appendOffset = 0;
|
|
4396
4415
|
}
|
|
4397
4416
|
if (!streamingSegment) {
|
|
@@ -4434,7 +4453,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4434
4453
|
this.buffered.push(streamingSegment);
|
|
4435
4454
|
}
|
|
4436
4455
|
this.appendOffset = newOffset;
|
|
4437
|
-
(0,
|
|
4456
|
+
(0, import_vinyl_util46.logVerbose)(
|
|
4438
4457
|
this,
|
|
4439
4458
|
`appended chunk, this.appendOffset: ${this.appendOffset}`
|
|
4440
4459
|
);
|
|
@@ -4444,7 +4463,6 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4444
4463
|
this.buffered.push(streamingSegment);
|
|
4445
4464
|
}
|
|
4446
4465
|
if (!tail) this.refreshHead();
|
|
4447
|
-
this.setHasData(true);
|
|
4448
4466
|
}
|
|
4449
4467
|
abortCurrentSegment() {
|
|
4450
4468
|
this.segmentAbort.abort();
|
|
@@ -4482,7 +4500,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4482
4500
|
const previous = this._bufferingQuality;
|
|
4483
4501
|
if ((value == null ? void 0 : value.qualityId) === (previous == null ? void 0 : previous.qualityId)) return;
|
|
4484
4502
|
this._bufferingQuality = value;
|
|
4485
|
-
(0,
|
|
4503
|
+
(0, import_vinyl_util46.logDebug)(this, "bufferingQualityChange", value);
|
|
4486
4504
|
this.dispatch("bufferingQualityChange", {
|
|
4487
4505
|
previous,
|
|
4488
4506
|
current: value
|
|
@@ -4496,7 +4514,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4496
4514
|
const previous = this._playbackQuality;
|
|
4497
4515
|
if ((value == null ? void 0 : value.qualityId) === (previous == null ? void 0 : previous.qualityId)) return;
|
|
4498
4516
|
this._playbackQuality = value;
|
|
4499
|
-
(0,
|
|
4517
|
+
(0, import_vinyl_util46.logDebug)(this, "playbackQualityChange", value);
|
|
4500
4518
|
this.dispatch("playbackQualityChange", {
|
|
4501
4519
|
previous,
|
|
4502
4520
|
current: value
|
|
@@ -4528,15 +4546,6 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4528
4546
|
get bufferingEnded() {
|
|
4529
4547
|
return this._bufferingEnded;
|
|
4530
4548
|
}
|
|
4531
|
-
get hasData() {
|
|
4532
|
-
return this._hasData;
|
|
4533
|
-
}
|
|
4534
|
-
setHasData(value) {
|
|
4535
|
-
if (this._hasData === value) return;
|
|
4536
|
-
const previous = this._hasData;
|
|
4537
|
-
this._hasData = value;
|
|
4538
|
-
this.dispatch("hasDataChange", { previous, current: value });
|
|
4539
|
-
}
|
|
4540
4549
|
/**
|
|
4541
4550
|
* Attempts to recover from a SourceBuffer decode/append failure caused by a
|
|
4542
4551
|
* codec the browser reported as supported but cannot actually decode.
|
|
@@ -4557,7 +4566,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4557
4566
|
const contentType2 = quality == null ? void 0 : quality.contentType;
|
|
4558
4567
|
if (!mimeType || !contentType2) return false;
|
|
4559
4568
|
if (!denylistCodecsFromMimeType(mimeType)) return false;
|
|
4560
|
-
(0,
|
|
4569
|
+
(0, import_vinyl_util46.logWarn)(
|
|
4561
4570
|
this,
|
|
4562
4571
|
"SourceBuffer append failed; denylisting codec and requesting reload:",
|
|
4563
4572
|
mimeType
|
|
@@ -4591,7 +4600,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4591
4600
|
*/
|
|
4592
4601
|
clear() {
|
|
4593
4602
|
if (!this.active) return;
|
|
4594
|
-
(0,
|
|
4603
|
+
(0, import_vinyl_util46.logDebug)(this, "clear");
|
|
4595
4604
|
this.abortCurrentSegment();
|
|
4596
4605
|
this.queue.enqueue(this.finishAndClearBuffers).catch(this.handleError).finally(() => {
|
|
4597
4606
|
this.resetBufferedState();
|
|
@@ -4599,7 +4608,7 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4599
4608
|
});
|
|
4600
4609
|
}
|
|
4601
4610
|
endBuffering() {
|
|
4602
|
-
(0,
|
|
4611
|
+
(0, import_vinyl_util46.logDebug)(this, "bufferingEnded");
|
|
4603
4612
|
this._bufferingEnded = true;
|
|
4604
4613
|
this.bufferingQuality = null;
|
|
4605
4614
|
this.dispatch("bufferingEnded", {});
|
|
@@ -4611,7 +4620,6 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4611
4620
|
this._bufferingEnded = false;
|
|
4612
4621
|
this.bufferingQuality = null;
|
|
4613
4622
|
this.playbackQuality = null;
|
|
4614
|
-
this.setHasData(false);
|
|
4615
4623
|
}
|
|
4616
4624
|
get disposed() {
|
|
4617
4625
|
return this.disposer.disposed;
|
|
@@ -4624,15 +4632,15 @@ var BufferingControllerImpl = class extends import_vinyl_util50.EventHostImpl {
|
|
|
4624
4632
|
};
|
|
4625
4633
|
|
|
4626
4634
|
// src/streaming/buffering/MediaSourceController.ts
|
|
4627
|
-
var
|
|
4635
|
+
var import_vinyl_util49 = require("@amazon/vinyl-util");
|
|
4628
4636
|
|
|
4629
4637
|
// src/util/media/sourceBuffer.ts
|
|
4630
|
-
var
|
|
4631
|
-
var
|
|
4638
|
+
var import_vinyl_util47 = require("@amazon/vinyl-util");
|
|
4639
|
+
var import_vinyl_util48 = require("@amazon/vinyl-util");
|
|
4632
4640
|
function nextSourceBufferIdle(sourceBuffer) {
|
|
4633
4641
|
if (!sourceBuffer) return Promise.resolve();
|
|
4634
4642
|
if (!sourceBuffer.updating) return Promise.resolve();
|
|
4635
|
-
return (0,
|
|
4643
|
+
return (0, import_vinyl_util47.promise)((resolve, reject) => {
|
|
4636
4644
|
const removeListeners = () => {
|
|
4637
4645
|
sourceBuffer.removeEventListener("error", onErred);
|
|
4638
4646
|
sourceBuffer.removeEventListener("abort", onAborted);
|
|
@@ -4648,7 +4656,7 @@ function nextSourceBufferIdle(sourceBuffer) {
|
|
|
4648
4656
|
};
|
|
4649
4657
|
const onAborted = () => {
|
|
4650
4658
|
removeListeners();
|
|
4651
|
-
reject(new
|
|
4659
|
+
reject(new import_vinyl_util48.AbortError());
|
|
4652
4660
|
};
|
|
4653
4661
|
sourceBuffer.addEventListener("error", onErred);
|
|
4654
4662
|
sourceBuffer.addEventListener("abort", onAborted);
|
|
@@ -4658,7 +4666,7 @@ function nextSourceBufferIdle(sourceBuffer) {
|
|
|
4658
4666
|
|
|
4659
4667
|
// src/streaming/buffering/MediaSourceController.ts
|
|
4660
4668
|
var DURATION_PADDING = 0.1;
|
|
4661
|
-
var MediaSourceControllerImpl = class extends
|
|
4669
|
+
var MediaSourceControllerImpl = class extends import_vinyl_util49.EventHostImpl {
|
|
4662
4670
|
constructor(deps) {
|
|
4663
4671
|
super();
|
|
4664
4672
|
__publicField(this, "deps", deps);
|
|
@@ -4674,7 +4682,7 @@ var MediaSourceControllerImpl = class extends import_vinyl_util53.EventHostImpl
|
|
|
4674
4682
|
*/
|
|
4675
4683
|
__publicField(this, "durationToken", 0);
|
|
4676
4684
|
__publicField(this, "errorHandler", (error) => {
|
|
4677
|
-
if ((0,
|
|
4685
|
+
if ((0, import_vinyl_util49.isSilentError)(error)) return;
|
|
4678
4686
|
this.dispatch("error", {
|
|
4679
4687
|
target: this,
|
|
4680
4688
|
error
|
|
@@ -4695,12 +4703,12 @@ var MediaSourceControllerImpl = class extends import_vinyl_util53.EventHostImpl
|
|
|
4695
4703
|
return this.activateDisposer != null;
|
|
4696
4704
|
}
|
|
4697
4705
|
activate() {
|
|
4698
|
-
this.activateDisposer = (0,
|
|
4706
|
+
this.activateDisposer = (0, import_vinyl_util49.createDisposer)();
|
|
4699
4707
|
const add = this.activateDisposer.add;
|
|
4700
4708
|
const mediaSource = this.deps.mediaSourceFactory();
|
|
4701
4709
|
this.mediaSource = mediaSource;
|
|
4702
4710
|
const domEvents = add(
|
|
4703
|
-
new
|
|
4711
|
+
new import_vinyl_util49.DomEventHost(mediaSource)
|
|
4704
4712
|
);
|
|
4705
4713
|
domEvents.on("sourceopen", () => {
|
|
4706
4714
|
this.refreshDuration().catch(this.errorHandler);
|
|
@@ -4714,7 +4722,7 @@ var MediaSourceControllerImpl = class extends import_vinyl_util53.EventHostImpl
|
|
|
4714
4722
|
"sourceOpen",
|
|
4715
4723
|
"sourceEnded"
|
|
4716
4724
|
]) {
|
|
4717
|
-
domEvents.on((0,
|
|
4725
|
+
domEvents.on((0, import_vinyl_util49.toLowerCase)(key), () => this.dispatch(key, {}));
|
|
4718
4726
|
}
|
|
4719
4727
|
add(
|
|
4720
4728
|
this.deps.mediaTimelineTransformed.onData(() => {
|
|
@@ -4743,7 +4751,7 @@ var MediaSourceControllerImpl = class extends import_vinyl_util53.EventHostImpl
|
|
|
4743
4751
|
try {
|
|
4744
4752
|
URL.revokeObjectURL(this.objectUrl);
|
|
4745
4753
|
} catch (error) {
|
|
4746
|
-
(0,
|
|
4754
|
+
(0, import_vinyl_util49.logWarn)(this, "error revoking object url", error);
|
|
4747
4755
|
}
|
|
4748
4756
|
}
|
|
4749
4757
|
get sourceBufferCount() {
|
|
@@ -4764,9 +4772,9 @@ var MediaSourceControllerImpl = class extends import_vinyl_util53.EventHostImpl
|
|
|
4764
4772
|
const duration = await timeline.getDuration();
|
|
4765
4773
|
const value = duration === Infinity ? LIVE_DURATION : duration + DURATION_PADDING;
|
|
4766
4774
|
await Promise.all(Array.from(this.sourceBuffers, nextSourceBufferIdle));
|
|
4767
|
-
if (token !== this.durationToken || mediaSource.readyState !== "open" || (0,
|
|
4775
|
+
if (token !== this.durationToken || mediaSource.readyState !== "open" || (0, import_vinyl_util49.closeTo)(mediaSource.duration, value, 0.1))
|
|
4768
4776
|
return;
|
|
4769
|
-
(0,
|
|
4777
|
+
(0, import_vinyl_util49.logDebug)(this, `setting duration: ${value}`);
|
|
4770
4778
|
mediaSource.duration = value;
|
|
4771
4779
|
this.durationSet = true;
|
|
4772
4780
|
this.checkReady();
|
|
@@ -4777,12 +4785,12 @@ var MediaSourceControllerImpl = class extends import_vinyl_util53.EventHostImpl
|
|
|
4777
4785
|
}
|
|
4778
4786
|
createSourceBuffer(contentType2, mimeType) {
|
|
4779
4787
|
if (!this.active) {
|
|
4780
|
-
throw new
|
|
4788
|
+
throw new import_vinyl_util49.IllegalStateError(
|
|
4781
4789
|
"cannot create a source buffer when not active"
|
|
4782
4790
|
);
|
|
4783
4791
|
}
|
|
4784
4792
|
const mediaSource = this.mediaSource;
|
|
4785
|
-
(0,
|
|
4793
|
+
(0, import_vinyl_util49.logDebug)(
|
|
4786
4794
|
this,
|
|
4787
4795
|
"create source buffer",
|
|
4788
4796
|
contentType2,
|
|
@@ -4803,7 +4811,7 @@ var MediaSourceControllerImpl = class extends import_vinyl_util53.EventHostImpl
|
|
|
4803
4811
|
return {
|
|
4804
4812
|
value: sourceBuffer,
|
|
4805
4813
|
dispose: () => {
|
|
4806
|
-
(0,
|
|
4814
|
+
(0, import_vinyl_util49.logDebug)(
|
|
4807
4815
|
this,
|
|
4808
4816
|
"removing source buffer from media source",
|
|
4809
4817
|
mediaSource.readyState
|
|
@@ -4817,7 +4825,7 @@ var MediaSourceControllerImpl = class extends import_vinyl_util53.EventHostImpl
|
|
|
4817
4825
|
}
|
|
4818
4826
|
endOfStream(error) {
|
|
4819
4827
|
var _a;
|
|
4820
|
-
(0,
|
|
4828
|
+
(0, import_vinyl_util49.logDebug)(this, "endOfStream, error:", error);
|
|
4821
4829
|
(_a = this.mediaSource) == null ? void 0 : _a.endOfStream(error);
|
|
4822
4830
|
}
|
|
4823
4831
|
get readyToAppend() {
|
|
@@ -4829,9 +4837,9 @@ var MediaSourceControllerImpl = class extends import_vinyl_util53.EventHostImpl
|
|
|
4829
4837
|
this.deactivate();
|
|
4830
4838
|
}
|
|
4831
4839
|
};
|
|
4832
|
-
var MediaSourceError = class _MediaSourceError extends
|
|
4840
|
+
var MediaSourceError = class _MediaSourceError extends import_vinyl_util49.ReportableError {
|
|
4833
4841
|
constructor(message, reason) {
|
|
4834
|
-
super(message,
|
|
4842
|
+
super(message, import_vinyl_util49.ErrorOrigin.INTERNAL, import_vinyl_util49.ErrorLevel.FATAL);
|
|
4835
4843
|
__publicField(this, "reason", reason);
|
|
4836
4844
|
Object.setPrototypeOf(this, _MediaSourceError.prototype);
|
|
4837
4845
|
}
|
|
@@ -4840,13 +4848,13 @@ var MediaSourceError = class _MediaSourceError extends import_vinyl_util53.Repor
|
|
|
4840
4848
|
}
|
|
4841
4849
|
toJSON() {
|
|
4842
4850
|
return __spreadProps(__spreadValues({}, super.toJSON()), {
|
|
4843
|
-
reason: (0,
|
|
4851
|
+
reason: (0, import_vinyl_util49.toJson)(this.reason)
|
|
4844
4852
|
});
|
|
4845
4853
|
}
|
|
4846
4854
|
};
|
|
4847
4855
|
|
|
4848
4856
|
// src/streaming/buffering/SourceBufferController.ts
|
|
4849
|
-
var
|
|
4857
|
+
var import_vinyl_util50 = require("@amazon/vinyl-util");
|
|
4850
4858
|
var APPEND_WINDOW_START_OFFSET = 0.05;
|
|
4851
4859
|
var APPEND_WINDOW_END_OFFSET = 0.01;
|
|
4852
4860
|
var READY_TO_APPEND_TIMEOUT = 30;
|
|
@@ -4855,7 +4863,7 @@ var SourceBufferControllerImpl = class {
|
|
|
4855
4863
|
__publicField(this, "contentType", contentType2);
|
|
4856
4864
|
__publicField(this, "sourceBufferRef", null);
|
|
4857
4865
|
__publicField(this, "mimeType", null);
|
|
4858
|
-
__publicField(this, "queue", /* @__PURE__ */ (0,
|
|
4866
|
+
__publicField(this, "queue", /* @__PURE__ */ (0, import_vinyl_util50.createTaskQueue)());
|
|
4859
4867
|
// Assigned in the constructor body: a field initializer runs before the
|
|
4860
4868
|
// contentType param-property, so it would capture `undefined`.
|
|
4861
4869
|
__publicField(this, "logPrefix");
|
|
@@ -4872,8 +4880,8 @@ var SourceBufferControllerImpl = class {
|
|
|
4872
4880
|
* @private
|
|
4873
4881
|
*/
|
|
4874
4882
|
__publicField(this, "nextIdle", () => nextSourceBufferIdle(this.sourceBuffer).finally(this.clearBufferedCache));
|
|
4875
|
-
this.logPrefix = (0,
|
|
4876
|
-
(0,
|
|
4883
|
+
this.logPrefix = (0, import_vinyl_util50.createLogPrefix)(`SourceBuffer_${contentType2}`);
|
|
4884
|
+
(0, import_vinyl_util50.logDebug)(this, "constructed, contentType:", contentType2);
|
|
4877
4885
|
this.mediaSourceController = deps.mediaSourceController;
|
|
4878
4886
|
}
|
|
4879
4887
|
get [Symbol.toStringTag]() {
|
|
@@ -4884,9 +4892,9 @@ var SourceBufferControllerImpl = class {
|
|
|
4884
4892
|
}
|
|
4885
4893
|
get buffered() {
|
|
4886
4894
|
if (this._buffered == null) {
|
|
4887
|
-
if (!this.sourceBuffer) this._buffered =
|
|
4895
|
+
if (!this.sourceBuffer) this._buffered = import_vinyl_util50.emptyRanges;
|
|
4888
4896
|
else
|
|
4889
|
-
this._buffered = (0,
|
|
4897
|
+
this._buffered = (0, import_vinyl_util50.createTimeRangesReader)(
|
|
4890
4898
|
this.sourceBuffer.buffered
|
|
4891
4899
|
);
|
|
4892
4900
|
}
|
|
@@ -4903,7 +4911,7 @@ var SourceBufferControllerImpl = class {
|
|
|
4903
4911
|
var _a;
|
|
4904
4912
|
if (this.mimeType !== mimeType) {
|
|
4905
4913
|
if (this.sourceBuffer && "changeType" in this.sourceBuffer) {
|
|
4906
|
-
(0,
|
|
4914
|
+
(0, import_vinyl_util50.logDebug)(this, "changeType", mimeType);
|
|
4907
4915
|
this.sourceBuffer.changeType(mimeType);
|
|
4908
4916
|
} else {
|
|
4909
4917
|
(_a = this.sourceBufferRef) == null ? void 0 : _a.dispose();
|
|
@@ -4912,7 +4920,7 @@ var SourceBufferControllerImpl = class {
|
|
|
4912
4920
|
mimeType
|
|
4913
4921
|
);
|
|
4914
4922
|
if (!this.mediaSourceController.readyToAppend)
|
|
4915
|
-
await (0,
|
|
4923
|
+
await (0, import_vinyl_util50.nextEventAsPromise)(
|
|
4916
4924
|
this.mediaSourceController,
|
|
4917
4925
|
"readyToAppend",
|
|
4918
4926
|
{ timeout: READY_TO_APPEND_TIMEOUT, abort }
|
|
@@ -4925,34 +4933,34 @@ var SourceBufferControllerImpl = class {
|
|
|
4925
4933
|
this.mimeType = mimeType;
|
|
4926
4934
|
}
|
|
4927
4935
|
const sourceBuffer = this.sourceBuffer;
|
|
4928
|
-
(0,
|
|
4936
|
+
(0, import_vinyl_util50.logDebug)(this, `appending init ${data3.byteLength} bytes`);
|
|
4929
4937
|
sourceBuffer.appendBuffer(data3);
|
|
4930
4938
|
await this.nextIdle();
|
|
4931
|
-
(0,
|
|
4939
|
+
(0, import_vinyl_util50.logDebug)(this, "appended init");
|
|
4932
4940
|
});
|
|
4933
4941
|
}
|
|
4934
4942
|
async append(data3) {
|
|
4935
4943
|
return this.queue.enqueue(async () => {
|
|
4936
|
-
(0,
|
|
4944
|
+
(0, import_vinyl_util50.logDebug)(this, `appending ${data3.byteLength} bytes`);
|
|
4937
4945
|
const sourceBuffer = this.sourceBuffer;
|
|
4938
4946
|
if (!sourceBuffer)
|
|
4939
4947
|
throw new SourceBufferError(
|
|
4940
4948
|
"media segment provided before init segment",
|
|
4941
|
-
|
|
4949
|
+
import_vinyl_util50.ErrorOrigin.INTERNAL
|
|
4942
4950
|
);
|
|
4943
4951
|
sourceBuffer.appendBuffer(data3);
|
|
4944
4952
|
await this.nextIdle();
|
|
4945
|
-
(0,
|
|
4953
|
+
(0, import_vinyl_util50.logDebug)(this, "appended", this.buffered);
|
|
4946
4954
|
});
|
|
4947
4955
|
}
|
|
4948
4956
|
setTimestampOffset(timestampOffset) {
|
|
4949
4957
|
return this.queue.enqueue(() => {
|
|
4950
4958
|
const sourceBuffer = this.sourceBuffer;
|
|
4951
4959
|
if (!sourceBuffer)
|
|
4952
|
-
throw new
|
|
4960
|
+
throw new import_vinyl_util50.IllegalStateError(
|
|
4953
4961
|
"source buffer must be initialized before setting timestamp offset"
|
|
4954
4962
|
);
|
|
4955
|
-
(0,
|
|
4963
|
+
(0, import_vinyl_util50.logDebug)(this, "timestampOffset:", timestampOffset.toFixed(4));
|
|
4956
4964
|
sourceBuffer.timestampOffset = timestampOffset;
|
|
4957
4965
|
});
|
|
4958
4966
|
}
|
|
@@ -4960,7 +4968,7 @@ var SourceBufferControllerImpl = class {
|
|
|
4960
4968
|
return this.queue.enqueue(() => {
|
|
4961
4969
|
const sourceBuffer = this.sourceBuffer;
|
|
4962
4970
|
if (!sourceBuffer)
|
|
4963
|
-
throw new
|
|
4971
|
+
throw new import_vinyl_util50.IllegalStateError(
|
|
4964
4972
|
"source buffer must be initialized before setting append window"
|
|
4965
4973
|
);
|
|
4966
4974
|
const finalAppendWindowStart = Math.max(
|
|
@@ -4968,7 +4976,7 @@ var SourceBufferControllerImpl = class {
|
|
|
4968
4976
|
appendWindowStart - APPEND_WINDOW_START_OFFSET
|
|
4969
4977
|
);
|
|
4970
4978
|
const finalAppendWindowEnd = appendWindowEnd + APPEND_WINDOW_END_OFFSET;
|
|
4971
|
-
(0,
|
|
4979
|
+
(0, import_vinyl_util50.logDebug)(
|
|
4972
4980
|
this,
|
|
4973
4981
|
"appendWindow:",
|
|
4974
4982
|
finalAppendWindowStart.toFixed(4),
|
|
@@ -4983,10 +4991,10 @@ var SourceBufferControllerImpl = class {
|
|
|
4983
4991
|
return this.queue.enqueue(async () => {
|
|
4984
4992
|
var _a;
|
|
4985
4993
|
if (endTime > startTime) {
|
|
4986
|
-
(0,
|
|
4994
|
+
(0, import_vinyl_util50.logDebug)(this, `removing range: ${startTime}-${endTime}`);
|
|
4987
4995
|
(_a = this.sourceBuffer) == null ? void 0 : _a.remove(startTime, endTime);
|
|
4988
4996
|
await this.nextIdle();
|
|
4989
|
-
(0,
|
|
4997
|
+
(0, import_vinyl_util50.logDebug)(this, "removed, new buffered:", this.buffered);
|
|
4990
4998
|
}
|
|
4991
4999
|
});
|
|
4992
5000
|
}
|
|
@@ -4998,7 +5006,7 @@ var SourceBufferControllerImpl = class {
|
|
|
4998
5006
|
*/
|
|
4999
5007
|
dispose() {
|
|
5000
5008
|
var _a;
|
|
5001
|
-
(0,
|
|
5009
|
+
(0, import_vinyl_util50.logDebug)(this, "dispose");
|
|
5002
5010
|
this.queue.abort();
|
|
5003
5011
|
(_a = this.sourceBufferRef) == null ? void 0 : _a.dispose();
|
|
5004
5012
|
this.sourceBufferRef = null;
|
|
@@ -5006,35 +5014,34 @@ var SourceBufferControllerImpl = class {
|
|
|
5006
5014
|
};
|
|
5007
5015
|
|
|
5008
5016
|
// src/streaming/ContentStream.ts
|
|
5009
|
-
var
|
|
5017
|
+
var import_vinyl_util51 = require("@amazon/vinyl-util");
|
|
5010
5018
|
var import_vinyl_di = require("@amazon/vinyl-di");
|
|
5011
|
-
var ContentStreamImpl = class extends
|
|
5019
|
+
var ContentStreamImpl = class extends import_vinyl_util51.EventHostImpl {
|
|
5012
5020
|
constructor(dependencyFactories, contentType2) {
|
|
5013
5021
|
super();
|
|
5014
5022
|
__publicField(this, "contentType", contentType2);
|
|
5015
5023
|
// Assigned in the constructor body: a field initializer runs before the
|
|
5016
5024
|
// contentType param-property, so it would capture `undefined`.
|
|
5017
5025
|
__publicField(this, "logPrefix");
|
|
5018
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
5026
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util51.createDisposer)());
|
|
5019
5027
|
__publicField(this, "segmentController");
|
|
5020
5028
|
__publicField(this, "bufferingController");
|
|
5021
|
-
this.logPrefix = (0,
|
|
5029
|
+
this.logPrefix = (0, import_vinyl_util51.createLogPrefix)(`ContentStream_${contentType2}`);
|
|
5022
5030
|
const { add } = this.disposer;
|
|
5023
5031
|
const deps = add((0, import_vinyl_di.createContainer)(dependencyFactories)).dependencies;
|
|
5024
5032
|
this.segmentController = deps.segmentController;
|
|
5025
|
-
(0,
|
|
5033
|
+
(0, import_vinyl_util51.redispatchEvents)(this, this.segmentController, [
|
|
5026
5034
|
"fetchedRangesChange",
|
|
5027
5035
|
"loadSpanMeasured"
|
|
5028
5036
|
]);
|
|
5029
5037
|
this.bufferingController = deps.bufferingController;
|
|
5030
|
-
(0,
|
|
5038
|
+
(0, import_vinyl_util51.redispatchEvents)(this, this.segmentController, [
|
|
5031
5039
|
"streamingQualityChange"
|
|
5032
5040
|
]);
|
|
5033
|
-
(0,
|
|
5041
|
+
(0, import_vinyl_util51.redispatchEvents)(this, this.bufferingController, [
|
|
5034
5042
|
"bufferingQualityChange",
|
|
5035
5043
|
"playbackQualityChange",
|
|
5036
5044
|
"bufferingEnded",
|
|
5037
|
-
"hasDataChange",
|
|
5038
5045
|
"error",
|
|
5039
5046
|
"codecUnsupported"
|
|
5040
5047
|
]);
|
|
@@ -5064,9 +5071,6 @@ var ContentStreamImpl = class extends import_vinyl_util55.EventHostImpl {
|
|
|
5064
5071
|
var _a;
|
|
5065
5072
|
return (_a = this.bufferingController.playbackQuality) != null ? _a : null;
|
|
5066
5073
|
}
|
|
5067
|
-
get hasData() {
|
|
5068
|
-
return this.bufferingController.hasData;
|
|
5069
|
-
}
|
|
5070
5074
|
get bufferingEnded() {
|
|
5071
5075
|
return this.bufferingController.bufferingEnded;
|
|
5072
5076
|
}
|
|
@@ -5080,7 +5084,7 @@ var ContentStreamImpl = class extends import_vinyl_util55.EventHostImpl {
|
|
|
5080
5084
|
* for example, changing streaming quality from SD to HD.
|
|
5081
5085
|
*/
|
|
5082
5086
|
clearPrefetch() {
|
|
5083
|
-
(0,
|
|
5087
|
+
(0, import_vinyl_util51.logDebug)(this, "clearPrefetch");
|
|
5084
5088
|
this.segmentController.clear();
|
|
5085
5089
|
this.bufferingController.clear();
|
|
5086
5090
|
}
|
|
@@ -5094,7 +5098,7 @@ var ContentStreamImpl = class extends import_vinyl_util55.EventHostImpl {
|
|
|
5094
5098
|
}
|
|
5095
5099
|
activate(options) {
|
|
5096
5100
|
var _a;
|
|
5097
|
-
(0,
|
|
5101
|
+
(0, import_vinyl_util51.logDebug)(this, "activate");
|
|
5098
5102
|
this.segmentController.configure({
|
|
5099
5103
|
startTime: (_a = options.startTime) != null ? _a : 0
|
|
5100
5104
|
});
|
|
@@ -5144,16 +5148,102 @@ function filterContentTypes(contentTypes, allowedContentTypes) {
|
|
|
5144
5148
|
// src/streaming/createDefaultMediaTimelineTransformer.ts
|
|
5145
5149
|
var import_vinyl_observable2 = require("@amazon/vinyl-observable");
|
|
5146
5150
|
|
|
5151
|
+
// src/streaming/MediaQualityMetadata.ts
|
|
5152
|
+
var import_vinyl_util53 = require("@amazon/vinyl-util");
|
|
5153
|
+
var import_vinyl_validation10 = require("@amazon/vinyl-validation");
|
|
5154
|
+
|
|
5155
|
+
// src/streaming/DescriptorRecord.ts
|
|
5156
|
+
var import_vinyl_validation9 = require("@amazon/vinyl-validation");
|
|
5157
|
+
var import_vinyl_util52 = require("@amazon/vinyl-util");
|
|
5158
|
+
function getDescriptorValue(record4, uri, id) {
|
|
5159
|
+
var _a, _b;
|
|
5160
|
+
let arr = record4[uri];
|
|
5161
|
+
if (!arr) return null;
|
|
5162
|
+
if (id !== void 0) arr = arr.filter((descriptor) => descriptor.id === id);
|
|
5163
|
+
return (_b = (_a = (0, import_vinyl_util52.first)(arr)) == null ? void 0 : _a.value) != null ? _b : null;
|
|
5164
|
+
}
|
|
5165
|
+
var descriptorValidator = /* @__PURE__ */ (0, import_vinyl_validation9.object)({
|
|
5166
|
+
id: /* @__PURE__ */ (0, import_vinyl_validation9.string)().maybe().optional(),
|
|
5167
|
+
value: /* @__PURE__ */ (0, import_vinyl_validation9.string)().maybe().optional()
|
|
5168
|
+
});
|
|
5169
|
+
var descriptorRecordValidator = /* @__PURE__ */ (0, import_vinyl_validation9.record)(/* @__PURE__ */ (0, import_vinyl_validation9.string)(), /* @__PURE__ */ (0, import_vinyl_validation9.array)(descriptorValidator).readonly().orUndefined());
|
|
5170
|
+
|
|
5171
|
+
// src/streaming/MediaQualityMetadata.ts
|
|
5172
|
+
var ALL_CONTENT_TYPES = [
|
|
5173
|
+
"video",
|
|
5174
|
+
"audio",
|
|
5175
|
+
"text"
|
|
5176
|
+
];
|
|
5177
|
+
var RESTRICTABLE_CONTENT_TYPES = [
|
|
5178
|
+
"video",
|
|
5179
|
+
"audio"
|
|
5180
|
+
];
|
|
5181
|
+
var drmProtectionValidator = /* @__PURE__ */ descriptorValidator.extend({
|
|
5182
|
+
keySystem: /* @__PURE__ */ (0, import_vinyl_validation10.enumOf)(DrmKeySystem),
|
|
5183
|
+
pro: /* @__PURE__ */ (0, import_vinyl_validation10.string)().maybe().optional(),
|
|
5184
|
+
pssh: /* @__PURE__ */ (0, import_vinyl_validation10.string)().maybe().optional()
|
|
5185
|
+
});
|
|
5186
|
+
var mediaFormatMetadataValidator = /* @__PURE__ */ (0, import_vinyl_validation10.object)({
|
|
5187
|
+
contentProtections: /* @__PURE__ */ (0, import_vinyl_validation10.array)(drmProtectionValidator).readonly(),
|
|
5188
|
+
contentType: /* @__PURE__ */ (0, import_vinyl_validation10.isOneOf)("audio", "video", "text").orNull(),
|
|
5189
|
+
initDataType: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull(),
|
|
5190
|
+
encryptionScheme: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull(),
|
|
5191
|
+
mimeType: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull()
|
|
5192
|
+
});
|
|
5193
|
+
function createEmptyMediaFormatMetadata() {
|
|
5194
|
+
return {
|
|
5195
|
+
contentType: null,
|
|
5196
|
+
mimeType: null,
|
|
5197
|
+
initDataType: null,
|
|
5198
|
+
encryptionScheme: null,
|
|
5199
|
+
contentProtections: []
|
|
5200
|
+
};
|
|
5201
|
+
}
|
|
5202
|
+
function createEmptyMediaQualityMetadata() {
|
|
5203
|
+
return __spreadProps(__spreadValues({}, createEmptyMediaFormatMetadata()), {
|
|
5204
|
+
decoderId: (0, import_vinyl_util53.createShortUid)(),
|
|
5205
|
+
qualityId: (0, import_vinyl_util53.createShortUid)(),
|
|
5206
|
+
codecs: null,
|
|
5207
|
+
bandwidth: null,
|
|
5208
|
+
bandwidthTotal: null,
|
|
5209
|
+
supplementalProperties: {},
|
|
5210
|
+
audioSamplingRate: null,
|
|
5211
|
+
frameRate: null,
|
|
5212
|
+
height: null,
|
|
5213
|
+
width: null,
|
|
5214
|
+
lang: null,
|
|
5215
|
+
characteristics: [],
|
|
5216
|
+
groupId: (0, import_vinyl_util53.createShortUid)(),
|
|
5217
|
+
switchingGroupIds: null
|
|
5218
|
+
});
|
|
5219
|
+
}
|
|
5220
|
+
var mediaQualityMetadataValidator = /* @__PURE__ */ mediaFormatMetadataValidator.extend({
|
|
5221
|
+
audioSamplingRate: /* @__PURE__ */ (0, import_vinyl_validation10.array)(/* @__PURE__ */ (0, import_vinyl_validation10.number)()).readonly().orNull(),
|
|
5222
|
+
bandwidth: /* @__PURE__ */ (0, import_vinyl_validation10.number)().orNull(),
|
|
5223
|
+
bandwidthTotal: /* @__PURE__ */ (0, import_vinyl_validation10.number)().orNull(),
|
|
5224
|
+
codecs: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull(),
|
|
5225
|
+
decoderId: /* @__PURE__ */ (0, import_vinyl_validation10.string)(),
|
|
5226
|
+
frameRate: /* @__PURE__ */ (0, import_vinyl_validation10.tuple)(/* @__PURE__ */ (0, import_vinyl_validation10.number)(), /* @__PURE__ */ (0, import_vinyl_validation10.number)()).readonly().orNull(),
|
|
5227
|
+
height: /* @__PURE__ */ (0, import_vinyl_validation10.number)().orNull(),
|
|
5228
|
+
qualityId: /* @__PURE__ */ (0, import_vinyl_validation10.string)(),
|
|
5229
|
+
supplementalProperties: descriptorRecordValidator,
|
|
5230
|
+
width: /* @__PURE__ */ (0, import_vinyl_validation10.number)().orNull(),
|
|
5231
|
+
lang: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull(),
|
|
5232
|
+
characteristics: /* @__PURE__ */ (0, import_vinyl_validation10.array)(/* @__PURE__ */ (0, import_vinyl_validation10.string)()).readonly(),
|
|
5233
|
+
groupId: /* @__PURE__ */ (0, import_vinyl_validation10.string)(),
|
|
5234
|
+
switchingGroupIds: /* @__PURE__ */ (0, import_vinyl_validation10.array)(/* @__PURE__ */ (0, import_vinyl_validation10.string)()).readonly().orNull()
|
|
5235
|
+
});
|
|
5236
|
+
|
|
5147
5237
|
// src/streaming/mediaTimelineFilter.ts
|
|
5148
|
-
var
|
|
5238
|
+
var import_vinyl_util56 = require("@amazon/vinyl-util");
|
|
5149
5239
|
|
|
5150
5240
|
// src/streaming/mediaTimelineLanguageFilter.ts
|
|
5151
|
-
var
|
|
5241
|
+
var import_vinyl_util55 = require("@amazon/vinyl-util");
|
|
5152
5242
|
|
|
5153
5243
|
// src/track/filters/languageFilter.ts
|
|
5154
|
-
var
|
|
5244
|
+
var import_vinyl_util54 = require("@amazon/vinyl-util");
|
|
5155
5245
|
function throwLanguagesUnsupported() {
|
|
5156
|
-
throw new
|
|
5246
|
+
throw new import_vinyl_util54.MediaUnsupportedError(
|
|
5157
5247
|
"No content matching preferred language",
|
|
5158
5248
|
"language"
|
|
5159
5249
|
);
|
|
@@ -5383,9 +5473,9 @@ function languageRelatedness(target, candidate) {
|
|
|
5383
5473
|
return 1;
|
|
5384
5474
|
}
|
|
5385
5475
|
function findBestLanguageMatch(target, available) {
|
|
5386
|
-
return (0,
|
|
5476
|
+
return (0, import_vinyl_util54.max)(
|
|
5387
5477
|
available,
|
|
5388
|
-
(0,
|
|
5478
|
+
(0, import_vinyl_util54.compareBy)((lang) => languageRelatedness(target, lang))
|
|
5389
5479
|
);
|
|
5390
5480
|
}
|
|
5391
5481
|
|
|
@@ -5409,7 +5499,7 @@ function createLanguageFilter(preferredLanguage, contentType2) {
|
|
|
5409
5499
|
}
|
|
5410
5500
|
return best;
|
|
5411
5501
|
};
|
|
5412
|
-
const bestScoreForPeriod = (0,
|
|
5502
|
+
const bestScoreForPeriod = (0, import_vinyl_util55.memoize)(
|
|
5413
5503
|
(array6) => {
|
|
5414
5504
|
let best = 0;
|
|
5415
5505
|
for (const quality of Array.from(array6)) {
|
|
@@ -5432,10 +5522,17 @@ function createLanguageFilter(preferredLanguage, contentType2) {
|
|
|
5432
5522
|
}
|
|
5433
5523
|
|
|
5434
5524
|
// src/streaming/mediaTimelineFilter.ts
|
|
5525
|
+
function assertMediaStreamsRetained(original, filtered, throwError) {
|
|
5526
|
+
for (const contentType2 of RESTRICTABLE_CONTENT_TYPES) {
|
|
5527
|
+
if (original.some((q) => q.metadata.contentType === contentType2) && !filtered.some((q) => q.metadata.contentType === contentType2)) {
|
|
5528
|
+
throwError();
|
|
5529
|
+
}
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5435
5532
|
function filterTimelineQualities(filter, throwError, timeline) {
|
|
5436
5533
|
if (!filter) return timeline;
|
|
5437
|
-
const mapMetadataArray = (0,
|
|
5438
|
-
(qualities) => (0,
|
|
5534
|
+
const mapMetadataArray = (0, import_vinyl_util56.memoize)(
|
|
5535
|
+
(qualities) => (0, import_vinyl_util56.map)(qualities, (q) => q.metadata),
|
|
5439
5536
|
(qualities) => qualities,
|
|
5440
5537
|
1
|
|
5441
5538
|
);
|
|
@@ -5443,16 +5540,14 @@ function filterTimelineQualities(filter, throwError, timeline) {
|
|
|
5443
5540
|
const filtered = period.qualities.filter(
|
|
5444
5541
|
(q, index) => filter(q.metadata, index, mapMetadataArray(period.qualities))
|
|
5445
5542
|
);
|
|
5543
|
+
assertMediaStreamsRetained(period.qualities, filtered, throwError);
|
|
5446
5544
|
return __spreadProps(__spreadValues({}, period), { qualities: filtered });
|
|
5447
5545
|
});
|
|
5448
|
-
if (periods.some((p) => p.qualities.length === 0)) {
|
|
5449
|
-
throwError();
|
|
5450
|
-
}
|
|
5451
5546
|
return __spreadProps(__spreadValues({}, timeline), { periods });
|
|
5452
5547
|
}
|
|
5453
5548
|
async function filterTimelineQualitiesAsync(filter, throwError, timeline) {
|
|
5454
|
-
const mapMetadataArray = (0,
|
|
5455
|
-
(qualities) => (0,
|
|
5549
|
+
const mapMetadataArray = (0, import_vinyl_util56.memoize)(
|
|
5550
|
+
(qualities) => (0, import_vinyl_util56.map)(qualities, (q) => q.metadata),
|
|
5456
5551
|
(qualities) => qualities,
|
|
5457
5552
|
1
|
|
5458
5553
|
);
|
|
@@ -5465,18 +5560,16 @@ async function filterTimelineQualitiesAsync(filter, throwError, timeline) {
|
|
|
5465
5560
|
filtered.push(period.qualities[i]);
|
|
5466
5561
|
}
|
|
5467
5562
|
}
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
if (periods.some((p) => p.qualities.length === 0)) {
|
|
5471
|
-
throwError();
|
|
5563
|
+
assertMediaStreamsRetained(period.qualities, filtered, throwError);
|
|
5564
|
+
periods.push(__spreadProps(__spreadValues({}, period), { qualities: filtered }));
|
|
5472
5565
|
}
|
|
5473
5566
|
return __spreadProps(__spreadValues({}, timeline), { periods });
|
|
5474
5567
|
}
|
|
5475
5568
|
|
|
5476
5569
|
// src/streaming/mediaTimelineAccessibilityFilter.ts
|
|
5477
|
-
var
|
|
5570
|
+
var import_vinyl_util57 = require("@amazon/vinyl-util");
|
|
5478
5571
|
function throwNoPlayableAudio() {
|
|
5479
|
-
throw new
|
|
5572
|
+
throw new import_vinyl_util57.MediaUnsupportedError("No playable audio rendition", "audio");
|
|
5480
5573
|
}
|
|
5481
5574
|
var AUDIO_DESCRIPTION_CHARACTERISTICS = [
|
|
5482
5575
|
"public.accessibility.describes-video",
|
|
@@ -5488,7 +5581,7 @@ function isAudioDescription(quality) {
|
|
|
5488
5581
|
);
|
|
5489
5582
|
}
|
|
5490
5583
|
function createAudioDescriptionFilter(preferDescription) {
|
|
5491
|
-
const periodFlags = (0,
|
|
5584
|
+
const periodFlags = (0, import_vinyl_util57.memoize)(
|
|
5492
5585
|
(array6) => {
|
|
5493
5586
|
let hasDescription = false;
|
|
5494
5587
|
let hasMain = false;
|
|
@@ -5515,9 +5608,9 @@ function createAudioDescriptionFilter(preferDescription) {
|
|
|
5515
5608
|
}
|
|
5516
5609
|
|
|
5517
5610
|
// src/track/filters/resourceTypeFilter.ts
|
|
5518
|
-
var
|
|
5611
|
+
var import_vinyl_util58 = require("@amazon/vinyl-util");
|
|
5519
5612
|
function throwMimeTypesUnsupported() {
|
|
5520
|
-
throw new
|
|
5613
|
+
throw new import_vinyl_util58.MediaUnsupportedError(
|
|
5521
5614
|
"No resource type supported (container/codec).",
|
|
5522
5615
|
"resource-type"
|
|
5523
5616
|
);
|
|
@@ -5528,9 +5621,9 @@ function canPlayMimeType(deps, metadata) {
|
|
|
5528
5621
|
}
|
|
5529
5622
|
|
|
5530
5623
|
// src/track/filters/keySystemFilter.ts
|
|
5531
|
-
var
|
|
5624
|
+
var import_vinyl_util59 = require("@amazon/vinyl-util");
|
|
5532
5625
|
function throwKeySystemsUnsupported() {
|
|
5533
|
-
throw new
|
|
5626
|
+
throw new import_vinyl_util59.MediaUnsupportedError("No key system supported.", "key-system");
|
|
5534
5627
|
}
|
|
5535
5628
|
async function canPlayKeySystem(deps, metadata) {
|
|
5536
5629
|
if (!metadata.contentProtections.length) return true;
|
|
@@ -5538,32 +5631,37 @@ async function canPlayKeySystem(deps, metadata) {
|
|
|
5538
5631
|
}
|
|
5539
5632
|
|
|
5540
5633
|
// src/track/filters/sampleRateFilter.ts
|
|
5541
|
-
var
|
|
5634
|
+
var import_vinyl_util60 = require("@amazon/vinyl-util");
|
|
5542
5635
|
function throwSamplingRatesUnsupported() {
|
|
5543
|
-
throw new
|
|
5544
|
-
}
|
|
5545
|
-
function
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
const samplingRate = (0,
|
|
5549
|
-
if (!samplingRate
|
|
5550
|
-
|
|
5636
|
+
throw new import_vinyl_util60.MediaUnsupportedError("No supported sample rate", "sampling-rate");
|
|
5637
|
+
}
|
|
5638
|
+
function withinAudioSampleRateRange(options, metadata, _index, array6) {
|
|
5639
|
+
var _a;
|
|
5640
|
+
if (metadata.contentType !== "audio") return true;
|
|
5641
|
+
const samplingRate = (0, import_vinyl_util60.last)(metadata.audioSamplingRate);
|
|
5642
|
+
if (!samplingRate) return true;
|
|
5643
|
+
const { minSampleRate } = options;
|
|
5644
|
+
const maxSampleRate = (_a = options.maxSampleRate) != null ? _a : options.capabilities.sampleRate;
|
|
5645
|
+
const audioRates = () => (0, import_vinyl_util60.map)(
|
|
5646
|
+
array6,
|
|
5647
|
+
(item) => item.contentType === "audio" ? (0, import_vinyl_util60.last)(item.audioSamplingRate) : void 0
|
|
5648
|
+
).filter((rate) => rate != null);
|
|
5649
|
+
const outOfBandFallback = () => {
|
|
5650
|
+
const rates = audioRates();
|
|
5651
|
+
const inBand = (rate) => (minSampleRate == null || rate >= minSampleRate) && (!maxSampleRate || rate <= maxSampleRate);
|
|
5652
|
+
if (rates.some(inBand)) return void 0;
|
|
5653
|
+
const decodable = maxSampleRate ? rates.filter((rate) => rate <= maxSampleRate) : rates;
|
|
5654
|
+
return decodable.length ? (0, import_vinyl_util60.max)(decodable) : (0, import_vinyl_util60.min)(rates);
|
|
5655
|
+
};
|
|
5656
|
+
if (minSampleRate != null && samplingRate < minSampleRate) {
|
|
5657
|
+
return samplingRate === outOfBandFallback();
|
|
5658
|
+
}
|
|
5659
|
+
if (!maxSampleRate) return true;
|
|
5660
|
+
if ((0, import_vinyl_util60.hasBrowser)(import_vinyl_util60.Browser.FIREFOX)) {
|
|
5551
5661
|
return samplingRate <= 48e3;
|
|
5552
5662
|
}
|
|
5553
5663
|
if (samplingRate <= maxSampleRate) return true;
|
|
5554
|
-
|
|
5555
|
-
const itemSamplingRate = (0, import_vinyl_util62.last)(item.audioSamplingRate);
|
|
5556
|
-
return itemSamplingRate != null && itemSamplingRate > maxSampleRate;
|
|
5557
|
-
});
|
|
5558
|
-
if (allAboveMax) {
|
|
5559
|
-
const samplingRates = (0, import_vinyl_util62.map)(
|
|
5560
|
-
array6,
|
|
5561
|
-
(item) => (0, import_vinyl_util62.last)(item.audioSamplingRate)
|
|
5562
|
-
).filter((rate) => rate != null);
|
|
5563
|
-
const lowestSamplingRate = (0, import_vinyl_util62.min)(samplingRates);
|
|
5564
|
-
return samplingRate === lowestSamplingRate;
|
|
5565
|
-
}
|
|
5566
|
-
return false;
|
|
5664
|
+
return samplingRate === outOfBandFallback();
|
|
5567
5665
|
}
|
|
5568
5666
|
|
|
5569
5667
|
// src/util/media/codecOverrides.ts
|
|
@@ -5599,8 +5697,8 @@ function createDefaultMediaTimelineTransformer(deps) {
|
|
|
5599
5697
|
return canPlayMimeType(deps, quality);
|
|
5600
5698
|
}
|
|
5601
5699
|
async function transformTimeline(timeline) {
|
|
5602
|
-
var _a, _b;
|
|
5603
|
-
const codecOverrides = deps.options.value
|
|
5700
|
+
var _a, _b, _c, _d;
|
|
5701
|
+
const { audio, codecOverrides } = deps.options.value;
|
|
5604
5702
|
let t = filterTimelineQualities(
|
|
5605
5703
|
(quality) => canPlayWithOverrides(quality, codecOverrides),
|
|
5606
5704
|
throwMimeTypesUnsupported,
|
|
@@ -5611,19 +5709,31 @@ function createDefaultMediaTimelineTransformer(deps) {
|
|
|
5611
5709
|
throwKeySystemsUnsupported,
|
|
5612
5710
|
t
|
|
5613
5711
|
);
|
|
5712
|
+
if (!audio.disableSampleRateFilter) {
|
|
5713
|
+
const sampleRateOptions = {
|
|
5714
|
+
capabilities: deps.capabilities,
|
|
5715
|
+
maxSampleRate: (_a = audio.maxSampleRate) != null ? _a : null,
|
|
5716
|
+
minSampleRate: (_b = audio.minSampleRate) != null ? _b : null
|
|
5717
|
+
};
|
|
5718
|
+
t = filterTimelineQualities(
|
|
5719
|
+
(quality, index, array6) => withinAudioSampleRateRange(
|
|
5720
|
+
sampleRateOptions,
|
|
5721
|
+
quality,
|
|
5722
|
+
index,
|
|
5723
|
+
array6
|
|
5724
|
+
),
|
|
5725
|
+
throwSamplingRatesUnsupported,
|
|
5726
|
+
t
|
|
5727
|
+
);
|
|
5728
|
+
}
|
|
5729
|
+
const selection = audio.selection;
|
|
5614
5730
|
t = filterTimelineQualities(
|
|
5615
|
-
(
|
|
5616
|
-
throwSamplingRatesUnsupported,
|
|
5617
|
-
t
|
|
5618
|
-
);
|
|
5619
|
-
const selection = deps.options.value.audio.selection;
|
|
5620
|
-
t = filterTimelineQualities(
|
|
5621
|
-
createAudioDescriptionFilter((_a = selection == null ? void 0 : selection.descriptive) != null ? _a : false),
|
|
5731
|
+
createAudioDescriptionFilter((_c = selection == null ? void 0 : selection.descriptive) != null ? _c : false),
|
|
5622
5732
|
throwNoPlayableAudio,
|
|
5623
5733
|
t
|
|
5624
5734
|
);
|
|
5625
5735
|
t = filterTimelineQualities(
|
|
5626
|
-
createLanguageFilter((
|
|
5736
|
+
createLanguageFilter((_d = selection == null ? void 0 : selection.language) != null ? _d : null, "audio"),
|
|
5627
5737
|
throwLanguagesUnsupported,
|
|
5628
5738
|
t
|
|
5629
5739
|
);
|
|
@@ -5638,33 +5748,17 @@ function createDefaultMediaTimelineTransformer(deps) {
|
|
|
5638
5748
|
});
|
|
5639
5749
|
}
|
|
5640
5750
|
|
|
5641
|
-
// src/streaming/DescriptorRecord.ts
|
|
5642
|
-
var import_vinyl_validation9 = require("@amazon/vinyl-validation");
|
|
5643
|
-
var import_vinyl_util63 = require("@amazon/vinyl-util");
|
|
5644
|
-
function getDescriptorValue(record4, uri, id) {
|
|
5645
|
-
var _a, _b;
|
|
5646
|
-
let arr = record4[uri];
|
|
5647
|
-
if (!arr) return null;
|
|
5648
|
-
if (id !== void 0) arr = arr.filter((descriptor) => descriptor.id === id);
|
|
5649
|
-
return (_b = (_a = (0, import_vinyl_util63.first)(arr)) == null ? void 0 : _a.value) != null ? _b : null;
|
|
5650
|
-
}
|
|
5651
|
-
var descriptorValidator = /* @__PURE__ */ (0, import_vinyl_validation9.object)({
|
|
5652
|
-
id: /* @__PURE__ */ (0, import_vinyl_validation9.string)().maybe().optional(),
|
|
5653
|
-
value: /* @__PURE__ */ (0, import_vinyl_validation9.string)().maybe().optional()
|
|
5654
|
-
});
|
|
5655
|
-
var descriptorRecordValidator = /* @__PURE__ */ (0, import_vinyl_validation9.record)(/* @__PURE__ */ (0, import_vinyl_validation9.string)(), /* @__PURE__ */ (0, import_vinyl_validation9.array)(descriptorValidator).readonly().orUndefined());
|
|
5656
|
-
|
|
5657
5751
|
// src/streaming/ManifestControllerImpl.ts
|
|
5658
5752
|
var import_vinyl_observable3 = require("@amazon/vinyl-observable");
|
|
5659
|
-
var
|
|
5753
|
+
var import_vinyl_util61 = require("@amazon/vinyl-util");
|
|
5660
5754
|
var ManifestControllerImpl = class {
|
|
5661
5755
|
constructor(deps) {
|
|
5662
5756
|
__publicField(this, "deps", deps);
|
|
5663
5757
|
__publicField(this, "_data");
|
|
5664
5758
|
__publicField(this, "_error", null);
|
|
5665
|
-
__publicField(this, "abortSlot", /* @__PURE__ */ (0,
|
|
5666
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
5667
|
-
__publicField(this, "events", /* @__PURE__ */ new
|
|
5759
|
+
__publicField(this, "abortSlot", /* @__PURE__ */ (0, import_vinyl_util61.createAbortSlot)());
|
|
5760
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util61.createDisposer)());
|
|
5761
|
+
__publicField(this, "events", /* @__PURE__ */ new import_vinyl_util61.EventHostImpl());
|
|
5668
5762
|
__publicField(this, "manifestSpanArmed", true);
|
|
5669
5763
|
__publicField(this, "__eventMapType", this.events.__eventMapType);
|
|
5670
5764
|
this._data = (0, import_vinyl_observable3.data)(this.requestManifest());
|
|
@@ -5691,7 +5785,7 @@ var ManifestControllerImpl = class {
|
|
|
5691
5785
|
return this._error;
|
|
5692
5786
|
}
|
|
5693
5787
|
refresh() {
|
|
5694
|
-
(0,
|
|
5788
|
+
(0, import_vinyl_util61.logDebug)(this, "refresh");
|
|
5695
5789
|
this._data.value = this.requestManifest();
|
|
5696
5790
|
}
|
|
5697
5791
|
requestManifest() {
|
|
@@ -5722,7 +5816,7 @@ var ManifestControllerImpl = class {
|
|
|
5722
5816
|
);
|
|
5723
5817
|
}
|
|
5724
5818
|
reset() {
|
|
5725
|
-
(0,
|
|
5819
|
+
(0, import_vinyl_util61.logDebug)(this, "reset");
|
|
5726
5820
|
if (this._error) {
|
|
5727
5821
|
this.refresh();
|
|
5728
5822
|
}
|
|
@@ -5755,78 +5849,10 @@ var ManifestControllerImpl = class {
|
|
|
5755
5849
|
}
|
|
5756
5850
|
};
|
|
5757
5851
|
|
|
5758
|
-
// src/streaming/MediaQualityMetadata.ts
|
|
5759
|
-
var import_vinyl_util65 = require("@amazon/vinyl-util");
|
|
5760
|
-
var import_vinyl_validation10 = require("@amazon/vinyl-validation");
|
|
5761
|
-
var ALL_CONTENT_TYPES = [
|
|
5762
|
-
"video",
|
|
5763
|
-
"audio",
|
|
5764
|
-
"text"
|
|
5765
|
-
];
|
|
5766
|
-
var RESTRICTABLE_CONTENT_TYPES = [
|
|
5767
|
-
"video",
|
|
5768
|
-
"audio"
|
|
5769
|
-
];
|
|
5770
|
-
var drmProtectionValidator = /* @__PURE__ */ descriptorValidator.extend({
|
|
5771
|
-
keySystem: /* @__PURE__ */ (0, import_vinyl_validation10.enumOf)(DrmKeySystem),
|
|
5772
|
-
pro: /* @__PURE__ */ (0, import_vinyl_validation10.string)().maybe().optional(),
|
|
5773
|
-
pssh: /* @__PURE__ */ (0, import_vinyl_validation10.string)().maybe().optional()
|
|
5774
|
-
});
|
|
5775
|
-
var mediaFormatMetadataValidator = /* @__PURE__ */ (0, import_vinyl_validation10.object)({
|
|
5776
|
-
contentProtections: /* @__PURE__ */ (0, import_vinyl_validation10.array)(drmProtectionValidator).readonly(),
|
|
5777
|
-
contentType: /* @__PURE__ */ (0, import_vinyl_validation10.isOneOf)("audio", "video", "text").orNull(),
|
|
5778
|
-
initDataType: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull(),
|
|
5779
|
-
encryptionScheme: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull(),
|
|
5780
|
-
mimeType: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull()
|
|
5781
|
-
});
|
|
5782
|
-
function createEmptyMediaFormatMetadata() {
|
|
5783
|
-
return {
|
|
5784
|
-
contentType: null,
|
|
5785
|
-
mimeType: null,
|
|
5786
|
-
initDataType: null,
|
|
5787
|
-
encryptionScheme: null,
|
|
5788
|
-
contentProtections: []
|
|
5789
|
-
};
|
|
5790
|
-
}
|
|
5791
|
-
function createEmptyMediaQualityMetadata() {
|
|
5792
|
-
return __spreadProps(__spreadValues({}, createEmptyMediaFormatMetadata()), {
|
|
5793
|
-
decoderId: (0, import_vinyl_util65.createShortUid)(),
|
|
5794
|
-
qualityId: (0, import_vinyl_util65.createShortUid)(),
|
|
5795
|
-
codecs: null,
|
|
5796
|
-
bandwidth: null,
|
|
5797
|
-
bandwidthTotal: null,
|
|
5798
|
-
supplementalProperties: {},
|
|
5799
|
-
audioSamplingRate: null,
|
|
5800
|
-
frameRate: null,
|
|
5801
|
-
height: null,
|
|
5802
|
-
width: null,
|
|
5803
|
-
lang: null,
|
|
5804
|
-
characteristics: [],
|
|
5805
|
-
groupId: (0, import_vinyl_util65.createShortUid)(),
|
|
5806
|
-
switchingGroupIds: null
|
|
5807
|
-
});
|
|
5808
|
-
}
|
|
5809
|
-
var mediaQualityMetadataValidator = /* @__PURE__ */ mediaFormatMetadataValidator.extend({
|
|
5810
|
-
audioSamplingRate: /* @__PURE__ */ (0, import_vinyl_validation10.array)(/* @__PURE__ */ (0, import_vinyl_validation10.number)()).readonly().orNull(),
|
|
5811
|
-
bandwidth: /* @__PURE__ */ (0, import_vinyl_validation10.number)().orNull(),
|
|
5812
|
-
bandwidthTotal: /* @__PURE__ */ (0, import_vinyl_validation10.number)().orNull(),
|
|
5813
|
-
codecs: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull(),
|
|
5814
|
-
decoderId: /* @__PURE__ */ (0, import_vinyl_validation10.string)(),
|
|
5815
|
-
frameRate: /* @__PURE__ */ (0, import_vinyl_validation10.tuple)(/* @__PURE__ */ (0, import_vinyl_validation10.number)(), /* @__PURE__ */ (0, import_vinyl_validation10.number)()).readonly().orNull(),
|
|
5816
|
-
height: /* @__PURE__ */ (0, import_vinyl_validation10.number)().orNull(),
|
|
5817
|
-
qualityId: /* @__PURE__ */ (0, import_vinyl_validation10.string)(),
|
|
5818
|
-
supplementalProperties: descriptorRecordValidator,
|
|
5819
|
-
width: /* @__PURE__ */ (0, import_vinyl_validation10.number)().orNull(),
|
|
5820
|
-
lang: /* @__PURE__ */ (0, import_vinyl_validation10.string)().orNull(),
|
|
5821
|
-
characteristics: /* @__PURE__ */ (0, import_vinyl_validation10.array)(/* @__PURE__ */ (0, import_vinyl_validation10.string)()).readonly(),
|
|
5822
|
-
groupId: /* @__PURE__ */ (0, import_vinyl_validation10.string)(),
|
|
5823
|
-
switchingGroupIds: /* @__PURE__ */ (0, import_vinyl_validation10.array)(/* @__PURE__ */ (0, import_vinyl_validation10.string)()).readonly().orNull()
|
|
5824
|
-
});
|
|
5825
|
-
|
|
5826
5852
|
// src/streaming/MediaTimeline.ts
|
|
5827
|
-
var
|
|
5853
|
+
var import_vinyl_util62 = require("@amazon/vinyl-util");
|
|
5828
5854
|
function getMediaPeriodAtTime(timeline, time) {
|
|
5829
|
-
const index = (0,
|
|
5855
|
+
const index = (0, import_vinyl_util62.sortedInsertionIndex)(timeline.periods, time, (time2, period2) => {
|
|
5830
5856
|
return time2 - period2.startTime;
|
|
5831
5857
|
}) - 1;
|
|
5832
5858
|
if (index < 0) return null;
|
|
@@ -5835,10 +5861,10 @@ function getMediaPeriodAtTime(timeline, time) {
|
|
|
5835
5861
|
}
|
|
5836
5862
|
|
|
5837
5863
|
// src/streaming/SegmentControllerImpl.ts
|
|
5838
|
-
var
|
|
5864
|
+
var import_vinyl_util66 = require("@amazon/vinyl-util");
|
|
5839
5865
|
|
|
5840
5866
|
// src/streaming/SegmentDataSlot.ts
|
|
5841
|
-
var
|
|
5867
|
+
var import_vinyl_util63 = require("@amazon/vinyl-util");
|
|
5842
5868
|
var SegmentStatus = /* @__PURE__ */ ((SegmentStatus2) => {
|
|
5843
5869
|
SegmentStatus2["INACTIVE"] = "inactive";
|
|
5844
5870
|
SegmentStatus2["PENDING"] = "pending";
|
|
@@ -5854,7 +5880,7 @@ var SegmentDataSlot = class {
|
|
|
5854
5880
|
*/
|
|
5855
5881
|
__publicField(this, "onStatusChange", null);
|
|
5856
5882
|
__publicField(this, "_status", "inactive" /* INACTIVE */);
|
|
5857
|
-
__publicField(this, "abortSlot", /* @__PURE__ */ (0,
|
|
5883
|
+
__publicField(this, "abortSlot", /* @__PURE__ */ (0, import_vinyl_util63.createAbortSlot)());
|
|
5858
5884
|
__publicField(this, "bufferPromise", null);
|
|
5859
5885
|
}
|
|
5860
5886
|
/**
|
|
@@ -5888,7 +5914,7 @@ var SegmentDataSlot = class {
|
|
|
5888
5914
|
this.status = "resolved" /* RESOLVED */;
|
|
5889
5915
|
return result;
|
|
5890
5916
|
}).catch((error) => {
|
|
5891
|
-
if ((0,
|
|
5917
|
+
if ((0, import_vinyl_util63.isSilentError)(error)) {
|
|
5892
5918
|
this.bufferPromise = null;
|
|
5893
5919
|
this.status = "inactive" /* INACTIVE */;
|
|
5894
5920
|
} else {
|
|
@@ -5909,7 +5935,7 @@ var SegmentDataSlot = class {
|
|
|
5909
5935
|
};
|
|
5910
5936
|
|
|
5911
5937
|
// src/streaming/SegmentPrefetch.ts
|
|
5912
|
-
var
|
|
5938
|
+
var import_vinyl_util64 = require("@amazon/vinyl-util");
|
|
5913
5939
|
var defaultTrackPriority = {
|
|
5914
5940
|
// Default priority is lowest, but not used. Use enqueueSegmentPrefetch to enqueue.
|
|
5915
5941
|
trackPriority: 0,
|
|
@@ -5923,8 +5949,8 @@ var immediatePrefetchPriority = {
|
|
|
5923
5949
|
segmentStartTime: 0,
|
|
5924
5950
|
prefetchStartTime: 0
|
|
5925
5951
|
};
|
|
5926
|
-
var segmentPriorityComparatorRef = /* @__PURE__ */ (0,
|
|
5927
|
-
return (0,
|
|
5952
|
+
var segmentPriorityComparatorRef = /* @__PURE__ */ (0, import_vinyl_util64.globalRef)(() => {
|
|
5953
|
+
return (0, import_vinyl_util64.compareBy)(
|
|
5928
5954
|
(e) => {
|
|
5929
5955
|
return e.segmentStartTime <= e.prefetchStartTime ? 0 : 1;
|
|
5930
5956
|
},
|
|
@@ -5932,17 +5958,17 @@ var segmentPriorityComparatorRef = /* @__PURE__ */ (0, import_vinyl_util68.globa
|
|
|
5932
5958
|
(e) => -e.trackPriority
|
|
5933
5959
|
);
|
|
5934
5960
|
});
|
|
5935
|
-
var prefetchPriorityQueuesRef = /* @__PURE__ */ (0,
|
|
5961
|
+
var prefetchPriorityQueuesRef = /* @__PURE__ */ (0, import_vinyl_util64.globalRef)(() => {
|
|
5936
5962
|
return {
|
|
5937
|
-
video: (0,
|
|
5963
|
+
video: (0, import_vinyl_util64.createTaskQueue)(
|
|
5938
5964
|
segmentPriorityComparatorRef.value,
|
|
5939
5965
|
defaultTrackPriority
|
|
5940
5966
|
),
|
|
5941
|
-
audio: (0,
|
|
5967
|
+
audio: (0, import_vinyl_util64.createTaskQueue)(
|
|
5942
5968
|
segmentPriorityComparatorRef.value,
|
|
5943
5969
|
defaultTrackPriority
|
|
5944
5970
|
),
|
|
5945
|
-
text: (0,
|
|
5971
|
+
text: (0, import_vinyl_util64.createTaskQueue)(
|
|
5946
5972
|
segmentPriorityComparatorRef.value,
|
|
5947
5973
|
defaultTrackPriority
|
|
5948
5974
|
)
|
|
@@ -5956,7 +5982,7 @@ function enqueueSegmentPrefetch(requestTask, contentType2, priority) {
|
|
|
5956
5982
|
}
|
|
5957
5983
|
|
|
5958
5984
|
// src/streaming/util/segment.ts
|
|
5959
|
-
var
|
|
5985
|
+
var import_vinyl_util65 = require("@amazon/vinyl-util");
|
|
5960
5986
|
function getSegmentAtTime(time, segments, affordance = 0) {
|
|
5961
5987
|
const index = getSegmentInsertionIndexAtTime(time + affordance, segments) - 1;
|
|
5962
5988
|
if (index < 0) return null;
|
|
@@ -5964,7 +5990,7 @@ function getSegmentAtTime(time, segments, affordance = 0) {
|
|
|
5964
5990
|
return time >= segment.endTime ? null : segment;
|
|
5965
5991
|
}
|
|
5966
5992
|
function getSegmentInsertionIndexAtTime(time, segments) {
|
|
5967
|
-
return (0,
|
|
5993
|
+
return (0, import_vinyl_util65.sortedInsertionIndex)(
|
|
5968
5994
|
segments,
|
|
5969
5995
|
time,
|
|
5970
5996
|
(time2, element2) => time2 - element2.startTime
|
|
@@ -5978,7 +6004,7 @@ var defaultSegmentControllerBaseOptions = {
|
|
|
5978
6004
|
prefetchInactive: 20,
|
|
5979
6005
|
retainTail: 30
|
|
5980
6006
|
};
|
|
5981
|
-
var SegmentControllerImpl = class extends
|
|
6007
|
+
var SegmentControllerImpl = class extends import_vinyl_util66.EventHostImpl {
|
|
5982
6008
|
constructor(deps, contentType2, options) {
|
|
5983
6009
|
super();
|
|
5984
6010
|
__publicField(this, "deps", deps);
|
|
@@ -5987,7 +6013,7 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
5987
6013
|
// contentType param-property, so it would capture `undefined`.
|
|
5988
6014
|
__publicField(this, "logPrefix");
|
|
5989
6015
|
__publicField(this, "_active", false);
|
|
5990
|
-
__publicField(this, "_fetchedRanges", /* @__PURE__ */ new
|
|
6016
|
+
__publicField(this, "_fetchedRanges", /* @__PURE__ */ new import_vinyl_util66.RangesImpl());
|
|
5991
6017
|
__publicField(this, "_startTime", 0);
|
|
5992
6018
|
/**
|
|
5993
6019
|
* A map of decoder id to init segment slots.
|
|
@@ -5996,9 +6022,9 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
5996
6022
|
*/
|
|
5997
6023
|
__publicField(this, "cachedInitSegments", /* @__PURE__ */ new Map());
|
|
5998
6024
|
__publicField(this, "cachedSegments", []);
|
|
5999
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
6025
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util66.createDisposer)());
|
|
6000
6026
|
__publicField(this, "options");
|
|
6001
|
-
__publicField(this, "prefetchingPriority", /* @__PURE__ */ (0,
|
|
6027
|
+
__publicField(this, "prefetchingPriority", /* @__PURE__ */ (0, import_vinyl_util66.clone)(defaultTrackPriority));
|
|
6002
6028
|
/**
|
|
6003
6029
|
* True if the last segment in the prefetch range has been cached.
|
|
6004
6030
|
*/
|
|
@@ -6013,13 +6039,13 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6013
6039
|
__publicField(this, "timeUpdateSub", null);
|
|
6014
6040
|
__publicField(this, "seekingSub", null);
|
|
6015
6041
|
// When disposed, aborts in-flight operations.
|
|
6016
|
-
__publicField(this, "abort", /* @__PURE__ */ new
|
|
6042
|
+
__publicField(this, "abort", /* @__PURE__ */ new import_vinyl_util66.Abort());
|
|
6017
6043
|
/**
|
|
6018
6044
|
* Cached last period lookup for fast repeated access.
|
|
6019
6045
|
*/
|
|
6020
6046
|
__publicField(this, "_cachedPeriod", null);
|
|
6021
6047
|
__publicField(this, "pollPrefetch", /* @__PURE__ */ this.disposer.add(
|
|
6022
|
-
/* @__PURE__ */ (0,
|
|
6048
|
+
/* @__PURE__ */ (0, import_vinyl_util66.throttle)(
|
|
6023
6049
|
() => {
|
|
6024
6050
|
if (this.error) return;
|
|
6025
6051
|
this.sweepCachedSegments();
|
|
@@ -6030,15 +6056,15 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6030
6056
|
enqueueSegmentPrefetch(
|
|
6031
6057
|
async () => {
|
|
6032
6058
|
this.abort.throwIfAborted();
|
|
6033
|
-
(0,
|
|
6059
|
+
(0, import_vinyl_util66.logDebug)(this, `Prefetching`, nextTime.toFixed(4));
|
|
6034
6060
|
const slot = await this.getSlotAtTime(nextTime);
|
|
6035
6061
|
this.abort.throwIfAborted();
|
|
6036
6062
|
if (!slot) {
|
|
6037
|
-
(0,
|
|
6063
|
+
(0, import_vinyl_util66.logDebug)(this, "prefetch ended");
|
|
6038
6064
|
this.ended = true;
|
|
6039
6065
|
return;
|
|
6040
6066
|
}
|
|
6041
|
-
await (0,
|
|
6067
|
+
await (0, import_vinyl_util66.withAbort)(
|
|
6042
6068
|
Promise.all([
|
|
6043
6069
|
this.requestInitData(slot),
|
|
6044
6070
|
this.requestSegmentData(slot)
|
|
@@ -6061,14 +6087,14 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6061
6087
|
)
|
|
6062
6088
|
));
|
|
6063
6089
|
__publicField(this, "prefetchErrorHandler", (error) => {
|
|
6064
|
-
if (!this.disposed && !(0,
|
|
6065
|
-
(0,
|
|
6090
|
+
if (!this.disposed && !(0, import_vinyl_util66.isSilentError)(error)) {
|
|
6091
|
+
(0, import_vinyl_util66.logError)(this, "Error prefetching segment", error);
|
|
6066
6092
|
this._error = error;
|
|
6067
6093
|
}
|
|
6068
6094
|
});
|
|
6069
6095
|
__publicField(this, "_streamingQuality", null);
|
|
6070
|
-
this.logPrefix = (0,
|
|
6071
|
-
(0,
|
|
6096
|
+
this.logPrefix = (0, import_vinyl_util66.createLogPrefix)(`Segment_${contentType2}`);
|
|
6097
|
+
(0, import_vinyl_util66.logDebug)(this, "constructed");
|
|
6072
6098
|
const { add } = this.disposer;
|
|
6073
6099
|
this.options = __spreadValues(__spreadValues({}, defaultSegmentControllerBaseOptions), options);
|
|
6074
6100
|
add(
|
|
@@ -6080,8 +6106,8 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6080
6106
|
})
|
|
6081
6107
|
);
|
|
6082
6108
|
add(
|
|
6083
|
-
(0,
|
|
6084
|
-
(0,
|
|
6109
|
+
(0, import_vinyl_util66.getNetworkState)().on("online", () => {
|
|
6110
|
+
(0, import_vinyl_util66.logDebug)(this, "online, resetting prefetch");
|
|
6085
6111
|
this.reset();
|
|
6086
6112
|
})
|
|
6087
6113
|
);
|
|
@@ -6163,10 +6189,10 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6163
6189
|
const cachedSegment = this.cachedSegments[i];
|
|
6164
6190
|
const { startTime, endTime } = cachedSegment;
|
|
6165
6191
|
const cachedRange = [startTime, endTime];
|
|
6166
|
-
if (!(0,
|
|
6192
|
+
if (!(0, import_vinyl_util66.rangeIntersects)(inactiveRange, cachedRange) && !(activeRange && (0, import_vinyl_util66.rangeIntersects)(activeRange, cachedRange))) {
|
|
6167
6193
|
cachedSegment.data.clear();
|
|
6168
6194
|
this.cachedSegments.splice(i, 1);
|
|
6169
|
-
(0,
|
|
6195
|
+
(0, import_vinyl_util66.logDebug)(
|
|
6170
6196
|
this,
|
|
6171
6197
|
"removing cached segment at: ",
|
|
6172
6198
|
cachedSegment.startTime
|
|
@@ -6241,15 +6267,15 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6241
6267
|
const previous = this._streamingQuality;
|
|
6242
6268
|
if ((value == null ? void 0 : value.qualityId) === (previous == null ? void 0 : previous.qualityId)) return;
|
|
6243
6269
|
this._streamingQuality = value;
|
|
6244
|
-
(0,
|
|
6270
|
+
(0, import_vinyl_util66.logDebug)(this, "streamingQualityChange", value);
|
|
6245
6271
|
this.dispatch("streamingQualityChange", {
|
|
6246
6272
|
previous,
|
|
6247
6273
|
current: value
|
|
6248
6274
|
});
|
|
6249
6275
|
}
|
|
6250
6276
|
getSegment(time, abort) {
|
|
6251
|
-
(0,
|
|
6252
|
-
const segmentReferencePromise = (0,
|
|
6277
|
+
(0, import_vinyl_util66.logDebug)(this, `requesting segment at time: ${time.toFixed(4)}`);
|
|
6278
|
+
const segmentReferencePromise = (0, import_vinyl_util66.withAbort)(
|
|
6253
6279
|
this._getSegment(Math.max(0, time)),
|
|
6254
6280
|
abort
|
|
6255
6281
|
);
|
|
@@ -6257,13 +6283,13 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6257
6283
|
() => segmentReferencePromise,
|
|
6258
6284
|
this.contentType,
|
|
6259
6285
|
immediatePrefetchPriority
|
|
6260
|
-
).catch(
|
|
6286
|
+
).catch(import_vinyl_util66.noop);
|
|
6261
6287
|
return segmentReferencePromise;
|
|
6262
6288
|
}
|
|
6263
6289
|
async _getSegment(time) {
|
|
6264
6290
|
const streamingSlot = await this.getSlotAtTime(time);
|
|
6265
6291
|
if (!streamingSlot) return null;
|
|
6266
|
-
(0,
|
|
6292
|
+
(0, import_vinyl_util66.logDebug)(
|
|
6267
6293
|
this,
|
|
6268
6294
|
`init status: ${streamingSlot.initData.status}, data status: ${streamingSlot.data.status}`
|
|
6269
6295
|
);
|
|
@@ -6277,7 +6303,7 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6277
6303
|
if (streamingSlot.endTime - time < minBufferTime) {
|
|
6278
6304
|
minBufferPrefetch = this.prefetchImmediate(
|
|
6279
6305
|
streamingSlot.endTime
|
|
6280
|
-
).catch(
|
|
6306
|
+
).catch(import_vinyl_util66.noop);
|
|
6281
6307
|
}
|
|
6282
6308
|
const [initData, data3] = await initAndDataPromise;
|
|
6283
6309
|
await minBufferPrefetch;
|
|
@@ -6318,7 +6344,7 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6318
6344
|
SEGMENT_START_AFFORDANCE
|
|
6319
6345
|
);
|
|
6320
6346
|
if (cachedSegment) return cachedSegment;
|
|
6321
|
-
const newSlot = await (0,
|
|
6347
|
+
const newSlot = await (0, import_vinyl_util66.withAbort)(
|
|
6322
6348
|
this.createSlotForTime(time),
|
|
6323
6349
|
this.abort
|
|
6324
6350
|
);
|
|
@@ -6337,11 +6363,11 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6337
6363
|
);
|
|
6338
6364
|
if (insertionIndex > 0) {
|
|
6339
6365
|
const cachedSegment2 = this.cachedSegments[insertionIndex - 1];
|
|
6340
|
-
if ((0,
|
|
6366
|
+
if ((0, import_vinyl_util66.closeTo)(newSlot.startTime, cachedSegment2.startTime)) {
|
|
6341
6367
|
return cachedSegment2;
|
|
6342
6368
|
}
|
|
6343
6369
|
}
|
|
6344
|
-
(0,
|
|
6370
|
+
(0, import_vinyl_util66.logDebug)(
|
|
6345
6371
|
this,
|
|
6346
6372
|
`created slot at ${insertionIndex} for time ${newSlot.startTime.toFixed(4)}`
|
|
6347
6373
|
);
|
|
@@ -6352,7 +6378,7 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6352
6378
|
* Gets a cached init segment slot for the given decoder id. If a slot is not cached, create one.
|
|
6353
6379
|
*/
|
|
6354
6380
|
getOrCreateInitSlot(decoderId, segmentDataProvider) {
|
|
6355
|
-
return (0,
|
|
6381
|
+
return (0, import_vinyl_util66.getOrSet)(this.cachedInitSegments, decoderId, () => {
|
|
6356
6382
|
return new SegmentDataSlot(segmentDataProvider);
|
|
6357
6383
|
});
|
|
6358
6384
|
}
|
|
@@ -6410,7 +6436,7 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6410
6436
|
*/
|
|
6411
6437
|
activate() {
|
|
6412
6438
|
if (this._active) return;
|
|
6413
|
-
(0,
|
|
6439
|
+
(0, import_vinyl_util66.logDebug)(this, "activate");
|
|
6414
6440
|
this._active = true;
|
|
6415
6441
|
this.pollPrefetch();
|
|
6416
6442
|
const playbackController = this.deps.playbackController;
|
|
@@ -6431,7 +6457,7 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6431
6457
|
*/
|
|
6432
6458
|
deactivate() {
|
|
6433
6459
|
if (!this._active) return;
|
|
6434
|
-
(0,
|
|
6460
|
+
(0, import_vinyl_util66.logDebug)(this, "deactivate");
|
|
6435
6461
|
this._active = false;
|
|
6436
6462
|
this.sweepCachedSegments();
|
|
6437
6463
|
this.timeUpdateSub();
|
|
@@ -6440,7 +6466,7 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6440
6466
|
this.seekingSub = null;
|
|
6441
6467
|
}
|
|
6442
6468
|
clear() {
|
|
6443
|
-
(0,
|
|
6469
|
+
(0, import_vinyl_util66.logDebug)(this, "clear");
|
|
6444
6470
|
this.cachedSegments.forEach((slot) => {
|
|
6445
6471
|
slot.data.onStatusChange = null;
|
|
6446
6472
|
slot.data.clear();
|
|
@@ -6456,7 +6482,7 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6456
6482
|
this.dispatch("fetchedRangesChange", {});
|
|
6457
6483
|
}
|
|
6458
6484
|
reset() {
|
|
6459
|
-
(0,
|
|
6485
|
+
(0, import_vinyl_util66.logDebug)(this, "reset");
|
|
6460
6486
|
this.cachedSegments.forEach((slot) => this.resetSlot(slot));
|
|
6461
6487
|
this._error = null;
|
|
6462
6488
|
this.pollPrefetch();
|
|
@@ -6467,12 +6493,12 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6467
6493
|
*/
|
|
6468
6494
|
resetSlot(slot) {
|
|
6469
6495
|
if (slot.data.status === "erred" /* ERRED */) {
|
|
6470
|
-
(0,
|
|
6496
|
+
(0, import_vinyl_util66.logDebug)(this, "resetting failed segment at time:", slot.startTime);
|
|
6471
6497
|
this.ended = false;
|
|
6472
6498
|
slot.data.clear();
|
|
6473
6499
|
}
|
|
6474
6500
|
if (slot.initData.status === "erred" /* ERRED */) {
|
|
6475
|
-
(0,
|
|
6501
|
+
(0, import_vinyl_util66.logDebug)(this, "resetting failed init segment");
|
|
6476
6502
|
this.ended = false;
|
|
6477
6503
|
slot.initData.clear();
|
|
6478
6504
|
}
|
|
@@ -6481,7 +6507,7 @@ var SegmentControllerImpl = class extends import_vinyl_util70.EventHostImpl {
|
|
|
6481
6507
|
return this.disposer.disposed;
|
|
6482
6508
|
}
|
|
6483
6509
|
dispose() {
|
|
6484
|
-
(0,
|
|
6510
|
+
(0, import_vinyl_util66.logDebug)(this, "disposing");
|
|
6485
6511
|
super.dispose();
|
|
6486
6512
|
this.disposer.dispose();
|
|
6487
6513
|
this.deactivate();
|
|
@@ -6498,7 +6524,6 @@ var ALL_STREAMING_EVENTS = [
|
|
|
6498
6524
|
"bufferingQualityChange",
|
|
6499
6525
|
"playbackQualityChange",
|
|
6500
6526
|
"bufferingEnded",
|
|
6501
|
-
"hasDataChange",
|
|
6502
6527
|
"error",
|
|
6503
6528
|
"reset",
|
|
6504
6529
|
"qualitiesChange",
|
|
@@ -6509,7 +6534,7 @@ var ALL_STREAMING_EVENTS = [
|
|
|
6509
6534
|
];
|
|
6510
6535
|
|
|
6511
6536
|
// src/text/discoverDashTextTracks.ts
|
|
6512
|
-
var
|
|
6537
|
+
var import_vinyl_util67 = require("@amazon/vinyl-util");
|
|
6513
6538
|
function discoverDashTextTracks(manifest, baseUrl) {
|
|
6514
6539
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
6515
6540
|
const out = [];
|
|
@@ -6563,17 +6588,17 @@ function isSidecarTextMime(mimeType) {
|
|
|
6563
6588
|
}
|
|
6564
6589
|
function chainBase(parent, bases) {
|
|
6565
6590
|
if (!bases || bases.length === 0) return parent;
|
|
6566
|
-
return (0,
|
|
6591
|
+
return (0, import_vinyl_util67.resolveUrl)(bases[0]._content, parent);
|
|
6567
6592
|
}
|
|
6568
6593
|
function pickRepresentationUri(base, id) {
|
|
6569
6594
|
if (base.endsWith("/")) {
|
|
6570
|
-
return (0,
|
|
6595
|
+
return (0, import_vinyl_util67.resolveUrl)(`${id}.vtt`, base);
|
|
6571
6596
|
}
|
|
6572
6597
|
return base;
|
|
6573
6598
|
}
|
|
6574
6599
|
|
|
6575
6600
|
// src/text/discoverHlsTextTracks.ts
|
|
6576
|
-
var
|
|
6601
|
+
var import_vinyl_util68 = require("@amazon/vinyl-util");
|
|
6577
6602
|
function discoverHlsTextTracks(mainPlaylist, baseUrl) {
|
|
6578
6603
|
var _a, _b;
|
|
6579
6604
|
const out = [];
|
|
@@ -6582,7 +6607,7 @@ function discoverHlsTextTracks(mainPlaylist, baseUrl) {
|
|
|
6582
6607
|
for (const rendition of mainPlaylist.alternativeRenditions) {
|
|
6583
6608
|
if (rendition.type !== "SUBTITLES") continue;
|
|
6584
6609
|
if (!rendition.uri) continue;
|
|
6585
|
-
const resolved = (0,
|
|
6610
|
+
const resolved = (0, import_vinyl_util68.resolveUrl)(rendition.uri, baseUrl);
|
|
6586
6611
|
out.push(__spreadValues({
|
|
6587
6612
|
id: `hls-text-${index++}-${rendition.groupId}-${rendition.name}`,
|
|
6588
6613
|
kind: "subtitles",
|
|
@@ -6793,23 +6818,23 @@ function createMediaTextTrackProvider(deps) {
|
|
|
6793
6818
|
}
|
|
6794
6819
|
|
|
6795
6820
|
// src/text/parseWebVtt.ts
|
|
6796
|
-
var
|
|
6821
|
+
var import_vinyl_util69 = require("@amazon/vinyl-util");
|
|
6797
6822
|
var WEBVTT_HEADER = "WEBVTT";
|
|
6798
6823
|
var TIMESTAMP_RE = /^(?:(\d+):)?([0-5]\d):([0-5]\d)\.(\d{3})/;
|
|
6799
6824
|
function parseWebVtt(input) {
|
|
6800
6825
|
if (typeof input !== "string") {
|
|
6801
|
-
throw new
|
|
6826
|
+
throw new import_vinyl_util69.ValidationError(
|
|
6802
6827
|
"WebVTT input must be a string",
|
|
6803
|
-
|
|
6828
|
+
import_vinyl_util69.ErrorOrigin.MEDIA
|
|
6804
6829
|
);
|
|
6805
6830
|
}
|
|
6806
6831
|
let text = input;
|
|
6807
6832
|
if (text.charCodeAt(0) === 65279) text = text.slice(1);
|
|
6808
6833
|
const lines = text.split(/\r\n|\r|\n/);
|
|
6809
6834
|
if (lines.length === 0 || !isWebVttHeader(lines[0])) {
|
|
6810
|
-
throw new
|
|
6835
|
+
throw new import_vinyl_util69.ValidationError(
|
|
6811
6836
|
"WebVTT must begin with a WEBVTT header",
|
|
6812
|
-
|
|
6837
|
+
import_vinyl_util69.ErrorOrigin.MEDIA
|
|
6813
6838
|
);
|
|
6814
6839
|
}
|
|
6815
6840
|
const cues = [];
|
|
@@ -6999,10 +7024,10 @@ function scoreTextTrack(track, prefs) {
|
|
|
6999
7024
|
}
|
|
7000
7025
|
|
|
7001
7026
|
// src/text/SidecarTextTrackController.ts
|
|
7002
|
-
var
|
|
7027
|
+
var import_vinyl_util71 = require("@amazon/vinyl-util");
|
|
7003
7028
|
|
|
7004
7029
|
// src/text/SidecarTextTrackLoader.ts
|
|
7005
|
-
var
|
|
7030
|
+
var import_vinyl_util70 = require("@amazon/vinyl-util");
|
|
7006
7031
|
var import_vinyl_hls_parser2 = require("@amazon/vinyl-hls-parser");
|
|
7007
7032
|
var DEFAULT_TEXT_LOOK_AHEAD = 10;
|
|
7008
7033
|
var DEFAULT_TEXT_LOOK_BEHIND = 2;
|
|
@@ -7026,9 +7051,9 @@ async function loadWebVttCues(uri, options) {
|
|
|
7026
7051
|
lookBehind
|
|
7027
7052
|
});
|
|
7028
7053
|
}
|
|
7029
|
-
const response = await (0,
|
|
7054
|
+
const response = await (0, import_vinyl_util70.requestWithRetry)(uri, init, { abort });
|
|
7030
7055
|
const contentType2 = ((_c = response.headers.get("content-type")) != null ? _c : "").toLowerCase();
|
|
7031
|
-
const body = await response
|
|
7056
|
+
const body = await (0, import_vinyl_util70.readResponseBody)(response, "text");
|
|
7032
7057
|
if (contentType2.includes("mpegurl") || body.startsWith("#EXTM3U")) {
|
|
7033
7058
|
return streamMediaPlaylistText({
|
|
7034
7059
|
text: body,
|
|
@@ -7052,10 +7077,10 @@ function looksLikeMediaPlaylist(uri) {
|
|
|
7052
7077
|
return path.toLowerCase().endsWith(".m3u8");
|
|
7053
7078
|
}
|
|
7054
7079
|
async function streamMediaPlaylist(ctx) {
|
|
7055
|
-
const response = await (0,
|
|
7080
|
+
const response = await (0, import_vinyl_util70.requestWithRetry)(ctx.uri, ctx.init, {
|
|
7056
7081
|
abort: ctx.abort
|
|
7057
7082
|
});
|
|
7058
|
-
const text = await response
|
|
7083
|
+
const text = await (0, import_vinyl_util70.readResponseBody)(response, "text");
|
|
7059
7084
|
return streamMediaPlaylistText(__spreadProps(__spreadValues({}, ctx), {
|
|
7060
7085
|
text,
|
|
7061
7086
|
baseUrl: response.url || ctx.uri
|
|
@@ -7075,16 +7100,16 @@ async function streamMediaPlaylistText(ctx) {
|
|
|
7075
7100
|
while (pending.size > 0 && !((_a = ctx.abort) == null ? void 0 : _a.aborted())) {
|
|
7076
7101
|
const idx = pickInWindow(pending, ranges, ctx);
|
|
7077
7102
|
if (idx < 0) {
|
|
7078
|
-
await (0,
|
|
7103
|
+
await (0, import_vinyl_util70.sleep)(IDLE_POLL_SECONDS, ctx.abort).catch(() => {
|
|
7079
7104
|
});
|
|
7080
7105
|
continue;
|
|
7081
7106
|
}
|
|
7082
7107
|
pending.delete(idx);
|
|
7083
|
-
const segUri = (0,
|
|
7084
|
-
const res = await (0,
|
|
7108
|
+
const segUri = (0, import_vinyl_util70.resolveUrl)(segments[idx].uri, ctx.baseUrl);
|
|
7109
|
+
const res = await (0, import_vinyl_util70.requestWithRetry)(segUri, ctx.init, {
|
|
7085
7110
|
abort: ctx.abort
|
|
7086
7111
|
});
|
|
7087
|
-
const body = await res
|
|
7112
|
+
const body = await (0, import_vinyl_util70.readResponseBody)(res, "text");
|
|
7088
7113
|
const doc = parseWebVtt(body);
|
|
7089
7114
|
if (doc.cues.length > 0) ctx.onCues(doc.cues);
|
|
7090
7115
|
if (ctx.onStyles && doc.styles.length > 0) ctx.onStyles(doc.styles);
|
|
@@ -7158,7 +7183,7 @@ function resolveSelectedTrack(tracks, options) {
|
|
|
7158
7183
|
pool = pool.filter((t) => t.forced === forced);
|
|
7159
7184
|
return pickPreferredTextTrack(pool, selection.language);
|
|
7160
7185
|
}
|
|
7161
|
-
var SidecarTextTrackController = class extends
|
|
7186
|
+
var SidecarTextTrackController = class extends import_vinyl_util71.EventHostImpl {
|
|
7162
7187
|
constructor(deps) {
|
|
7163
7188
|
super();
|
|
7164
7189
|
__publicField(this, "deps", deps);
|
|
@@ -7170,14 +7195,14 @@ var SidecarTextTrackController = class extends import_vinyl_util75.EventHostImpl
|
|
|
7170
7195
|
// The DOM text track currently rendering cues, or null when hidden. Owned by
|
|
7171
7196
|
// the provider (never created/removed here).
|
|
7172
7197
|
__publicField(this, "_ref", null);
|
|
7173
|
-
__publicField(this, "loadAbort", /* @__PURE__ */ (0,
|
|
7174
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
7198
|
+
__publicField(this, "loadAbort", /* @__PURE__ */ (0, import_vinyl_util71.createAbortSlot)());
|
|
7199
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util71.createDisposer)());
|
|
7175
7200
|
const { add } = this.disposer;
|
|
7176
7201
|
add(deps.options.onData(() => this.refreshSelection()));
|
|
7177
7202
|
add(
|
|
7178
7203
|
deps.textTracks.onData((tracksPromise) => {
|
|
7179
7204
|
tracksPromise.then((tracks) => this.setTracks(tracks)).catch((error) => {
|
|
7180
|
-
(0,
|
|
7205
|
+
(0, import_vinyl_util71.logError)(this, "text tracks promise rejected", error);
|
|
7181
7206
|
});
|
|
7182
7207
|
})
|
|
7183
7208
|
);
|
|
@@ -7204,7 +7229,7 @@ var SidecarTextTrackController = class extends import_vinyl_util75.EventHostImpl
|
|
|
7204
7229
|
setTracks(tracks) {
|
|
7205
7230
|
if (this.disposed) return;
|
|
7206
7231
|
const previous = this._tracks;
|
|
7207
|
-
if ((0,
|
|
7232
|
+
if ((0, import_vinyl_util71.equalDeep)(previous, tracks)) return;
|
|
7208
7233
|
this._tracks = tracks;
|
|
7209
7234
|
this.dispatch("textTracksChange", { previous, current: tracks });
|
|
7210
7235
|
this.refreshSelection();
|
|
@@ -7353,13 +7378,13 @@ var ALL_TEXT_TRACK_EVENTS = [
|
|
|
7353
7378
|
];
|
|
7354
7379
|
|
|
7355
7380
|
// src/track/AutoResetController.ts
|
|
7356
|
-
var
|
|
7381
|
+
var import_vinyl_util72 = require("@amazon/vinyl-util");
|
|
7357
7382
|
var defaultResetControllerOptions = {
|
|
7358
7383
|
enabled: true,
|
|
7359
7384
|
maxRetries: 30,
|
|
7360
7385
|
retryInterval: 30
|
|
7361
7386
|
};
|
|
7362
|
-
var AutoResetControllerImpl = class extends
|
|
7387
|
+
var AutoResetControllerImpl = class extends import_vinyl_util72.EventHostImpl {
|
|
7363
7388
|
constructor(deps, options) {
|
|
7364
7389
|
super();
|
|
7365
7390
|
__publicField(this, "deps", deps);
|
|
@@ -7367,11 +7392,11 @@ var AutoResetControllerImpl = class extends import_vinyl_util76.EventHostImpl {
|
|
|
7367
7392
|
__publicField(this, "_error", null);
|
|
7368
7393
|
__publicField(this, "watchSub", null);
|
|
7369
7394
|
__publicField(this, "currentRetry", 0);
|
|
7370
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
7371
|
-
(0,
|
|
7395
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util72.createDisposer)());
|
|
7396
|
+
(0, import_vinyl_util72.logDebug)(this, "constructor");
|
|
7372
7397
|
this.options = __spreadValues(__spreadValues({}, defaultResetControllerOptions), options);
|
|
7373
7398
|
this.disposer.add(
|
|
7374
|
-
(0,
|
|
7399
|
+
(0, import_vinyl_util72.onAny)(
|
|
7375
7400
|
deps.playbackController,
|
|
7376
7401
|
["play", "pause", "seeking", "playing"],
|
|
7377
7402
|
(_event) => {
|
|
@@ -7386,7 +7411,7 @@ var AutoResetControllerImpl = class extends import_vinyl_util76.EventHostImpl {
|
|
|
7386
7411
|
}
|
|
7387
7412
|
setError(error) {
|
|
7388
7413
|
if (!this.options.enabled || this._error) return;
|
|
7389
|
-
if (error instanceof
|
|
7414
|
+
if (error instanceof import_vinyl_util72.RequestError && error.response == null) {
|
|
7390
7415
|
this._error = error;
|
|
7391
7416
|
this.setResetPending(true);
|
|
7392
7417
|
}
|
|
@@ -7397,30 +7422,30 @@ var AutoResetControllerImpl = class extends import_vinyl_util76.EventHostImpl {
|
|
|
7397
7422
|
setResetPending(value) {
|
|
7398
7423
|
var _a;
|
|
7399
7424
|
if (this.resetPending === value) {
|
|
7400
|
-
(0,
|
|
7425
|
+
(0, import_vinyl_util72.logDebug)(this, "setResetPending", value, "no-op");
|
|
7401
7426
|
return;
|
|
7402
7427
|
}
|
|
7403
|
-
(0,
|
|
7428
|
+
(0, import_vinyl_util72.logDebug)(this, "setResetPending", value);
|
|
7404
7429
|
(_a = this.watchSub) == null ? void 0 : _a.call(this);
|
|
7405
7430
|
this.watchSub = null;
|
|
7406
7431
|
if (value) {
|
|
7407
|
-
const networkState = (0,
|
|
7408
|
-
const { add, dispose: watchSub } = (0,
|
|
7432
|
+
const networkState = (0, import_vinyl_util72.getNetworkState)();
|
|
7433
|
+
const { add, dispose: watchSub } = (0, import_vinyl_util72.createDisposer)();
|
|
7409
7434
|
this.watchSub = watchSub;
|
|
7410
7435
|
add(
|
|
7411
7436
|
networkState.on("online", () => {
|
|
7412
|
-
(0,
|
|
7437
|
+
(0, import_vinyl_util72.logDebug)(this, "online, emitting reset");
|
|
7413
7438
|
this.reset();
|
|
7414
7439
|
})
|
|
7415
7440
|
);
|
|
7416
7441
|
const intervalId = setTimeout(() => {
|
|
7417
7442
|
if (this.currentRetry++ < this.options.maxRetries) {
|
|
7418
7443
|
if (networkState.onLine) {
|
|
7419
|
-
(0,
|
|
7444
|
+
(0, import_vinyl_util72.logDebug)(this, "interval, emitting reset");
|
|
7420
7445
|
this.reset();
|
|
7421
7446
|
}
|
|
7422
7447
|
} else {
|
|
7423
|
-
(0,
|
|
7448
|
+
(0, import_vinyl_util72.logDebug)(this, "max retries exhausted, pausing playback");
|
|
7424
7449
|
this.setResetPending(false);
|
|
7425
7450
|
}
|
|
7426
7451
|
}, this.options.retryInterval * 1e3);
|
|
@@ -7451,14 +7476,14 @@ var AutoResetControllerImpl = class extends import_vinyl_util76.EventHostImpl {
|
|
|
7451
7476
|
};
|
|
7452
7477
|
|
|
7453
7478
|
// src/track/createSegmentDataProvider.ts
|
|
7454
|
-
var
|
|
7479
|
+
var import_vinyl_util73 = require("@amazon/vinyl-util");
|
|
7455
7480
|
var import_vinyl_mpd_parser2 = require("@amazon/vinyl-mpd-parser");
|
|
7456
7481
|
function createSegmentDataProvider(deps, options) {
|
|
7457
7482
|
return async (abort) => {
|
|
7458
7483
|
var _a;
|
|
7459
7484
|
const init = __spreadValues({}, deps.segmentRequestInit);
|
|
7460
7485
|
if (options.mediaRange) {
|
|
7461
|
-
init.headers = __spreadProps(__spreadValues({}, (0,
|
|
7486
|
+
init.headers = __spreadProps(__spreadValues({}, (0, import_vinyl_util73.normalizeHeadersInit)(init.headers)), {
|
|
7462
7487
|
Range: `bytes=${(0, import_vinyl_mpd_parser2.stringifyByteRange)(options.mediaRange)}`
|
|
7463
7488
|
});
|
|
7464
7489
|
}
|
|
@@ -7467,18 +7492,18 @@ function createSegmentDataProvider(deps, options) {
|
|
|
7467
7492
|
init
|
|
7468
7493
|
};
|
|
7469
7494
|
deps.requestInterceptor(params);
|
|
7470
|
-
const serviceId = (_a = options.serviceId) != null ? _a : (0,
|
|
7495
|
+
const serviceId = (_a = options.serviceId) != null ? _a : (0, import_vinyl_util73.getHostname)(options.url);
|
|
7471
7496
|
const requestStart = Date.now();
|
|
7472
|
-
const response = await (0,
|
|
7497
|
+
const response = await (0, import_vinyl_util73.requestWithRetry)(params.input, params.init, {
|
|
7473
7498
|
serviceId,
|
|
7474
7499
|
abort
|
|
7475
7500
|
});
|
|
7476
7501
|
const responseEnd = Date.now();
|
|
7477
|
-
const arrayBuffer = await response
|
|
7502
|
+
const arrayBuffer = await (0, import_vinyl_util73.readResponseBody)(response, "arrayBuffer");
|
|
7478
7503
|
const contentEnd = Date.now();
|
|
7479
7504
|
let responseStart = null;
|
|
7480
7505
|
if ("getEntriesByName" in performance) {
|
|
7481
|
-
const lastRequest = (0,
|
|
7506
|
+
const lastRequest = (0, import_vinyl_util73.last)(
|
|
7482
7507
|
performance.getEntriesByName(params.input)
|
|
7483
7508
|
);
|
|
7484
7509
|
if (lastRequest) {
|
|
@@ -7487,8 +7512,8 @@ function createSegmentDataProvider(deps, options) {
|
|
|
7487
7512
|
}
|
|
7488
7513
|
}
|
|
7489
7514
|
}
|
|
7490
|
-
if (options.reportDownlinkMetrics) {
|
|
7491
|
-
|
|
7515
|
+
if (options.reportDownlinkMetrics && !(abort == null ? void 0 : abort.aborted())) {
|
|
7516
|
+
import_vinyl_util73.networkMetricsController.value.addDownlinkTransferEntry({
|
|
7492
7517
|
bytes: arrayBuffer.byteLength,
|
|
7493
7518
|
serviceId,
|
|
7494
7519
|
requestStart,
|
|
@@ -7502,7 +7527,7 @@ function createSegmentDataProvider(deps, options) {
|
|
|
7502
7527
|
}
|
|
7503
7528
|
|
|
7504
7529
|
// src/track/TrackFactory.ts
|
|
7505
|
-
var
|
|
7530
|
+
var import_vinyl_util74 = require("@amazon/vinyl-util");
|
|
7506
7531
|
var import_vinyl_validation13 = require("@amazon/vinyl-validation");
|
|
7507
7532
|
var trackConfigOptionsValidator = /* @__PURE__ */ (0, import_vinyl_validation13.object)({
|
|
7508
7533
|
extra: /* @__PURE__ */ (0, import_vinyl_validation13.any)().optional(),
|
|
@@ -7517,10 +7542,10 @@ var trackLoadOptionsValidator = /* @__PURE__ */ (0, import_vinyl_validation13.ob
|
|
|
7517
7542
|
}
|
|
7518
7543
|
);
|
|
7519
7544
|
function createTrackFactory(factories) {
|
|
7520
|
-
const typeValidator = (0, import_vinyl_validation13.isOneOf)(...(0,
|
|
7545
|
+
const typeValidator = (0, import_vinyl_validation13.isOneOf)(...(0, import_vinyl_util74.ownKeys)(factories));
|
|
7521
7546
|
return {
|
|
7522
7547
|
validate(options) {
|
|
7523
|
-
typeValidator.assert(options.type,
|
|
7548
|
+
typeValidator.assert(options.type, import_vinyl_util74.ErrorOrigin.API);
|
|
7524
7549
|
factories[options.type].validate(options);
|
|
7525
7550
|
},
|
|
7526
7551
|
createTrack(options) {
|
|
@@ -7530,12 +7555,12 @@ function createTrackFactory(factories) {
|
|
|
7530
7555
|
}
|
|
7531
7556
|
|
|
7532
7557
|
// src/track/source/SourceObjectTrack.ts
|
|
7533
|
-
var
|
|
7558
|
+
var import_vinyl_util78 = require("@amazon/vinyl-util");
|
|
7534
7559
|
var import_vinyl_validation14 = require("@amazon/vinyl-validation");
|
|
7535
7560
|
|
|
7536
7561
|
// src/track/TrackBase.ts
|
|
7537
|
-
var
|
|
7538
|
-
var TrackBase = class extends
|
|
7562
|
+
var import_vinyl_util75 = require("@amazon/vinyl-util");
|
|
7563
|
+
var TrackBase = class extends import_vinyl_util75.EventHostImpl {
|
|
7539
7564
|
constructor(uri, type, deps) {
|
|
7540
7565
|
super();
|
|
7541
7566
|
__publicField(this, "uri", uri);
|
|
@@ -7547,7 +7572,7 @@ var TrackBase = class extends import_vinyl_util79.EventHostImpl {
|
|
|
7547
7572
|
__publicField(this, "loadOptions", null);
|
|
7548
7573
|
__publicField(this, "errorHandler", (error) => {
|
|
7549
7574
|
if (this._error) return;
|
|
7550
|
-
if (!(0,
|
|
7575
|
+
if (!(0, import_vinyl_util75.isSilentError)(error)) {
|
|
7551
7576
|
this._error = error;
|
|
7552
7577
|
this.dispatch("error", {
|
|
7553
7578
|
target: this,
|
|
@@ -7555,8 +7580,8 @@ var TrackBase = class extends import_vinyl_util79.EventHostImpl {
|
|
|
7555
7580
|
});
|
|
7556
7581
|
}
|
|
7557
7582
|
});
|
|
7558
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
7559
|
-
__publicField(this, "drmSessionAbort", /* @__PURE__ */ (0,
|
|
7583
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util75.createDisposer)());
|
|
7584
|
+
__publicField(this, "drmSessionAbort", /* @__PURE__ */ (0, import_vinyl_util75.createAbortSlot)());
|
|
7560
7585
|
/**
|
|
7561
7586
|
* Sets on handleError, cleared on 'reset'.
|
|
7562
7587
|
*/
|
|
@@ -7568,7 +7593,7 @@ var TrackBase = class extends import_vinyl_util79.EventHostImpl {
|
|
|
7568
7593
|
return "TrackBase";
|
|
7569
7594
|
}
|
|
7570
7595
|
get fetchedRanges() {
|
|
7571
|
-
return
|
|
7596
|
+
return import_vinyl_util75.emptyRanges;
|
|
7572
7597
|
}
|
|
7573
7598
|
/**
|
|
7574
7599
|
* Default text track controller is null. Tracks that surface text tracks
|
|
@@ -7609,8 +7634,8 @@ var TrackBase = class extends import_vinyl_util79.EventHostImpl {
|
|
|
7609
7634
|
this.loadOptions = loadOptions;
|
|
7610
7635
|
this.reset();
|
|
7611
7636
|
this._active = true;
|
|
7612
|
-
(0,
|
|
7613
|
-
this.deps.playbackController.seekTo((_a = loadOptions == null ? void 0 : loadOptions.startTime) != null ? _a : 0).catch(
|
|
7637
|
+
(0, import_vinyl_util75.logDebug)(this, "activate", this.uri);
|
|
7638
|
+
this.deps.playbackController.seekTo((_a = loadOptions == null ? void 0 : loadOptions.startTime) != null ? _a : 0).catch(import_vinyl_util75.noop);
|
|
7614
7639
|
this.deps.drmController.configure(loadOptions == null ? void 0 : loadOptions.drm);
|
|
7615
7640
|
this.onActivated(loadOptions);
|
|
7616
7641
|
}
|
|
@@ -7618,7 +7643,7 @@ var TrackBase = class extends import_vinyl_util79.EventHostImpl {
|
|
|
7618
7643
|
if (!this._active) return;
|
|
7619
7644
|
this._active = false;
|
|
7620
7645
|
this.loadOptions = null;
|
|
7621
|
-
(0,
|
|
7646
|
+
(0, import_vinyl_util75.logDebug)(this, "deactivate", this.uri);
|
|
7622
7647
|
this.deps.playbackController.pause();
|
|
7623
7648
|
this.onDeactivated();
|
|
7624
7649
|
this.closeDrmSessions();
|
|
@@ -7638,10 +7663,10 @@ var TrackBase = class extends import_vinyl_util79.EventHostImpl {
|
|
|
7638
7663
|
}
|
|
7639
7664
|
setSeekRange(value) {
|
|
7640
7665
|
const prev = this._seekRange;
|
|
7641
|
-
if ((0,
|
|
7666
|
+
if ((0, import_vinyl_util75.equalDeep)(prev, value)) return;
|
|
7642
7667
|
const previous = this._seekRange;
|
|
7643
7668
|
this._seekRange = value;
|
|
7644
|
-
(0,
|
|
7669
|
+
(0, import_vinyl_util75.logDebug)(this, `seekRangeChange start=${value.start}, end=${value.end}`);
|
|
7645
7670
|
this.dispatch("seekRangeChange", {
|
|
7646
7671
|
previous,
|
|
7647
7672
|
current: value
|
|
@@ -7655,7 +7680,7 @@ var TrackBase = class extends import_vinyl_util79.EventHostImpl {
|
|
|
7655
7680
|
*/
|
|
7656
7681
|
reset(hard = false) {
|
|
7657
7682
|
if (!hard && !this._error) {
|
|
7658
|
-
(0,
|
|
7683
|
+
(0, import_vinyl_util75.logDebug)(this, "reset no-op");
|
|
7659
7684
|
return;
|
|
7660
7685
|
}
|
|
7661
7686
|
if (hard) {
|
|
@@ -7667,13 +7692,13 @@ var TrackBase = class extends import_vinyl_util79.EventHostImpl {
|
|
|
7667
7692
|
this.onDeactivated();
|
|
7668
7693
|
this.clearPrefetch();
|
|
7669
7694
|
this.onActivated(loadOptions);
|
|
7670
|
-
playbackController.seekTo(time).catch(
|
|
7671
|
-
if (!wasPaused) playbackController.play().catch(
|
|
7695
|
+
playbackController.seekTo(time).catch(import_vinyl_util75.noop);
|
|
7696
|
+
if (!wasPaused) playbackController.play().catch(import_vinyl_util75.noop);
|
|
7672
7697
|
} else {
|
|
7673
7698
|
this.clearPrefetch();
|
|
7674
7699
|
}
|
|
7675
7700
|
}
|
|
7676
|
-
(0,
|
|
7701
|
+
(0, import_vinyl_util75.logDebug)(this, "reset, hard:", hard);
|
|
7677
7702
|
this._error = null;
|
|
7678
7703
|
this.dispatch("reset", {});
|
|
7679
7704
|
}
|
|
@@ -7686,8 +7711,8 @@ var TrackBase = class extends import_vinyl_util79.EventHostImpl {
|
|
|
7686
7711
|
};
|
|
7687
7712
|
|
|
7688
7713
|
// src/track/source/FixedPlaybackQuality.ts
|
|
7689
|
-
var
|
|
7690
|
-
var FixedPlaybackQuality = class extends
|
|
7714
|
+
var import_vinyl_util76 = require("@amazon/vinyl-util");
|
|
7715
|
+
var FixedPlaybackQuality = class extends import_vinyl_util76.EventHostImpl {
|
|
7691
7716
|
constructor(fixedQuality, deps) {
|
|
7692
7717
|
super();
|
|
7693
7718
|
__publicField(this, "deps", deps);
|
|
@@ -7784,7 +7809,7 @@ var FixedPlaybackQuality = class extends import_vinyl_util80.EventHostImpl {
|
|
|
7784
7809
|
};
|
|
7785
7810
|
|
|
7786
7811
|
// src/track/source/SourceTrackBase.ts
|
|
7787
|
-
var
|
|
7812
|
+
var import_vinyl_util77 = require("@amazon/vinyl-util");
|
|
7788
7813
|
var sourceTrackBaseOptionsValidator = /* @__PURE__ */ trackConfigOptionsValidator.extend({
|
|
7789
7814
|
qualityMetadata: /* @__PURE__ */ mediaQualityMetadataValidator.partial().maybe().optional()
|
|
7790
7815
|
});
|
|
@@ -7811,7 +7836,7 @@ var SourceTrackBase = class extends TrackBase {
|
|
|
7811
7836
|
abort: this.drmSessionAbort.value
|
|
7812
7837
|
});
|
|
7813
7838
|
});
|
|
7814
|
-
(0,
|
|
7839
|
+
(0, import_vinyl_util77.redispatchEvents)(this, this.fixedPlaybackQuality, [
|
|
7815
7840
|
"streamingQualityChange",
|
|
7816
7841
|
"bufferingQualityChange",
|
|
7817
7842
|
"playbackQualityChange"
|
|
@@ -7840,7 +7865,7 @@ var SourceTrackBase = class extends TrackBase {
|
|
|
7840
7865
|
return this.fixedPlaybackQuality.getPlaybackQuality(contentType2);
|
|
7841
7866
|
}
|
|
7842
7867
|
onActivated() {
|
|
7843
|
-
const { add, dispose } = (0,
|
|
7868
|
+
const { add, dispose } = (0, import_vinyl_util77.createDisposer)();
|
|
7844
7869
|
this.activeSub = dispose;
|
|
7845
7870
|
add(
|
|
7846
7871
|
this.deps.playbackController.on("durationChange", (event) => {
|
|
@@ -7867,7 +7892,7 @@ var SourceTrackBase = class extends TrackBase {
|
|
|
7867
7892
|
this.activeSub = null;
|
|
7868
7893
|
}
|
|
7869
7894
|
clearPrefetch() {
|
|
7870
|
-
(0,
|
|
7895
|
+
(0, import_vinyl_util77.logDebug)(this, "clearPrefetch no-op");
|
|
7871
7896
|
}
|
|
7872
7897
|
};
|
|
7873
7898
|
|
|
@@ -7880,7 +7905,7 @@ var loadOptionsValidator = /* @__PURE__ */ trackLoadOptionsValidator.extend({
|
|
|
7880
7905
|
function createSourceObjectTrackFactory(deps) {
|
|
7881
7906
|
return {
|
|
7882
7907
|
validate(options) {
|
|
7883
|
-
loadOptionsValidator.assert(options,
|
|
7908
|
+
loadOptionsValidator.assert(options, import_vinyl_util78.ErrorOrigin.API);
|
|
7884
7909
|
},
|
|
7885
7910
|
createTrack(options) {
|
|
7886
7911
|
return new SourceObjectTrack(
|
|
@@ -7910,7 +7935,7 @@ var SourceObjectTrack = class extends SourceTrackBase {
|
|
|
7910
7935
|
};
|
|
7911
7936
|
|
|
7912
7937
|
// src/track/source/SourceTrack.ts
|
|
7913
|
-
var
|
|
7938
|
+
var import_vinyl_util79 = require("@amazon/vinyl-util");
|
|
7914
7939
|
var import_vinyl_validation15 = require("@amazon/vinyl-validation");
|
|
7915
7940
|
var loadOptionsValidator2 = /* @__PURE__ */ trackLoadOptionsValidator.extend({
|
|
7916
7941
|
config: /* @__PURE__ */ sourceTrackBaseOptionsValidator.maybe().optional(),
|
|
@@ -7920,7 +7945,7 @@ var loadOptionsValidator2 = /* @__PURE__ */ trackLoadOptionsValidator.extend({
|
|
|
7920
7945
|
function createSourceTrackFactory(deps) {
|
|
7921
7946
|
return {
|
|
7922
7947
|
validate(options) {
|
|
7923
|
-
loadOptionsValidator2.assert(options,
|
|
7948
|
+
loadOptionsValidator2.assert(options, import_vinyl_util79.ErrorOrigin.API);
|
|
7924
7949
|
},
|
|
7925
7950
|
createTrack(options) {
|
|
7926
7951
|
return new SourceTrack(
|
|
@@ -7950,25 +7975,22 @@ var SourceTrack = class extends SourceTrackBase {
|
|
|
7950
7975
|
};
|
|
7951
7976
|
|
|
7952
7977
|
// src/track/dash/DashTrack.ts
|
|
7953
|
-
var
|
|
7978
|
+
var import_vinyl_util81 = require("@amazon/vinyl-util");
|
|
7954
7979
|
var import_vinyl_validation16 = require("@amazon/vinyl-validation");
|
|
7955
7980
|
|
|
7956
7981
|
// src/track/mse/MseTrack.ts
|
|
7957
|
-
var
|
|
7982
|
+
var import_vinyl_util80 = require("@amazon/vinyl-util");
|
|
7958
7983
|
var import_vinyl_di2 = require("@amazon/vinyl-di");
|
|
7959
|
-
var SEEKING_STALL_TIME_CHECK = 0.1;
|
|
7960
|
-
var PLAYHEAD_NUDGE = 0.05;
|
|
7961
7984
|
var MseTrack = class extends TrackBase {
|
|
7962
7985
|
constructor(uri, type, dependencyFactories) {
|
|
7963
7986
|
const depsContainer = (0, import_vinyl_di2.createContainer)(dependencyFactories);
|
|
7964
7987
|
const deps = depsContainer.dependencies;
|
|
7965
7988
|
super(uri, type, deps);
|
|
7966
7989
|
__publicField(this, "streams", []);
|
|
7967
|
-
__publicField(this, "
|
|
7968
|
-
__publicField(this, "disposeAbort", /* @__PURE__ */ new import_vinyl_util84.Abort());
|
|
7990
|
+
__publicField(this, "disposeAbort", /* @__PURE__ */ new import_vinyl_util80.Abort());
|
|
7969
7991
|
__publicField(this, "lastPreloadOptions", null);
|
|
7970
7992
|
__publicField(this, "allFetchedRanges", []);
|
|
7971
|
-
__publicField(this, "_fetchedRanges", /* @__PURE__ */ new
|
|
7993
|
+
__publicField(this, "_fetchedRanges", /* @__PURE__ */ new import_vinyl_util80.IntersectionRanges(
|
|
7972
7994
|
this.allFetchedRanges,
|
|
7973
7995
|
{ useCache: true }
|
|
7974
7996
|
));
|
|
@@ -7977,7 +7999,7 @@ var MseTrack = class extends TrackBase {
|
|
|
7977
7999
|
__publicField(this, "_qualitiesUnfiltered", null);
|
|
7978
8000
|
__publicField(this, "timeUpdateSub", null);
|
|
7979
8001
|
__publicField(this, "_cachedPeriod", null);
|
|
7980
|
-
(0,
|
|
8002
|
+
(0, import_vinyl_util80.logDebug)(this, "constructed");
|
|
7981
8003
|
const { add } = this.disposer;
|
|
7982
8004
|
add(depsContainer);
|
|
7983
8005
|
this.deps = deps;
|
|
@@ -8026,11 +8048,6 @@ var MseTrack = class extends TrackBase {
|
|
|
8026
8048
|
if (previous !== void 0) this.reloadStreams();
|
|
8027
8049
|
})
|
|
8028
8050
|
);
|
|
8029
|
-
add(
|
|
8030
|
-
deps.allowedContentTypes.onData((_value, previous) => {
|
|
8031
|
-
if (previous !== void 0) this.reloadStreams();
|
|
8032
|
-
})
|
|
8033
|
-
);
|
|
8034
8051
|
add(
|
|
8035
8052
|
deps.abr.onData((value, previous) => {
|
|
8036
8053
|
if (previous === void 0) return;
|
|
@@ -8079,7 +8096,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8079
8096
|
const period = getMediaPeriodAtTime(timeline, time);
|
|
8080
8097
|
this._cachedPeriod = period;
|
|
8081
8098
|
const newQualities = period ? period.qualities.map((q) => q.metadata) : null;
|
|
8082
|
-
if (!(0,
|
|
8099
|
+
if (!(0, import_vinyl_util80.equalDeep)(newQualities, this._qualities)) {
|
|
8083
8100
|
const previous = this._qualities;
|
|
8084
8101
|
this._qualities = newQualities;
|
|
8085
8102
|
if (newQualities) {
|
|
@@ -8106,7 +8123,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8106
8123
|
const time = this.deps.playbackController.currentTime;
|
|
8107
8124
|
const period = getMediaPeriodAtTime(timeline, time);
|
|
8108
8125
|
const newQualities = period ? period.qualities.map((q) => q.metadata) : null;
|
|
8109
|
-
if (!(0,
|
|
8126
|
+
if (!(0, import_vinyl_util80.equalDeep)(newQualities, this._qualitiesUnfiltered)) {
|
|
8110
8127
|
const previous = this._qualitiesUnfiltered;
|
|
8111
8128
|
this._qualitiesUnfiltered = newQualities;
|
|
8112
8129
|
if (newQualities) {
|
|
@@ -8125,7 +8142,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8125
8142
|
timeline.getDuration().then((duration) => {
|
|
8126
8143
|
var _a, _b;
|
|
8127
8144
|
if (interrupted()) return;
|
|
8128
|
-
const start = (_b = (_a = (0,
|
|
8145
|
+
const start = (_b = (_a = (0, import_vinyl_util80.first)(timeline.periods)) == null ? void 0 : _a.startTime) != null ? _b : 0;
|
|
8129
8146
|
this.setSeekRange({
|
|
8130
8147
|
start,
|
|
8131
8148
|
end: start + duration
|
|
@@ -8155,7 +8172,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8155
8172
|
*/
|
|
8156
8173
|
createStream(contentType2) {
|
|
8157
8174
|
const stream = this.deps.contentStreamFactory(contentType2);
|
|
8158
|
-
(0,
|
|
8175
|
+
(0, import_vinyl_util80.redispatchEvents)(this, stream, [
|
|
8159
8176
|
"fetchedRangesChange",
|
|
8160
8177
|
"streamingQualityChange",
|
|
8161
8178
|
"bufferingQualityChange",
|
|
@@ -8172,7 +8189,6 @@ var MseTrack = class extends TrackBase {
|
|
|
8172
8189
|
this.dispatch("bufferingEnded", {});
|
|
8173
8190
|
}
|
|
8174
8191
|
});
|
|
8175
|
-
stream.on("hasDataChange", () => this.checkStalledSeek());
|
|
8176
8192
|
stream.on("fetchedRangesChange", () => {
|
|
8177
8193
|
this._fetchedRanges.invalidate();
|
|
8178
8194
|
});
|
|
@@ -8218,7 +8234,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8218
8234
|
* for example, changing streaming quality from SD to HD.
|
|
8219
8235
|
*/
|
|
8220
8236
|
clearPrefetch() {
|
|
8221
|
-
(0,
|
|
8237
|
+
(0, import_vinyl_util80.logDebug)(this, "clearPrefetch");
|
|
8222
8238
|
this.callOnStreams("clearPrefetch");
|
|
8223
8239
|
}
|
|
8224
8240
|
/**
|
|
@@ -8227,7 +8243,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8227
8243
|
*/
|
|
8228
8244
|
reset(hard = false) {
|
|
8229
8245
|
if (!hard && !this.error) {
|
|
8230
|
-
(0,
|
|
8246
|
+
(0, import_vinyl_util80.logDebug)(this, "reset no-op");
|
|
8231
8247
|
return;
|
|
8232
8248
|
}
|
|
8233
8249
|
super.reset(hard);
|
|
@@ -8308,39 +8324,11 @@ var MseTrack = class extends TrackBase {
|
|
|
8308
8324
|
get bufferingEnded() {
|
|
8309
8325
|
return this.streams.every((stream) => stream.bufferingEnded);
|
|
8310
8326
|
}
|
|
8311
|
-
/**
|
|
8312
|
-
* A seek only completes once every stream has data at the target, but on
|
|
8313
|
-
* some platforms the element can stay stuck `seeking` even after that. Once
|
|
8314
|
-
* all streams hold data, if we're still seeking a moment later, nudge the
|
|
8315
|
-
* playhead to prod the element into completing the seek.
|
|
8316
|
-
*/
|
|
8317
|
-
checkStalledSeek() {
|
|
8318
|
-
const { playbackController } = this.deps;
|
|
8319
|
-
if (this.stallNudgeTimer !== null || !playbackController.seeking) return;
|
|
8320
|
-
if (!this.streams.length || !this.streams.every((s) => s.hasData)) {
|
|
8321
|
-
return;
|
|
8322
|
-
}
|
|
8323
|
-
this.stallNudgeTimer = setTimeout(() => {
|
|
8324
|
-
this.stallNudgeTimer = null;
|
|
8325
|
-
if (this.disposed || !playbackController.seeking) return;
|
|
8326
|
-
if (!this.streams.every((s) => s.hasData)) return;
|
|
8327
|
-
const from = playbackController.currentTime;
|
|
8328
|
-
const to = from + PLAYHEAD_NUDGE;
|
|
8329
|
-
(0, import_vinyl_util84.logDebug)(
|
|
8330
|
-
this,
|
|
8331
|
-
"nudging playhead to recover a stalled seek",
|
|
8332
|
-
from,
|
|
8333
|
-
"->",
|
|
8334
|
-
to
|
|
8335
|
-
);
|
|
8336
|
-
playbackController.seekTo(to, 0).catch(import_vinyl_util84.noop);
|
|
8337
|
-
}, SEEKING_STALL_TIME_CHECK * 1e3);
|
|
8338
|
-
}
|
|
8339
8327
|
setContentTypes(contentTypes) {
|
|
8340
8328
|
if (this.disposed) return;
|
|
8341
8329
|
const previous = this.contentTypes;
|
|
8342
|
-
if ((0,
|
|
8343
|
-
(0,
|
|
8330
|
+
if ((0, import_vinyl_util80.equalDeep)(previous, contentTypes)) return;
|
|
8331
|
+
(0, import_vinyl_util80.logDebug)(this, "content types:", contentTypes);
|
|
8344
8332
|
if (previous.size) {
|
|
8345
8333
|
this.reset(
|
|
8346
8334
|
/* hard */
|
|
@@ -8358,8 +8346,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8358
8346
|
});
|
|
8359
8347
|
}
|
|
8360
8348
|
dispose() {
|
|
8361
|
-
(0,
|
|
8362
|
-
if (this.stallNudgeTimer !== null) clearTimeout(this.stallNudgeTimer);
|
|
8349
|
+
(0, import_vinyl_util80.logDebug)(this, "dispose");
|
|
8363
8350
|
this.clearStreams();
|
|
8364
8351
|
super.dispose();
|
|
8365
8352
|
}
|
|
@@ -8375,7 +8362,7 @@ var loadOptionsValidator3 = /* @__PURE__ */ trackLoadOptionsValidator.extend({
|
|
|
8375
8362
|
function createDashTrackFactory(deps) {
|
|
8376
8363
|
return {
|
|
8377
8364
|
validate(options) {
|
|
8378
|
-
loadOptionsValidator3.assert(options,
|
|
8365
|
+
loadOptionsValidator3.assert(options, import_vinyl_util81.ErrorOrigin.API);
|
|
8379
8366
|
},
|
|
8380
8367
|
createTrack(loadOptions) {
|
|
8381
8368
|
return new MseTrack(
|
|
@@ -8388,7 +8375,7 @@ function createDashTrackFactory(deps) {
|
|
|
8388
8375
|
}
|
|
8389
8376
|
|
|
8390
8377
|
// src/track/hls/HlsTrack.ts
|
|
8391
|
-
var
|
|
8378
|
+
var import_vinyl_util82 = require("@amazon/vinyl-util");
|
|
8392
8379
|
var import_vinyl_validation17 = require("@amazon/vinyl-validation");
|
|
8393
8380
|
var loadOptionsValidator4 = /* @__PURE__ */ trackLoadOptionsValidator.extend({
|
|
8394
8381
|
manifestProvider: /* @__PURE__ */ (0, import_vinyl_validation17.func)().maybe().optional(),
|
|
@@ -8399,7 +8386,7 @@ var loadOptionsValidator4 = /* @__PURE__ */ trackLoadOptionsValidator.extend({
|
|
|
8399
8386
|
function createHlsTrackFactory(deps) {
|
|
8400
8387
|
return {
|
|
8401
8388
|
validate(options) {
|
|
8402
|
-
loadOptionsValidator4.assert(options,
|
|
8389
|
+
loadOptionsValidator4.assert(options, import_vinyl_util82.ErrorOrigin.API);
|
|
8403
8390
|
},
|
|
8404
8391
|
createTrack(loadOptions) {
|
|
8405
8392
|
return new MseTrack(
|
|
@@ -8422,7 +8409,7 @@ function createVinylTrackFactories(deps) {
|
|
|
8422
8409
|
}
|
|
8423
8410
|
|
|
8424
8411
|
// src/track/dash/util/mpd.ts
|
|
8425
|
-
var
|
|
8412
|
+
var import_vinyl_util83 = require("@amazon/vinyl-util");
|
|
8426
8413
|
|
|
8427
8414
|
// src/track/mse/codec.ts
|
|
8428
8415
|
var VIDEO_CODEC_PREFIXES = [
|
|
@@ -8525,19 +8512,24 @@ function getRepresentationAncestry(representation) {
|
|
|
8525
8512
|
}
|
|
8526
8513
|
function mergeIfAnyDefined(...sources) {
|
|
8527
8514
|
if (!sources.some((source) => source)) return void 0;
|
|
8528
|
-
return (0,
|
|
8515
|
+
return (0, import_vinyl_util83.merge)(...sources);
|
|
8529
8516
|
}
|
|
8530
8517
|
function calculatePeriodTimeRange(period) {
|
|
8531
8518
|
return [calculatePeriodStart(period), calculatePeriodEnd(period)];
|
|
8532
8519
|
}
|
|
8533
8520
|
function calculatePeriodStart(period) {
|
|
8534
|
-
|
|
8535
|
-
|
|
8521
|
+
if (period.start != null) return period.start;
|
|
8522
|
+
const mpd = period.parent;
|
|
8523
|
+
const periodIndex = mpd.Period.indexOf(period);
|
|
8524
|
+
if (periodIndex <= 0) return 0;
|
|
8525
|
+
const previous = mpd.Period[periodIndex - 1];
|
|
8526
|
+
const previousStart = calculatePeriodStart(previous);
|
|
8527
|
+
return previous.duration != null ? previousStart + previous.duration : previousStart;
|
|
8536
8528
|
}
|
|
8537
8529
|
function calculatePeriodEnd(period) {
|
|
8538
8530
|
var _a;
|
|
8539
|
-
if (period.
|
|
8540
|
-
return period
|
|
8531
|
+
if (period.duration != null)
|
|
8532
|
+
return calculatePeriodStart(period) + period.duration;
|
|
8541
8533
|
const mpd = period.parent;
|
|
8542
8534
|
const periodIndex = mpd.Period.indexOf(period);
|
|
8543
8535
|
if (periodIndex < mpd.Period.length - 1)
|
|
@@ -8548,7 +8540,7 @@ function sampleToMpdTime(sampleTime, periodStart, presentationTimeOffset, timesc
|
|
|
8548
8540
|
return periodStart + (sampleTime - presentationTimeOffset) / timescale;
|
|
8549
8541
|
}
|
|
8550
8542
|
function getPeriodAtTime(manifest, time) {
|
|
8551
|
-
const index = (0,
|
|
8543
|
+
const index = (0, import_vinyl_util83.sortedInsertionIndex)(manifest.MPD.Period, time, (time2, period2) => {
|
|
8552
8544
|
return time2 - calculatePeriodStart(period2);
|
|
8553
8545
|
}) - 1;
|
|
8554
8546
|
if (index < 0) return null;
|
|
@@ -8577,7 +8569,7 @@ function calculateDuration(manifest) {
|
|
|
8577
8569
|
if (manifest.MPD.type === "dynamic") return Infinity;
|
|
8578
8570
|
const mpdDuration = manifest.MPD.mediaPresentationDuration;
|
|
8579
8571
|
if (mpdDuration != null) return mpdDuration;
|
|
8580
|
-
const lastPeriod = (0,
|
|
8572
|
+
const lastPeriod = (0, import_vinyl_util83.last)(manifest.MPD.Period);
|
|
8581
8573
|
if (!lastPeriod) {
|
|
8582
8574
|
throw new Error("Unable to determine manifest duration: no periods");
|
|
8583
8575
|
}
|
|
@@ -8589,10 +8581,10 @@ function calculateDuration(manifest) {
|
|
|
8589
8581
|
}
|
|
8590
8582
|
|
|
8591
8583
|
// src/track/dash/timeline/DashRepresentationSegmentProvider.ts
|
|
8592
|
-
var
|
|
8584
|
+
var import_vinyl_util85 = require("@amazon/vinyl-util");
|
|
8593
8585
|
|
|
8594
8586
|
// src/track/dash/util/uriResolution.ts
|
|
8595
|
-
var
|
|
8587
|
+
var import_vinyl_util84 = require("@amazon/vinyl-util");
|
|
8596
8588
|
var pickFirstBaseUrlSelector = {
|
|
8597
8589
|
selectBaseUrl(baseUrls) {
|
|
8598
8590
|
return baseUrls[0];
|
|
@@ -8607,17 +8599,17 @@ function resolveDashUri(deps, options) {
|
|
|
8607
8599
|
scopeChain.forEach((scope) => {
|
|
8608
8600
|
if (scope.BaseURL && scope.BaseURL.length) {
|
|
8609
8601
|
const selectedBaseUrl = baseUrlSelector.selectBaseUrl(scope.BaseURL);
|
|
8610
|
-
resolved = (0,
|
|
8602
|
+
resolved = (0, import_vinyl_util84.resolveUrl)(selectedBaseUrl._content, resolved);
|
|
8611
8603
|
if (selectedBaseUrl.serviceLocation)
|
|
8612
8604
|
serviceLocation = selectedBaseUrl.serviceLocation;
|
|
8613
8605
|
}
|
|
8614
8606
|
});
|
|
8615
8607
|
if (uri != null) {
|
|
8616
|
-
resolved = (0,
|
|
8608
|
+
resolved = (0, import_vinyl_util84.resolveUrl)(uri, resolved);
|
|
8617
8609
|
} else if (resolved === baseUrl) {
|
|
8618
|
-
throw new
|
|
8610
|
+
throw new import_vinyl_util84.ValidationError(
|
|
8619
8611
|
"media missing URI or BaseURL",
|
|
8620
|
-
|
|
8612
|
+
import_vinyl_util84.ErrorOrigin.MEDIA
|
|
8621
8613
|
);
|
|
8622
8614
|
}
|
|
8623
8615
|
return { url: resolved, serviceLocation };
|
|
@@ -8625,15 +8617,15 @@ function resolveDashUri(deps, options) {
|
|
|
8625
8617
|
function segmentTemplateUrl(uri, options) {
|
|
8626
8618
|
var _a, _b;
|
|
8627
8619
|
try {
|
|
8628
|
-
return (0,
|
|
8620
|
+
return (0, import_vinyl_util84.substituteIdentifiers)(uri, {
|
|
8629
8621
|
Bandwidth: options.representation.bandwidth,
|
|
8630
8622
|
Number: (_a = options.segmentNumber) != null ? _a : 0,
|
|
8631
8623
|
RepresentationID: options.representation.id,
|
|
8632
8624
|
Time: (_b = options.sampleTime) != null ? _b : 0
|
|
8633
8625
|
});
|
|
8634
8626
|
} catch (error) {
|
|
8635
|
-
if (error instanceof
|
|
8636
|
-
throw new
|
|
8627
|
+
if (error instanceof import_vinyl_util84.IllegalArgumentError) {
|
|
8628
|
+
throw new import_vinyl_util84.ValidationError(error.message, import_vinyl_util84.ErrorOrigin.MEDIA);
|
|
8637
8629
|
} else {
|
|
8638
8630
|
throw error;
|
|
8639
8631
|
}
|
|
@@ -8662,9 +8654,9 @@ function createDashRepresentationSegmentProvider(deps, baseUrl, representation)
|
|
|
8662
8654
|
}
|
|
8663
8655
|
const commonSegmentBase = (_a = segmentTemplate != null ? segmentTemplate : segmentList) != null ? _a : segmentBase;
|
|
8664
8656
|
if (!commonSegmentBase) {
|
|
8665
|
-
throw new
|
|
8657
|
+
throw new import_vinyl_util85.ValidationError(
|
|
8666
8658
|
"Manifest must have one of SegmentList, SegmentTemplate, or SegmentBase",
|
|
8667
|
-
|
|
8659
|
+
import_vinyl_util85.ErrorOrigin.MEDIA
|
|
8668
8660
|
);
|
|
8669
8661
|
}
|
|
8670
8662
|
if (commonSegmentBase.Initialization) {
|
|
@@ -8672,9 +8664,9 @@ function createDashRepresentationSegmentProvider(deps, baseUrl, representation)
|
|
|
8672
8664
|
initRange = commonSegmentBase.Initialization.range;
|
|
8673
8665
|
}
|
|
8674
8666
|
if (!initUri && !initRange)
|
|
8675
|
-
throw new
|
|
8667
|
+
throw new import_vinyl_util85.ValidationError(
|
|
8676
8668
|
"Missing initialization range",
|
|
8677
|
-
|
|
8669
|
+
import_vinyl_util85.ErrorOrigin.MEDIA
|
|
8678
8670
|
);
|
|
8679
8671
|
const { url: initUrl, serviceLocation: initServiceLocation } = resolveDashUri(deps, { baseUrl, representation, uri: initUri });
|
|
8680
8672
|
const initData = createSegmentDataProvider(deps, {
|
|
@@ -8693,9 +8685,13 @@ function createDashRepresentationSegmentProvider(deps, baseUrl, representation)
|
|
|
8693
8685
|
segmentTemplate
|
|
8694
8686
|
}));
|
|
8695
8687
|
} else if (segmentBase) {
|
|
8696
|
-
getSegmentReferences = () => createSegmentsFromSegmentBase(
|
|
8697
|
-
|
|
8698
|
-
|
|
8688
|
+
getSegmentReferences = () => createSegmentsFromSegmentBase(
|
|
8689
|
+
deps,
|
|
8690
|
+
__spreadProps(__spreadValues({}, options), {
|
|
8691
|
+
segmentBase
|
|
8692
|
+
}),
|
|
8693
|
+
initData
|
|
8694
|
+
);
|
|
8699
8695
|
}
|
|
8700
8696
|
return {
|
|
8701
8697
|
async getSegment(time, affordance = 0) {
|
|
@@ -8752,14 +8748,14 @@ function createSegmentsFromSegmentList(deps, options) {
|
|
|
8752
8748
|
);
|
|
8753
8749
|
} else {
|
|
8754
8750
|
if (segmentList.href) {
|
|
8755
|
-
throw new
|
|
8751
|
+
throw new import_vinyl_util85.ValidationError(
|
|
8756
8752
|
"SegmentList.href currently unsupported",
|
|
8757
|
-
|
|
8753
|
+
import_vinyl_util85.ErrorOrigin.MEDIA
|
|
8758
8754
|
);
|
|
8759
8755
|
} else {
|
|
8760
|
-
throw new
|
|
8756
|
+
throw new import_vinyl_util85.ValidationError(
|
|
8761
8757
|
"could not determine segments from SegmentList",
|
|
8762
|
-
|
|
8758
|
+
import_vinyl_util85.ErrorOrigin.MEDIA
|
|
8763
8759
|
);
|
|
8764
8760
|
}
|
|
8765
8761
|
}
|
|
@@ -8768,9 +8764,9 @@ function createSegmentsFromSegmentTemplate(deps, options) {
|
|
|
8768
8764
|
var _a, _b;
|
|
8769
8765
|
const { baseUrl, periodTimeRange, representation, segmentTemplate } = options;
|
|
8770
8766
|
if (!segmentTemplate.media) {
|
|
8771
|
-
throw new
|
|
8767
|
+
throw new import_vinyl_util85.ValidationError(
|
|
8772
8768
|
"SegmentTemplate.media required",
|
|
8773
|
-
|
|
8769
|
+
import_vinyl_util85.ErrorOrigin.MEDIA
|
|
8774
8770
|
);
|
|
8775
8771
|
}
|
|
8776
8772
|
const media = segmentTemplate.media;
|
|
@@ -8807,13 +8803,17 @@ function createSegmentsFromSegmentTemplate(deps, options) {
|
|
|
8807
8803
|
}
|
|
8808
8804
|
);
|
|
8809
8805
|
}
|
|
8810
|
-
async function createSegmentsFromSegmentBase(deps, options) {
|
|
8806
|
+
async function createSegmentsFromSegmentBase(deps, options, initData) {
|
|
8811
8807
|
var _a;
|
|
8812
8808
|
const { baseUrl, periodTimeRange, representation, segmentBase } = options;
|
|
8813
8809
|
if (segmentBase.indexRange) {
|
|
8810
|
+
const { mimeType } = getRepresentationMimeInfo(representation);
|
|
8811
|
+
if (mimeType == null ? void 0 : mimeType.includes("webm")) {
|
|
8812
|
+
return createSegmentsFromWebmCues(deps, options, initData);
|
|
8813
|
+
}
|
|
8814
8814
|
const indexRange = segmentBase.indexRange;
|
|
8815
8815
|
const { url: indexUrl, serviceLocation: indexServiceLocation } = resolveDashUri(deps, { baseUrl, representation });
|
|
8816
|
-
const sidx = (0,
|
|
8816
|
+
const sidx = (0, import_vinyl_util85.parseSidxBox)(
|
|
8817
8817
|
await createSegmentDataProvider(deps, {
|
|
8818
8818
|
url: indexUrl,
|
|
8819
8819
|
mediaRange: indexRange,
|
|
@@ -8821,7 +8821,7 @@ async function createSegmentsFromSegmentBase(deps, options) {
|
|
|
8821
8821
|
reportDownlinkMetrics: false
|
|
8822
8822
|
})()
|
|
8823
8823
|
);
|
|
8824
|
-
const sampleTimes = (0,
|
|
8824
|
+
const sampleTimes = (0, import_vinyl_util85.getSidxSampleTimes)(sidx);
|
|
8825
8825
|
let rangeStart = Number(sidx.firstOffset) + indexRange[1] + 1;
|
|
8826
8826
|
return createTimeline(
|
|
8827
8827
|
{
|
|
@@ -8844,8 +8844,58 @@ async function createSegmentsFromSegmentBase(deps, options) {
|
|
|
8844
8844
|
}
|
|
8845
8845
|
);
|
|
8846
8846
|
} else {
|
|
8847
|
-
throw new
|
|
8847
|
+
throw new import_vinyl_util85.ValidationError("Manifest missing segments");
|
|
8848
|
+
}
|
|
8849
|
+
}
|
|
8850
|
+
async function createSegmentsFromWebmCues(deps, options, initData) {
|
|
8851
|
+
var _a, _b;
|
|
8852
|
+
const { baseUrl, periodTimeRange, representation, segmentBase } = options;
|
|
8853
|
+
const indexRange = segmentBase.indexRange;
|
|
8854
|
+
const { url, serviceLocation } = resolveDashUri(deps, {
|
|
8855
|
+
baseUrl,
|
|
8856
|
+
representation
|
|
8857
|
+
});
|
|
8858
|
+
const [{ segmentDataStart, timecodeScale }, cues] = await Promise.all([
|
|
8859
|
+
Promise.resolve(initData()).then(import_vinyl_util85.parseWebmInit),
|
|
8860
|
+
createSegmentDataProvider(deps, {
|
|
8861
|
+
url,
|
|
8862
|
+
mediaRange: indexRange,
|
|
8863
|
+
serviceId: serviceLocation,
|
|
8864
|
+
reportDownlinkMetrics: false
|
|
8865
|
+
})().then(import_vinyl_util85.parseWebmCues)
|
|
8866
|
+
]);
|
|
8867
|
+
if (!cues.length) {
|
|
8868
|
+
throw new import_vinyl_util85.ValidationError("WebM Cues contained no cue points");
|
|
8848
8869
|
}
|
|
8870
|
+
const ticksPerSecond = Math.round(1e9 / timecodeScale);
|
|
8871
|
+
const manifestTimescale = (_a = segmentBase.timescale) != null ? _a : ticksPerSecond;
|
|
8872
|
+
const presentationTimeOffset = ((_b = segmentBase.presentationTimeOffset) != null ? _b : 0) * ticksPerSecond / manifestTimescale;
|
|
8873
|
+
const [, periodEnd] = periodTimeRange;
|
|
8874
|
+
if (periodEnd == null)
|
|
8875
|
+
throw new import_vinyl_util85.ValidationError(
|
|
8876
|
+
"MPD.mediaPresentationDuration or Period.duration required",
|
|
8877
|
+
import_vinyl_util85.ErrorOrigin.MEDIA
|
|
8878
|
+
);
|
|
8879
|
+
const sampleTimes = cues.map((cue) => cue.time);
|
|
8880
|
+
sampleTimes.push(periodEnd * ticksPerSecond);
|
|
8881
|
+
return createTimeline(
|
|
8882
|
+
{
|
|
8883
|
+
sampleTimes,
|
|
8884
|
+
periodTimeRange,
|
|
8885
|
+
presentationTimeOffset,
|
|
8886
|
+
timescale: ticksPerSecond
|
|
8887
|
+
},
|
|
8888
|
+
(i) => {
|
|
8889
|
+
const start = segmentDataStart + cues[i].clusterPosition;
|
|
8890
|
+
const end = i < cues.length - 1 ? segmentDataStart + cues[i + 1].clusterPosition - 1 : null;
|
|
8891
|
+
return createSegmentDataProvider(deps, {
|
|
8892
|
+
url,
|
|
8893
|
+
mediaRange: [start, end],
|
|
8894
|
+
serviceId: serviceLocation,
|
|
8895
|
+
reportDownlinkMetrics: true
|
|
8896
|
+
});
|
|
8897
|
+
}
|
|
8898
|
+
);
|
|
8849
8899
|
}
|
|
8850
8900
|
function calculateSegmentSampleTimes(options) {
|
|
8851
8901
|
const { multipleSegmentBase, periodTimeRange } = options;
|
|
@@ -8886,9 +8936,9 @@ function calculateFixedSegmentSampleTimes(options) {
|
|
|
8886
8936
|
const { sampleDuration, timescale } = options;
|
|
8887
8937
|
const [periodStart, periodEnd] = options.periodTimeRange;
|
|
8888
8938
|
if (periodEnd == null)
|
|
8889
|
-
throw new
|
|
8939
|
+
throw new import_vinyl_util85.ValidationError(
|
|
8890
8940
|
"MPD.mediaPresentationDuration or Period.duration required",
|
|
8891
|
-
|
|
8941
|
+
import_vinyl_util85.ErrorOrigin.MEDIA
|
|
8892
8942
|
);
|
|
8893
8943
|
const numSegments = (_a = options.numSegments) != null ? _a : Math.ceil((periodEnd - periodStart) / (sampleDuration / timescale));
|
|
8894
8944
|
const out = new Array(numSegments + 1);
|
|
@@ -8931,12 +8981,12 @@ function createTimeline({
|
|
|
8931
8981
|
}
|
|
8932
8982
|
function getTimescale(multipleSegmentBase) {
|
|
8933
8983
|
if (!multipleSegmentBase.timescale)
|
|
8934
|
-
throw new
|
|
8984
|
+
throw new import_vinyl_util85.ValidationError("invalid timescale", import_vinyl_util85.ErrorOrigin.MEDIA);
|
|
8935
8985
|
return multipleSegmentBase.timescale;
|
|
8936
8986
|
}
|
|
8937
8987
|
function getSampleDuration(multipleSegmentBase) {
|
|
8938
8988
|
if (!multipleSegmentBase.duration)
|
|
8939
|
-
throw new
|
|
8989
|
+
throw new import_vinyl_util85.ValidationError("invalid duration", import_vinyl_util85.ErrorOrigin.MEDIA);
|
|
8940
8990
|
return multipleSegmentBase.duration;
|
|
8941
8991
|
}
|
|
8942
8992
|
|
|
@@ -8975,10 +9025,10 @@ function buildDashMediaTimeline(deps, data3) {
|
|
|
8975
9025
|
}
|
|
8976
9026
|
|
|
8977
9027
|
// src/track/dash/createDashContentStreamFactories.ts
|
|
8978
|
-
var
|
|
9028
|
+
var import_vinyl_util86 = require("@amazon/vinyl-util");
|
|
8979
9029
|
var import_vinyl_di3 = require("@amazon/vinyl-di");
|
|
8980
9030
|
function createDashContentStreamFactories(options) {
|
|
8981
|
-
return (deps) => (0,
|
|
9031
|
+
return (deps) => (0, import_vinyl_util86.memoize)(
|
|
8982
9032
|
(contentType2) => {
|
|
8983
9033
|
return (0, import_vinyl_di3.validateFactories)(__spreadProps(__spreadValues({}, (0, import_vinyl_di3.externalDependencies)(deps)), {
|
|
8984
9034
|
sourceBufferControllerFactory: (deps2) => () => new SourceBufferControllerImpl(deps2, contentType2),
|
|
@@ -9019,10 +9069,10 @@ function getContentTypes(deps, manifest) {
|
|
|
9019
9069
|
}
|
|
9020
9070
|
|
|
9021
9071
|
// src/track/dash/createDefaultDashManifestTransformer.ts
|
|
9022
|
-
var
|
|
9072
|
+
var import_vinyl_util88 = require("@amazon/vinyl-util");
|
|
9023
9073
|
|
|
9024
9074
|
// src/track/dash/manifestTransformUtils.ts
|
|
9025
|
-
var
|
|
9075
|
+
var import_vinyl_util87 = require("@amazon/vinyl-util");
|
|
9026
9076
|
function manifestIsPlayable(manifest) {
|
|
9027
9077
|
return manifest.MPD.Period.every(
|
|
9028
9078
|
(period) => {
|
|
@@ -9037,7 +9087,7 @@ function manifestIsPlayable(manifest) {
|
|
|
9037
9087
|
);
|
|
9038
9088
|
}
|
|
9039
9089
|
function filterDashRepresentations(filter, throwError, manifest) {
|
|
9040
|
-
const result = (0,
|
|
9090
|
+
const result = (0, import_vinyl_util87.clone)(manifest);
|
|
9041
9091
|
for (const period of result.MPD.Period) {
|
|
9042
9092
|
if (period.AdaptationSet) {
|
|
9043
9093
|
for (const adaptationSet of period.AdaptationSet) {
|
|
@@ -9053,7 +9103,7 @@ function filterDashRepresentations(filter, throwError, manifest) {
|
|
|
9053
9103
|
return result;
|
|
9054
9104
|
}
|
|
9055
9105
|
function filterDashAdaptationSets(filter, throwError, manifest) {
|
|
9056
|
-
const result = (0,
|
|
9106
|
+
const result = (0, import_vinyl_util87.clone)(manifest);
|
|
9057
9107
|
for (const period of result.MPD.Period) {
|
|
9058
9108
|
if (period.AdaptationSet) {
|
|
9059
9109
|
period.AdaptationSet = period.AdaptationSet.filter(filter);
|
|
@@ -9066,14 +9116,14 @@ function filterDashAdaptationSets(filter, throwError, manifest) {
|
|
|
9066
9116
|
}
|
|
9067
9117
|
function sortDashAdaptationSets(comparator, manifest) {
|
|
9068
9118
|
var _a;
|
|
9069
|
-
const result = (0,
|
|
9119
|
+
const result = (0, import_vinyl_util87.clone)(manifest);
|
|
9070
9120
|
for (const period of result.MPD.Period) {
|
|
9071
9121
|
(_a = period.AdaptationSet) == null ? void 0 : _a.sort(comparator);
|
|
9072
9122
|
}
|
|
9073
9123
|
return result;
|
|
9074
9124
|
}
|
|
9075
9125
|
function sortDashRepresentations(comparator, manifest) {
|
|
9076
|
-
const result = (0,
|
|
9126
|
+
const result = (0, import_vinyl_util87.clone)(manifest);
|
|
9077
9127
|
for (const period of result.MPD.Period) {
|
|
9078
9128
|
if (period.AdaptationSet) {
|
|
9079
9129
|
for (const adaptationSet of period.AdaptationSet) {
|
|
@@ -9108,21 +9158,21 @@ function createDefaultDashManifestTransformer(deps) {
|
|
|
9108
9158
|
});
|
|
9109
9159
|
}
|
|
9110
9160
|
function createDefaultAdaptationSetComparator() {
|
|
9111
|
-
return (0,
|
|
9161
|
+
return (0, import_vinyl_util88.compareBy)((adaptationSet) => -adaptationSet.selectionPriority);
|
|
9112
9162
|
}
|
|
9113
9163
|
function createDefaultRepresentationComparator() {
|
|
9114
|
-
return (0,
|
|
9164
|
+
return (0, import_vinyl_util88.compareBy)(
|
|
9115
9165
|
(representation) => representation.qualityRanking,
|
|
9116
9166
|
(representation) => -representation.bandwidth
|
|
9117
9167
|
);
|
|
9118
9168
|
}
|
|
9119
9169
|
|
|
9120
9170
|
// src/track/dash/DashMediaQualityMetadataResolver.ts
|
|
9121
|
-
var
|
|
9171
|
+
var import_vinyl_util89 = require("@amazon/vinyl-util");
|
|
9122
9172
|
var import_vinyl_mpd_parser3 = require("@amazon/vinyl-mpd-parser");
|
|
9123
9173
|
var ADAPTATION_SET_SWITCHING_SCHEME = "urn:mpeg:dash:adaptation-set-switching:2016";
|
|
9124
9174
|
function createDefaultDashMediaQualityMetadataResolver(deps) {
|
|
9125
|
-
return (0,
|
|
9175
|
+
return (0, import_vinyl_util89.memoize)(
|
|
9126
9176
|
(representation) => createMediaQualityMetadataFromDashRepresentation(
|
|
9127
9177
|
representation,
|
|
9128
9178
|
deps
|
|
@@ -9135,9 +9185,9 @@ function createMediaQualityMetadataFromDashRepresentation(representation, deps)
|
|
|
9135
9185
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9136
9186
|
const { contentType: contentType2, mimeType } = getRepresentationMimeInfo(representation);
|
|
9137
9187
|
if (!contentType2 || !mimeType)
|
|
9138
|
-
throw new
|
|
9188
|
+
throw new import_vinyl_util89.ValidationError(
|
|
9139
9189
|
"mimeType cannot be inferred",
|
|
9140
|
-
|
|
9190
|
+
import_vinyl_util89.ErrorOrigin.MEDIA
|
|
9141
9191
|
);
|
|
9142
9192
|
const adaptationSet = representation.parent;
|
|
9143
9193
|
const period = adaptationSet.parent;
|
|
@@ -9211,21 +9261,20 @@ function estimatePeakBandwidth(representation, contentType2) {
|
|
|
9211
9261
|
if (!own || own.length === 0) return representation.bandwidth;
|
|
9212
9262
|
const ownIndex = Math.max(
|
|
9213
9263
|
0,
|
|
9214
|
-
(0,
|
|
9264
|
+
(0, import_vinyl_util89.sortedInsertionIndex)(own, representation.bandwidth, (a, b) => b - a) - 1
|
|
9215
9265
|
);
|
|
9216
|
-
const position = own.length <= 1 ? 0 : ownIndex / (own.length - 1);
|
|
9217
9266
|
let total = representation.bandwidth;
|
|
9218
9267
|
for (const [ct, bandwidths] of sortedByType) {
|
|
9219
9268
|
if (ct === contentType2) continue;
|
|
9220
9269
|
const peerIndex = Math.min(
|
|
9221
|
-
|
|
9222
|
-
bandwidths.length - 1
|
|
9270
|
+
bandwidths.length - 1,
|
|
9271
|
+
Math.ceil((ownIndex + 1) / own.length * bandwidths.length) - 1
|
|
9223
9272
|
);
|
|
9224
9273
|
total += bandwidths[peerIndex];
|
|
9225
9274
|
}
|
|
9226
9275
|
return total;
|
|
9227
9276
|
}
|
|
9228
|
-
var getPeriodSortedBandwidths = /* @__PURE__ */ (0,
|
|
9277
|
+
var getPeriodSortedBandwidths = /* @__PURE__ */ (0, import_vinyl_util89.memoize)(
|
|
9229
9278
|
(period) => {
|
|
9230
9279
|
var _a, _b;
|
|
9231
9280
|
const byType = /* @__PURE__ */ new Map();
|
|
@@ -9233,11 +9282,11 @@ var getPeriodSortedBandwidths = /* @__PURE__ */ (0, import_vinyl_util93.memoize)
|
|
|
9233
9282
|
for (const rep of (_b = as.Representation) != null ? _b : []) {
|
|
9234
9283
|
const contentType2 = getRepresentationMimeInfo(rep).contentType;
|
|
9235
9284
|
if (!contentType2) continue;
|
|
9236
|
-
const arr = (0,
|
|
9285
|
+
const arr = (0, import_vinyl_util89.getOrSet)(byType, contentType2, () => []);
|
|
9237
9286
|
if (!arr.some(
|
|
9238
9287
|
(existing) => Math.abs(existing - rep.bandwidth) / existing < 0.1
|
|
9239
9288
|
)) {
|
|
9240
|
-
const index = (0,
|
|
9289
|
+
const index = (0, import_vinyl_util89.sortedInsertionIndex)(
|
|
9241
9290
|
arr,
|
|
9242
9291
|
rep.bandwidth,
|
|
9243
9292
|
(a, b) => b - a
|
|
@@ -9266,7 +9315,7 @@ function mapDescriptors(descriptors) {
|
|
|
9266
9315
|
var _a, _b;
|
|
9267
9316
|
const out = {};
|
|
9268
9317
|
for (const descriptor of descriptors) {
|
|
9269
|
-
const arr = (0,
|
|
9318
|
+
const arr = (0, import_vinyl_util89.getOrSetProp)(out, descriptor.schemeIdUri, () => []);
|
|
9270
9319
|
arr.push({
|
|
9271
9320
|
id: (_a = descriptor.id) != null ? _a : null,
|
|
9272
9321
|
value: (_b = descriptor.value) != null ? _b : null
|
|
@@ -9291,27 +9340,27 @@ function resolveAdaptationSetSwitchingGroupIds(adaptationSet, periodId, adaptati
|
|
|
9291
9340
|
var import_vinyl_di4 = require("@amazon/vinyl-di");
|
|
9292
9341
|
|
|
9293
9342
|
// src/track/dash/urlDashManifestProvider.ts
|
|
9294
|
-
var
|
|
9295
|
-
var
|
|
9296
|
-
var
|
|
9343
|
+
var import_vinyl_util90 = require("@amazon/vinyl-util");
|
|
9344
|
+
var import_vinyl_util91 = require("@amazon/vinyl-util");
|
|
9345
|
+
var import_vinyl_util92 = require("@amazon/vinyl-util");
|
|
9297
9346
|
var import_vinyl_mpd_parser4 = require("@amazon/vinyl-mpd-parser");
|
|
9298
|
-
function urlDashManifestProvider(input, init, requestInterceptor =
|
|
9347
|
+
function urlDashManifestProvider(input, init, requestInterceptor = import_vinyl_util90.noop) {
|
|
9299
9348
|
return async (abort) => {
|
|
9300
9349
|
var _a;
|
|
9301
9350
|
const params = {
|
|
9302
|
-
input: (0,
|
|
9303
|
-
init: (_a = (0,
|
|
9351
|
+
input: (0, import_vinyl_util91.resolveUrl)(input, (0, import_vinyl_util91.getLocation)().href),
|
|
9352
|
+
init: (_a = (0, import_vinyl_util91.clone)(init)) != null ? _a : {}
|
|
9304
9353
|
};
|
|
9305
9354
|
requestInterceptor(params);
|
|
9306
|
-
const response = await (0,
|
|
9355
|
+
const response = await (0, import_vinyl_util92.requestWithRetry)(params.input, params.init, {
|
|
9307
9356
|
abort
|
|
9308
9357
|
});
|
|
9309
|
-
const xml = await response
|
|
9358
|
+
const xml = await (0, import_vinyl_util92.readResponseBody)(response, "text");
|
|
9310
9359
|
const manifest = (0, import_vinyl_mpd_parser4.parseDashManifest)(xml);
|
|
9311
9360
|
const baseInput = response.url || params.input;
|
|
9312
9361
|
return {
|
|
9313
9362
|
manifest,
|
|
9314
|
-
baseUrl: (0,
|
|
9363
|
+
baseUrl: (0, import_vinyl_util91.resolveUrl)("./", baseInput)
|
|
9315
9364
|
};
|
|
9316
9365
|
};
|
|
9317
9366
|
}
|
|
@@ -9395,7 +9444,7 @@ function hlsByteRangeToMediaRange(byteRange) {
|
|
|
9395
9444
|
}
|
|
9396
9445
|
|
|
9397
9446
|
// src/track/hls/util/hlsSegmentTime.ts
|
|
9398
|
-
var
|
|
9447
|
+
var import_vinyl_util93 = require("@amazon/vinyl-util");
|
|
9399
9448
|
function buildSegmentTimeline(deps, baseUrl, segments) {
|
|
9400
9449
|
const out = new Array(
|
|
9401
9450
|
segments.length
|
|
@@ -9405,7 +9454,7 @@ function buildSegmentTimeline(deps, baseUrl, segments) {
|
|
|
9405
9454
|
const seg = segments[i];
|
|
9406
9455
|
const startTime = time;
|
|
9407
9456
|
const endTime = time + seg.duration;
|
|
9408
|
-
const url = (0,
|
|
9457
|
+
const url = (0, import_vinyl_util93.resolveUrl)(seg.uri, baseUrl);
|
|
9409
9458
|
out[i] = {
|
|
9410
9459
|
timestampOffset: startTime,
|
|
9411
9460
|
startTime,
|
|
@@ -9422,7 +9471,7 @@ function buildSegmentTimeline(deps, baseUrl, segments) {
|
|
|
9422
9471
|
}
|
|
9423
9472
|
|
|
9424
9473
|
// src/track/hls/buildHlsMediaTimeline.ts
|
|
9425
|
-
var
|
|
9474
|
+
var import_vinyl_util94 = require("@amazon/vinyl-util");
|
|
9426
9475
|
var import_vinyl_transmux = require("@amazon/vinyl-transmux");
|
|
9427
9476
|
function buildHlsMediaTimeline(deps, data3) {
|
|
9428
9477
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -9524,7 +9573,7 @@ function createHlsQualityData(deps, data3, baseUrl, playlistUri, metadata) {
|
|
|
9524
9573
|
async getSegment(time, affordance = 0) {
|
|
9525
9574
|
var _a;
|
|
9526
9575
|
const playlist = await data3.getMediaPlaylist(playlistUri);
|
|
9527
|
-
const playlistBaseUrl = (0,
|
|
9576
|
+
const playlistBaseUrl = (0, import_vinyl_util94.resolveUrl)(playlistUri, baseUrl);
|
|
9528
9577
|
const segments = buildSegmentTimeline(
|
|
9529
9578
|
deps,
|
|
9530
9579
|
playlistBaseUrl,
|
|
@@ -9538,7 +9587,7 @@ function createHlsQualityData(deps, data3, baseUrl, playlistUri, metadata) {
|
|
|
9538
9587
|
quality: metadata
|
|
9539
9588
|
}, segment), {
|
|
9540
9589
|
initData: createSegmentDataProvider(deps, {
|
|
9541
|
-
url: (0,
|
|
9590
|
+
url: (0, import_vinyl_util94.resolveUrl)(hlsMap.uri, playlistBaseUrl),
|
|
9542
9591
|
mediaRange: hlsMap.byteRange ? hlsByteRangeToMediaRange(hlsMap.byteRange) : void 0,
|
|
9543
9592
|
reportDownlinkMetrics: false
|
|
9544
9593
|
})
|
|
@@ -9571,7 +9620,7 @@ async function discoverAdsFromManifest(data3) {
|
|
|
9571
9620
|
const variant = data3.mainPlaylist.variants[0];
|
|
9572
9621
|
const media = await data3.getMediaPlaylist(variant.uri);
|
|
9573
9622
|
const contentDuration = media.ended ? media.segments.reduce((sum, s) => sum + s.duration, 0) : null;
|
|
9574
|
-
const playlistBaseUrl = (0,
|
|
9623
|
+
const playlistBaseUrl = (0, import_vinyl_util94.resolveUrl)(variant.uri, data3.baseUrl);
|
|
9575
9624
|
return discoverHlsInterstitials(media, playlistBaseUrl, contentDuration);
|
|
9576
9625
|
}
|
|
9577
9626
|
|
|
@@ -9591,10 +9640,10 @@ function createDefaultHlsManifestTransformer(deps) {
|
|
|
9591
9640
|
}
|
|
9592
9641
|
|
|
9593
9642
|
// src/track/hls/createHlsContentStreamFactories.ts
|
|
9594
|
-
var
|
|
9643
|
+
var import_vinyl_util95 = require("@amazon/vinyl-util");
|
|
9595
9644
|
var import_vinyl_di5 = require("@amazon/vinyl-di");
|
|
9596
9645
|
function createHlsContentStreamFactories(options) {
|
|
9597
|
-
return (deps) => (0,
|
|
9646
|
+
return (deps) => (0, import_vinyl_util95.memoize)(
|
|
9598
9647
|
(contentType2) => {
|
|
9599
9648
|
return (0, import_vinyl_di5.validateFactories)(__spreadProps(__spreadValues({}, (0, import_vinyl_di5.externalDependencies)(deps)), {
|
|
9600
9649
|
sourceBufferControllerFactory: (deps2) => () => new SourceBufferControllerImpl(deps2, contentType2),
|
|
@@ -9679,19 +9728,19 @@ var import_vinyl_di6 = require("@amazon/vinyl-di");
|
|
|
9679
9728
|
|
|
9680
9729
|
// src/track/hls/createUrlHlsManifestProvider.ts
|
|
9681
9730
|
var import_vinyl_hls_parser3 = require("@amazon/vinyl-hls-parser");
|
|
9682
|
-
var
|
|
9731
|
+
var import_vinyl_util96 = require("@amazon/vinyl-util");
|
|
9683
9732
|
function createUrlHlsManifestProvider(url, requestInit) {
|
|
9684
9733
|
return async (abort) => {
|
|
9685
|
-
const mainResponse = await (0,
|
|
9734
|
+
const mainResponse = await (0, import_vinyl_util96.requestWithRetry)(url, requestInit, {
|
|
9686
9735
|
abort
|
|
9687
9736
|
});
|
|
9688
|
-
const mainText = await mainResponse
|
|
9737
|
+
const mainText = await (0, import_vinyl_util96.readResponseBody)(mainResponse, "text");
|
|
9689
9738
|
const baseUrl = mainResponse.url || url;
|
|
9690
9739
|
const mainPlaylist = (0, import_vinyl_hls_parser3.parseMainPlaylist)(
|
|
9691
9740
|
mainText,
|
|
9692
9741
|
parseQueryParams(baseUrl)
|
|
9693
9742
|
);
|
|
9694
|
-
const getMediaPlaylist = (0,
|
|
9743
|
+
const getMediaPlaylist = (0, import_vinyl_util96.memoize)(
|
|
9695
9744
|
(uri) => fetchMediaPlaylist({
|
|
9696
9745
|
uri,
|
|
9697
9746
|
baseUrl,
|
|
@@ -9710,9 +9759,9 @@ function createUrlHlsManifestProvider(url, requestInit) {
|
|
|
9710
9759
|
}
|
|
9711
9760
|
async function fetchMediaPlaylist(options) {
|
|
9712
9761
|
const { uri, baseUrl, defines, requestInit, abort } = options;
|
|
9713
|
-
const variantUrl = (0,
|
|
9714
|
-
const response = await (0,
|
|
9715
|
-
const text = await response
|
|
9762
|
+
const variantUrl = (0, import_vinyl_util96.resolveUrl)(uri, baseUrl);
|
|
9763
|
+
const response = await (0, import_vinyl_util96.requestWithRetry)(variantUrl, requestInit, { abort });
|
|
9764
|
+
const text = await (0, import_vinyl_util96.readResponseBody)(response, "text");
|
|
9716
9765
|
const queryParams = parseQueryParams(response.url || variantUrl);
|
|
9717
9766
|
return (0, import_vinyl_hls_parser3.parseMediaPlaylist)(text, defines, queryParams);
|
|
9718
9767
|
}
|
|
@@ -9786,7 +9835,7 @@ function createHlsFactories(options) {
|
|
|
9786
9835
|
}
|
|
9787
9836
|
|
|
9788
9837
|
// src/track/TrackController.ts
|
|
9789
|
-
var
|
|
9838
|
+
var import_vinyl_util97 = require("@amazon/vinyl-util");
|
|
9790
9839
|
var ALL_TRACK_CONTROLLER_EVENTS = [
|
|
9791
9840
|
"trackActivated",
|
|
9792
9841
|
"trackDeactivated",
|
|
@@ -9801,14 +9850,14 @@ var defaultTrackControllerImplOptions = {
|
|
|
9801
9850
|
var trackPriority = {
|
|
9802
9851
|
value: 0
|
|
9803
9852
|
};
|
|
9804
|
-
var TrackControllerImpl = class extends
|
|
9853
|
+
var TrackControllerImpl = class extends import_vinyl_util97.EventHostImpl {
|
|
9805
9854
|
constructor(deps, initialOptions) {
|
|
9806
9855
|
super();
|
|
9807
9856
|
__publicField(this, "deps", deps);
|
|
9808
9857
|
// When tracks are preloaded, the cache capacity may expand automatically to accommodate.
|
|
9809
9858
|
__publicField(this, "_autoPreloadCapacity", 0);
|
|
9810
9859
|
// The primary content track cache. Bounded by preloadCapacity + prefetch.
|
|
9811
|
-
__publicField(this, "trackCache", /* @__PURE__ */ new
|
|
9860
|
+
__publicField(this, "trackCache", /* @__PURE__ */ new import_vinyl_util97.LruCache(0));
|
|
9812
9861
|
// A monotonically increasing id for a queue change, to allow for queue changes during events.
|
|
9813
9862
|
__publicField(this, "queueIdx", 0);
|
|
9814
9863
|
__publicField(this, "_queue", []);
|
|
@@ -9824,7 +9873,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
9824
9873
|
// Ad tracks keyed by parent content URI, kept out of the content cache.
|
|
9825
9874
|
// Pegged to the parent: disposed when the parent is evicted (see onEvict).
|
|
9826
9875
|
__publicField(this, "adTracksByParent", /* @__PURE__ */ new Map());
|
|
9827
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
9876
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util97.createDisposer)());
|
|
9828
9877
|
__publicField(this, "_options", defaultTrackControllerImplOptions);
|
|
9829
9878
|
/**
|
|
9830
9879
|
* The current track has ended naturally. On the next tick advance the queue or emit queue ended.
|
|
@@ -9834,28 +9883,30 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
9834
9883
|
if (this.currentTrackIsAdTrack) return;
|
|
9835
9884
|
const track = this._current;
|
|
9836
9885
|
if (!track) {
|
|
9837
|
-
(0,
|
|
9886
|
+
(0, import_vinyl_util97.logWarn)(this, "an ended event was received with no current track");
|
|
9838
9887
|
return;
|
|
9839
9888
|
}
|
|
9840
9889
|
const interrupted = this.getQueueInterrupted();
|
|
9841
9890
|
adController.enterPostroll().then((postroll) => {
|
|
9891
|
+
if (interrupted()) return;
|
|
9842
9892
|
if (postroll) {
|
|
9843
|
-
(0,
|
|
9893
|
+
(0, import_vinyl_util97.logDebug)(this, "postroll entered");
|
|
9844
9894
|
} else {
|
|
9845
|
-
(0,
|
|
9895
|
+
(0, import_vinyl_util97.logDebug)(this, "trackEnded");
|
|
9846
9896
|
this.dispatch("trackEnded", { track });
|
|
9847
9897
|
queueMicrotask(() => {
|
|
9848
9898
|
if (interrupted()) return;
|
|
9849
9899
|
if (this.hasNext()) {
|
|
9850
9900
|
this.next();
|
|
9851
9901
|
} else {
|
|
9852
|
-
(0,
|
|
9902
|
+
(0, import_vinyl_util97.logInfo)(this, "queueEnded");
|
|
9853
9903
|
this.dispatch("queueEnded", {});
|
|
9854
9904
|
}
|
|
9855
9905
|
});
|
|
9856
9906
|
}
|
|
9857
9907
|
}).catch((error) => {
|
|
9858
|
-
(
|
|
9908
|
+
if (interrupted()) return;
|
|
9909
|
+
(0, import_vinyl_util97.logError)(this, "enterPostroll failed", error);
|
|
9859
9910
|
});
|
|
9860
9911
|
});
|
|
9861
9912
|
__publicField(this, "validateLoadOptions", (loadOptions) => this.deps.trackFactory.validate(loadOptions));
|
|
@@ -9865,7 +9916,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
9865
9916
|
return this.getPrefetched().find((value) => value.uri === track.uri) == null;
|
|
9866
9917
|
};
|
|
9867
9918
|
this.trackCache.onEvict = (track) => {
|
|
9868
|
-
(0,
|
|
9919
|
+
(0, import_vinyl_util97.logDebug)(this, `Disposing track: ${track.uri}`);
|
|
9869
9920
|
this.disposeAdTracksFor(track.uri);
|
|
9870
9921
|
track.dispose();
|
|
9871
9922
|
return true;
|
|
@@ -9890,7 +9941,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
9890
9941
|
adController.on("adEntered", (event) => {
|
|
9891
9942
|
const adParent = this.adParent;
|
|
9892
9943
|
if (!adParent) {
|
|
9893
|
-
(0,
|
|
9944
|
+
(0, import_vinyl_util97.logDebug)(this, "ad entered, no parent track");
|
|
9894
9945
|
return;
|
|
9895
9946
|
}
|
|
9896
9947
|
const interrupted = () => this.adParent !== adParent || adController.currentAd !== event.ad;
|
|
@@ -9908,7 +9959,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
9908
9959
|
config: {}
|
|
9909
9960
|
}
|
|
9910
9961
|
);
|
|
9911
|
-
playbackController.play().catch(
|
|
9962
|
+
playbackController.play().catch(import_vinyl_util97.noop);
|
|
9912
9963
|
}
|
|
9913
9964
|
}).catch((error) => {
|
|
9914
9965
|
if (!interrupted()) adController.failAd(error);
|
|
@@ -9919,14 +9970,14 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
9919
9970
|
add(
|
|
9920
9971
|
adController.on("adBreakCompleted", (event) => {
|
|
9921
9972
|
var _a;
|
|
9922
|
-
(0,
|
|
9973
|
+
(0, import_vinyl_util97.logDebug)(this, "adBreakCompleted");
|
|
9923
9974
|
const adParent = this.adParent;
|
|
9924
9975
|
if (!adParent) {
|
|
9925
|
-
(0,
|
|
9976
|
+
(0, import_vinyl_util97.logDebug)(this, "ad break completed, no parent track");
|
|
9926
9977
|
return;
|
|
9927
9978
|
}
|
|
9928
9979
|
if (adController.currentAdBreak) {
|
|
9929
|
-
(0,
|
|
9980
|
+
(0, import_vinyl_util97.logDebug)(this, "more adbreaks");
|
|
9930
9981
|
return;
|
|
9931
9982
|
}
|
|
9932
9983
|
const adParentLoad = this._current;
|
|
@@ -9940,25 +9991,25 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
9940
9991
|
checkPreroll: false
|
|
9941
9992
|
});
|
|
9942
9993
|
if (isPostroll) {
|
|
9943
|
-
(0,
|
|
9994
|
+
(0, import_vinyl_util97.logDebug)(this, "trackEnded after postroll");
|
|
9944
9995
|
this.dispatch("trackEnded", { track: adParentLoad });
|
|
9945
9996
|
if (this.hasNext()) {
|
|
9946
9997
|
this.next();
|
|
9947
9998
|
return;
|
|
9948
9999
|
}
|
|
9949
10000
|
if (!noAdBegan) resumeContent(event.resumePosition);
|
|
9950
|
-
(0,
|
|
10001
|
+
(0, import_vinyl_util97.logInfo)(this, "queueEnded after postroll");
|
|
9951
10002
|
this.dispatch("queueEnded", {});
|
|
9952
10003
|
return;
|
|
9953
10004
|
}
|
|
9954
10005
|
if (noAdBegan) {
|
|
9955
|
-
(0,
|
|
10006
|
+
(0, import_vinyl_util97.logDebug)(this, "no ads began");
|
|
9956
10007
|
return;
|
|
9957
10008
|
}
|
|
9958
10009
|
resumeContent(
|
|
9959
10010
|
isPreroll ? (_a = adParentLoad.config) == null ? void 0 : _a.startTime : event.resumePosition
|
|
9960
10011
|
);
|
|
9961
|
-
playbackController.play().catch(
|
|
10012
|
+
playbackController.play().catch(import_vinyl_util97.noop);
|
|
9962
10013
|
})
|
|
9963
10014
|
);
|
|
9964
10015
|
}
|
|
@@ -9974,7 +10025,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
9974
10025
|
* @param options
|
|
9975
10026
|
*/
|
|
9976
10027
|
configure(options) {
|
|
9977
|
-
(0,
|
|
10028
|
+
(0, import_vinyl_util97.logDebug)(this, "configure", options);
|
|
9978
10029
|
this._options = __spreadValues(__spreadValues({}, this._options), options);
|
|
9979
10030
|
this.checkCacheCapacity();
|
|
9980
10031
|
}
|
|
@@ -9984,7 +10035,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
9984
10035
|
checkCacheCapacity() {
|
|
9985
10036
|
const capacity = this.preloadCapacity + this._options.trackPrefetchCount + 1;
|
|
9986
10037
|
if (capacity !== this.trackCache.capacity) {
|
|
9987
|
-
(0,
|
|
10038
|
+
(0, import_vinyl_util97.logDebug)(this, "track cache capacity changed:", capacity);
|
|
9988
10039
|
this.trackCache.capacity = capacity;
|
|
9989
10040
|
}
|
|
9990
10041
|
}
|
|
@@ -10022,14 +10073,14 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10022
10073
|
);
|
|
10023
10074
|
}
|
|
10024
10075
|
preload(...loadOptionsList) {
|
|
10025
|
-
(0,
|
|
10076
|
+
(0, import_vinyl_util97.logDebug)(this, `preload ${loadOptionsList.length} items`);
|
|
10026
10077
|
loadOptionsList.forEach(this.validateLoadOptions);
|
|
10027
10078
|
this._preload(loadOptionsList);
|
|
10028
10079
|
}
|
|
10029
10080
|
_preload(loadOptionsList) {
|
|
10030
10081
|
var _a;
|
|
10031
10082
|
const prefetched = this.getPrefetched();
|
|
10032
|
-
const requiredPreloadCapacity = (0,
|
|
10083
|
+
const requiredPreloadCapacity = (0, import_vinyl_util97.countElements)(
|
|
10033
10084
|
loadOptionsList,
|
|
10034
10085
|
(loadOptions) => {
|
|
10035
10086
|
return prefetched.find((element2) => {
|
|
@@ -10046,7 +10097,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10046
10097
|
for (const loadOptions of loadOptionsList) {
|
|
10047
10098
|
const track = this.getOrCreateTrack(loadOptions);
|
|
10048
10099
|
const prefetchPriority = priority--;
|
|
10049
|
-
(0,
|
|
10100
|
+
(0, import_vinyl_util97.logVerbose)(
|
|
10050
10101
|
this,
|
|
10051
10102
|
`preloading track ${track.uri} with priority ${prefetchPriority}`
|
|
10052
10103
|
);
|
|
@@ -10063,7 +10114,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10063
10114
|
parentTrack.getAds().then(async (trackAds) => {
|
|
10064
10115
|
for (const [index, adBreak] of trackAds.adBreaks.entries()) {
|
|
10065
10116
|
if (adBreak.placement !== "preroll") continue;
|
|
10066
|
-
const ads = await (0,
|
|
10117
|
+
const ads = await (0, import_vinyl_util97.resolveValueProvider)(adBreak.ads);
|
|
10067
10118
|
for (const ad of ads) {
|
|
10068
10119
|
await this.preloadAd({
|
|
10069
10120
|
parentTrack,
|
|
@@ -10076,7 +10127,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10076
10127
|
}
|
|
10077
10128
|
}
|
|
10078
10129
|
}).catch((error) => {
|
|
10079
|
-
(0,
|
|
10130
|
+
(0, import_vinyl_util97.logVerbose)(
|
|
10080
10131
|
this,
|
|
10081
10132
|
`preroll ad preload failed for ${parentTrack.uri}`,
|
|
10082
10133
|
error
|
|
@@ -10092,12 +10143,12 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10092
10143
|
preloadBreakAds(parentTrack, adBreak) {
|
|
10093
10144
|
trackPriority.value += 1;
|
|
10094
10145
|
const prefetchPriority = trackPriority.value;
|
|
10095
|
-
(0,
|
|
10146
|
+
(0, import_vinyl_util97.resolveValueProvider)(adBreak.ads).then(async (ads) => {
|
|
10096
10147
|
for (const ad of ads) {
|
|
10097
10148
|
await this.preloadAd({ parentTrack, prefetchPriority, ad });
|
|
10098
10149
|
}
|
|
10099
10150
|
}).catch((error) => {
|
|
10100
|
-
(0,
|
|
10151
|
+
(0, import_vinyl_util97.logVerbose)(
|
|
10101
10152
|
this,
|
|
10102
10153
|
`ad preload failed for break ${adBreak.id}`,
|
|
10103
10154
|
error
|
|
@@ -10113,8 +10164,8 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10113
10164
|
var _a;
|
|
10114
10165
|
const { adTrackLoadOptionsProvider } = this.deps;
|
|
10115
10166
|
const loadOptions = await adTrackLoadOptionsProvider(ad);
|
|
10116
|
-
if (parentTrack.disposed) return;
|
|
10117
|
-
(0,
|
|
10167
|
+
if (parentTrack.disposed || this.disposed) return;
|
|
10168
|
+
(0, import_vinyl_util97.logVerbose)(
|
|
10118
10169
|
this,
|
|
10119
10170
|
`preloading ad id=${ad.id} uri=${ad.uri} priority=${prefetchPriority}`
|
|
10120
10171
|
);
|
|
@@ -10127,7 +10178,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10127
10178
|
);
|
|
10128
10179
|
}
|
|
10129
10180
|
load(...loadOptionsList) {
|
|
10130
|
-
(0,
|
|
10181
|
+
(0, import_vinyl_util97.logDebug)(this, `load ${loadOptionsList.length} items`);
|
|
10131
10182
|
loadOptionsList.forEach(this.validateLoadOptions);
|
|
10132
10183
|
this.setQueue(loadOptionsList[0], loadOptionsList.slice(1));
|
|
10133
10184
|
}
|
|
@@ -10135,7 +10186,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10135
10186
|
this.load();
|
|
10136
10187
|
}
|
|
10137
10188
|
enqueue(...loadOptionsList) {
|
|
10138
|
-
(0,
|
|
10189
|
+
(0, import_vinyl_util97.logDebug)(this, `enqueue ${loadOptionsList.length} items`);
|
|
10139
10190
|
loadOptionsList.forEach(this.validateLoadOptions);
|
|
10140
10191
|
this.setQueue(this._current, this._queue.concat(loadOptionsList));
|
|
10141
10192
|
if (this._currentTrack == null && this.hasNext()) this.next();
|
|
@@ -10146,12 +10197,12 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10146
10197
|
next() {
|
|
10147
10198
|
const playbackController = this.deps.playbackController;
|
|
10148
10199
|
const shouldPlay = playbackController.ended || !playbackController.paused;
|
|
10149
|
-
const next = (0,
|
|
10150
|
-
(0,
|
|
10200
|
+
const next = (0, import_vinyl_util97.first)(this._queue);
|
|
10201
|
+
(0, import_vinyl_util97.logDebug)(this, "next, nextTrack:", next);
|
|
10151
10202
|
this.setQueue(next, this._queue.slice(1), { shouldPlay });
|
|
10152
10203
|
}
|
|
10153
10204
|
clearTrackCache() {
|
|
10154
|
-
(0,
|
|
10205
|
+
(0, import_vinyl_util97.logDebug)(this, "clearTrackCache");
|
|
10155
10206
|
this.trackCache.forEach((track) => {
|
|
10156
10207
|
this.disposeAdTracksFor(track.uri);
|
|
10157
10208
|
track.dispose();
|
|
@@ -10177,7 +10228,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10177
10228
|
* @private
|
|
10178
10229
|
*/
|
|
10179
10230
|
getOrCreateTrack(loadOptions) {
|
|
10180
|
-
return (0,
|
|
10231
|
+
return (0, import_vinyl_util97.getOrSet)(
|
|
10181
10232
|
this.trackCache,
|
|
10182
10233
|
loadOptions.uri,
|
|
10183
10234
|
() => this.deps.trackFactory.createTrack(loadOptions)
|
|
@@ -10193,12 +10244,12 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10193
10244
|
* @private
|
|
10194
10245
|
*/
|
|
10195
10246
|
getOrCreateAdTrack(parentUri, loadOptions) {
|
|
10196
|
-
const parentTracks = (0,
|
|
10247
|
+
const parentTracks = (0, import_vinyl_util97.getOrSet)(
|
|
10197
10248
|
this.adTracksByParent,
|
|
10198
10249
|
parentUri,
|
|
10199
10250
|
() => /* @__PURE__ */ new Map()
|
|
10200
10251
|
);
|
|
10201
|
-
return (0,
|
|
10252
|
+
return (0, import_vinyl_util97.getOrSet)(
|
|
10202
10253
|
parentTracks,
|
|
10203
10254
|
loadOptions.uri,
|
|
10204
10255
|
() => this.deps.trackFactory.createTrack(loadOptions)
|
|
@@ -10229,13 +10280,13 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10229
10280
|
}
|
|
10230
10281
|
);
|
|
10231
10282
|
if (options == null ? void 0 : options.shouldPlay) {
|
|
10232
|
-
playbackController.play().catch(
|
|
10283
|
+
playbackController.play().catch(import_vinyl_util97.noop);
|
|
10233
10284
|
}
|
|
10234
10285
|
} else {
|
|
10235
10286
|
this._queue = queue;
|
|
10236
10287
|
}
|
|
10237
10288
|
this._preload(this.getPrefetched());
|
|
10238
|
-
(0,
|
|
10289
|
+
(0, import_vinyl_util97.logDebug)(
|
|
10239
10290
|
this,
|
|
10240
10291
|
`track change, previous: ${previous == null ? void 0 : previous.uri} current: ${current == null ? void 0 : current.uri}`
|
|
10241
10292
|
);
|
|
@@ -10246,7 +10297,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10246
10297
|
});
|
|
10247
10298
|
}
|
|
10248
10299
|
if (interrupted()) {
|
|
10249
|
-
throw new
|
|
10300
|
+
throw new import_vinyl_util97.IllegalStateError(
|
|
10250
10301
|
`cannot change the queue on a 'queueChange' or 'trackDeactivated' event`
|
|
10251
10302
|
);
|
|
10252
10303
|
}
|
|
@@ -10268,7 +10319,7 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10268
10319
|
const previousTrack = this._currentTrack;
|
|
10269
10320
|
const previousWasActive = (_a = previousTrack == null ? void 0 : previousTrack.active) != null ? _a : false;
|
|
10270
10321
|
this._currentTrack = newTrack;
|
|
10271
|
-
const interrupted = () => this._currentTrack !== newTrack;
|
|
10322
|
+
const interrupted = () => this.disposed || this._currentTrack !== newTrack;
|
|
10272
10323
|
previousTrack == null ? void 0 : previousTrack.deactivate();
|
|
10273
10324
|
if (previousTrack && previousWasActive) {
|
|
10274
10325
|
this.dispatch("trackDeactivated", { track: previousTrack });
|
|
@@ -10296,7 +10347,8 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10296
10347
|
if (preroll) return;
|
|
10297
10348
|
activate();
|
|
10298
10349
|
}).catch((error) => {
|
|
10299
|
-
(
|
|
10350
|
+
if (interrupted()) return;
|
|
10351
|
+
(0, import_vinyl_util97.logError)(this, "enterPreroll failed", error);
|
|
10300
10352
|
activate();
|
|
10301
10353
|
});
|
|
10302
10354
|
}
|
|
@@ -10331,25 +10383,21 @@ var TrackControllerImpl = class extends import_vinyl_util101.EventHostImpl {
|
|
|
10331
10383
|
return this.disposer.disposed;
|
|
10332
10384
|
}
|
|
10333
10385
|
dispose() {
|
|
10334
|
-
(0,
|
|
10386
|
+
(0, import_vinyl_util97.logDebug)(this, "dispose");
|
|
10335
10387
|
super.dispose();
|
|
10336
10388
|
this.clearTrackCache();
|
|
10337
10389
|
this.disposer.dispose();
|
|
10338
10390
|
}
|
|
10339
10391
|
};
|
|
10340
10392
|
|
|
10341
|
-
// src/
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
var defaultPatchOptions = /* @__PURE__ */ (0, import_vinyl_util102.lazy)(() => {
|
|
10347
|
-
return {
|
|
10348
|
-
media: defaultMediaElementPatchOptions.value
|
|
10349
|
-
};
|
|
10350
|
-
});
|
|
10393
|
+
// src/util/media/mimeType.ts
|
|
10394
|
+
function mimeSubtype(mimeType) {
|
|
10395
|
+
var _a;
|
|
10396
|
+
return (_a = mimeType.split(";", 1)[0].trim().toLowerCase().split("/")[1]) != null ? _a : "";
|
|
10397
|
+
}
|
|
10351
10398
|
|
|
10352
10399
|
// src/vinyl/createVinylFactories.ts
|
|
10400
|
+
var import_vinyl_util98 = require("@amazon/vinyl-util");
|
|
10353
10401
|
var import_vinyl_di7 = require("@amazon/vinyl-di");
|
|
10354
10402
|
|
|
10355
10403
|
// src/vinyl/VinylOptions.ts
|
|
@@ -10393,27 +10441,19 @@ function playerConfigFactory(defaults, validator) {
|
|
|
10393
10441
|
|
|
10394
10442
|
// src/vinyl/createVinylFactories.ts
|
|
10395
10443
|
function createVinylFactories(options) {
|
|
10396
|
-
var _a;
|
|
10397
|
-
const patches = (0, import_vinyl_util103.mergeDeep)([
|
|
10398
|
-
defaultPatchOptions.value,
|
|
10399
|
-
(_a = options.patches) != null ? _a : {}
|
|
10400
|
-
]);
|
|
10401
10444
|
return (0, import_vinyl_di7.validateFactories)({
|
|
10402
10445
|
options: playerConfigFactory(
|
|
10403
10446
|
defaultVinylOptions,
|
|
10404
10447
|
vinylOptionsValidator
|
|
10405
10448
|
),
|
|
10406
|
-
|
|
10407
|
-
return patchMediaElement(options.media, patches.media);
|
|
10408
|
-
},
|
|
10409
|
-
media: (deps) => deps.patchedMedia.patched,
|
|
10449
|
+
media: () => options.media,
|
|
10410
10450
|
// One provider per media element (the player container creates each
|
|
10411
10451
|
// dependency once), so text tracks are reused rather than accumulated.
|
|
10412
10452
|
textTrackProvider: (deps) => createMediaTextTrackProvider({ media: deps.media }),
|
|
10413
10453
|
// App-provided cue renderer (or null for native rendering).
|
|
10414
10454
|
textTrackRenderer: () => {
|
|
10415
|
-
var
|
|
10416
|
-
return (
|
|
10455
|
+
var _a;
|
|
10456
|
+
return (_a = options.textTrackRenderer) != null ? _a : null;
|
|
10417
10457
|
},
|
|
10418
10458
|
playbackController: (deps) => new PlaybackControllerImpl(deps, options.playbackController),
|
|
10419
10459
|
playbackSource: (deps) => new PlaybackSourceImpl(deps),
|
|
@@ -10421,7 +10461,7 @@ function createVinylFactories(options) {
|
|
|
10421
10461
|
options: deps.options.pick("loudnessNormalization")
|
|
10422
10462
|
}),
|
|
10423
10463
|
capabilities: (deps) => new CapabilitiesImpl(deps),
|
|
10424
|
-
requestInterceptor: () =>
|
|
10464
|
+
requestInterceptor: () => import_vinyl_util98.noop,
|
|
10425
10465
|
trackFactory: (deps) => createTrackFactory(createVinylTrackFactories(deps)),
|
|
10426
10466
|
adTrackLoadOptionsProvider: () => defaultAdLoadOptionsResolver,
|
|
10427
10467
|
trackController: (deps) => new TrackControllerImpl(deps, options.trackController),
|
|
@@ -10436,9 +10476,9 @@ function createVinylFactories(options) {
|
|
|
10436
10476
|
}
|
|
10437
10477
|
|
|
10438
10478
|
// src/vinyl/VinylPlayer.ts
|
|
10439
|
-
var
|
|
10479
|
+
var import_vinyl_util99 = require("@amazon/vinyl-util");
|
|
10440
10480
|
var import_vinyl_di8 = require("@amazon/vinyl-di");
|
|
10441
|
-
var VinylPlayer = class extends
|
|
10481
|
+
var VinylPlayer = class extends import_vinyl_util99.EventHostImpl {
|
|
10442
10482
|
/**
|
|
10443
10483
|
* Constructs a new VinylPlayer with the given dependency factories.
|
|
10444
10484
|
* This constructor is protected, use {@link createVinylPlayer} to construct a new player.
|
|
@@ -10455,7 +10495,7 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
10455
10495
|
*/
|
|
10456
10496
|
__publicField(this, "client");
|
|
10457
10497
|
__publicField(this, "_error", null);
|
|
10458
|
-
__publicField(this, "disposer", /* @__PURE__ */ (0,
|
|
10498
|
+
__publicField(this, "disposer", /* @__PURE__ */ (0, import_vinyl_util99.createDisposer)());
|
|
10459
10499
|
const add = this.disposer.add;
|
|
10460
10500
|
this.deps = add((0, import_vinyl_di8.createContainer)(factories)).dependencies;
|
|
10461
10501
|
this.client = {
|
|
@@ -10464,6 +10504,7 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
10464
10504
|
playerRegistryRef.value.addPlayer(this);
|
|
10465
10505
|
this.redispatchSubControllerEvents();
|
|
10466
10506
|
this.redispatchCurrentTrackEvents();
|
|
10507
|
+
this.initializeLoadSpanLogging();
|
|
10467
10508
|
this.initializeAutoResetHandling();
|
|
10468
10509
|
}
|
|
10469
10510
|
get [Symbol.toStringTag]() {
|
|
@@ -10481,23 +10522,43 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
10481
10522
|
get autoResetController() {
|
|
10482
10523
|
return this.deps.autoResetController;
|
|
10483
10524
|
}
|
|
10525
|
+
/**
|
|
10526
|
+
* Logs each republished load span once at the verbose level, formatting its
|
|
10527
|
+
* bounds as ISO date strings and its duration in milliseconds.
|
|
10528
|
+
*/
|
|
10529
|
+
initializeLoadSpanLogging() {
|
|
10530
|
+
this.disposer.add(
|
|
10531
|
+
this.on("loadSpan", (span) => {
|
|
10532
|
+
if ((0, import_vinyl_util99.getLogLevel)() > import_vinyl_util99.LogLevel.VERBOSE) return;
|
|
10533
|
+
(0, import_vinyl_util99.logVerbose)(this, "loadSpan", {
|
|
10534
|
+
kind: span.kind,
|
|
10535
|
+
trackUri: span.trackUri,
|
|
10536
|
+
mimeType: span.mimeType,
|
|
10537
|
+
contentType: span.contentType,
|
|
10538
|
+
startTime: new Date(span.startTime).toISOString(),
|
|
10539
|
+
endTime: new Date(span.endTime).toISOString(),
|
|
10540
|
+
durationMs: (span.endTime - span.startTime).toFixed(2)
|
|
10541
|
+
});
|
|
10542
|
+
})
|
|
10543
|
+
);
|
|
10544
|
+
}
|
|
10484
10545
|
redispatchSubControllerEvents() {
|
|
10485
10546
|
const add = this.disposer.add;
|
|
10486
10547
|
add(
|
|
10487
|
-
(0,
|
|
10548
|
+
(0, import_vinyl_util99.redispatchEvents)(
|
|
10488
10549
|
this,
|
|
10489
10550
|
this.playbackController,
|
|
10490
10551
|
ALL_PLAYBACK_STATE_EVENTS.filter(notResetEvent)
|
|
10491
10552
|
)
|
|
10492
10553
|
);
|
|
10493
10554
|
add(
|
|
10494
|
-
(0,
|
|
10555
|
+
(0, import_vinyl_util99.redispatchEvents)(
|
|
10495
10556
|
this,
|
|
10496
10557
|
this.trackController,
|
|
10497
10558
|
ALL_TRACK_CONTROLLER_EVENTS
|
|
10498
10559
|
)
|
|
10499
10560
|
);
|
|
10500
|
-
add((0,
|
|
10561
|
+
add((0, import_vinyl_util99.redispatchEvents)(this, this.drmController, ["error"]));
|
|
10501
10562
|
add(
|
|
10502
10563
|
this.drmController.on("loadSpanMeasured", (measurement) => {
|
|
10503
10564
|
const trackUri = measurement.trackUri;
|
|
@@ -10506,14 +10567,14 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
10506
10567
|
}
|
|
10507
10568
|
})
|
|
10508
10569
|
);
|
|
10509
|
-
add((0,
|
|
10570
|
+
add((0, import_vinyl_util99.redispatchEvents)(this, this.deps.adController, ALL_AD_EVENTS));
|
|
10510
10571
|
this.on("error", (event) => {
|
|
10511
10572
|
this._error = event.error;
|
|
10512
10573
|
});
|
|
10513
10574
|
add(
|
|
10514
10575
|
this.on("codecUnsupported", (event) => {
|
|
10515
10576
|
if (this.deps.adController.currentAdBreak) return;
|
|
10516
|
-
(0,
|
|
10577
|
+
(0, import_vinyl_util99.logWarn)(
|
|
10517
10578
|
this,
|
|
10518
10579
|
"codec unsupported, reloading track:",
|
|
10519
10580
|
event.mimeType
|
|
@@ -10546,7 +10607,7 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
10546
10607
|
metricSub == null ? void 0 : metricSub();
|
|
10547
10608
|
metricSub = null;
|
|
10548
10609
|
if (current) {
|
|
10549
|
-
sub = (0,
|
|
10610
|
+
sub = (0, import_vinyl_util99.redispatchEvents)(
|
|
10550
10611
|
this,
|
|
10551
10612
|
current,
|
|
10552
10613
|
ALL_STREAMING_EVENTS.filter(notResetEvent).filter(
|
|
@@ -10566,7 +10627,7 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
10566
10627
|
}
|
|
10567
10628
|
);
|
|
10568
10629
|
if (current.textTrackController) {
|
|
10569
|
-
textSub = (0,
|
|
10630
|
+
textSub = (0, import_vinyl_util99.redispatchEvents)(
|
|
10570
10631
|
this,
|
|
10571
10632
|
current.textTrackController,
|
|
10572
10633
|
ALL_TEXT_TRACK_EVENTS
|
|
@@ -10651,9 +10712,9 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
10651
10712
|
* @param options
|
|
10652
10713
|
*/
|
|
10653
10714
|
configure(options) {
|
|
10654
|
-
(0,
|
|
10715
|
+
(0, import_vinyl_util99.logDebug)(this, "configure", options);
|
|
10655
10716
|
const newValue = __spreadValues(__spreadValues({}, this.options), options);
|
|
10656
|
-
if (!(0,
|
|
10717
|
+
if (!(0, import_vinyl_util99.equalDeep)(newValue, this.options)) {
|
|
10657
10718
|
this.deps.options.value = newValue;
|
|
10658
10719
|
}
|
|
10659
10720
|
}
|
|
@@ -10783,10 +10844,10 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
10783
10844
|
}
|
|
10784
10845
|
reset(hard = false) {
|
|
10785
10846
|
if (!this._error) {
|
|
10786
|
-
(0,
|
|
10847
|
+
(0, import_vinyl_util99.logDebug)(this, "reset no-op");
|
|
10787
10848
|
return;
|
|
10788
10849
|
}
|
|
10789
|
-
(0,
|
|
10850
|
+
(0, import_vinyl_util99.logDebug)(this, "reset");
|
|
10790
10851
|
this._error = null;
|
|
10791
10852
|
this.drmController.reset();
|
|
10792
10853
|
this.playbackController.reset();
|
|
@@ -10850,7 +10911,7 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
10850
10911
|
*/
|
|
10851
10912
|
get fetchedRanges() {
|
|
10852
10913
|
var _a, _b;
|
|
10853
|
-
return (_b = (_a = this.activeTrack) == null ? void 0 : _a.fetchedRanges) != null ? _b :
|
|
10914
|
+
return (_b = (_a = this.activeTrack) == null ? void 0 : _a.fetchedRanges) != null ? _b : import_vinyl_util99.emptyRanges;
|
|
10854
10915
|
}
|
|
10855
10916
|
/**
|
|
10856
10917
|
* Returns the time of the prefetch end.
|
|
@@ -11031,7 +11092,7 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
11031
11092
|
* Disposes this player and sub-systems.
|
|
11032
11093
|
*/
|
|
11033
11094
|
dispose() {
|
|
11034
|
-
(0,
|
|
11095
|
+
(0, import_vinyl_util99.logDebug)(this, "dispose");
|
|
11035
11096
|
super.dispose();
|
|
11036
11097
|
this.disposer.dispose();
|
|
11037
11098
|
playerRegistryRef.value.removePlayer(this);
|
|
@@ -11039,7 +11100,7 @@ var VinylPlayer = class extends import_vinyl_util104.EventHostImpl {
|
|
|
11039
11100
|
};
|
|
11040
11101
|
function createVinylPlayer(options, factoryOverrides) {
|
|
11041
11102
|
const player = new VinylPlayer(__spreadValues(__spreadValues({}, createVinylFactories(options)), factoryOverrides));
|
|
11042
|
-
(0,
|
|
11103
|
+
(0, import_vinyl_util99.logInfo)(player, `VinylPlayer initialized`);
|
|
11043
11104
|
return player;
|
|
11044
11105
|
}
|
|
11045
11106
|
function notResetEvent(type) {
|