@videojs/spf 10.0.0-beta.31 → 10.0.0-beta.32
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/default/core/actors/create-machine-actor.js +23 -25
- package/dist/default/core/actors/create-machine-actor.js.map +1 -1
- package/dist/default/core/actors/create-transition-actor.js +7 -9
- package/dist/default/core/actors/create-transition-actor.js.map +1 -1
- package/dist/default/core/composition/create-composition.js +26 -29
- package/dist/default/core/composition/create-composition.js.map +1 -1
- package/dist/default/core/composition/share-signals.js +12 -17
- package/dist/default/core/composition/share-signals.js.map +1 -1
- package/dist/default/core/machine.js +3 -4
- package/dist/default/core/machine.js.map +1 -1
- package/dist/default/core/reactors/create-machine-reactor.js +20 -19
- package/dist/default/core/reactors/create-machine-reactor.js.map +1 -1
- package/dist/default/core/signals/effect.js +24 -4
- package/dist/default/core/signals/effect.js.map +1 -1
- package/dist/default/core/signals/primitives.js +10 -14
- package/dist/default/core/signals/primitives.js.map +1 -1
- package/dist/default/core/signals/when.js +6 -8
- package/dist/default/core/signals/when.js.map +1 -1
- package/dist/default/core/tasks/delayed-reschedule.js +7 -11
- package/dist/default/core/tasks/delayed-reschedule.js.map +1 -1
- package/dist/default/core/tasks/task.js +59 -82
- package/dist/default/core/tasks/task.js.map +1 -1
- package/dist/default/hls.js +3 -1
- package/dist/default/index.js +2 -3
- package/dist/default/index.js.map +1 -1
- package/dist/default/media/abr/quality-selection.js +3 -7
- package/dist/default/media/abr/quality-selection.js.map +1 -1
- package/dist/default/media/buffer/back-buffer.js +15 -19
- package/dist/default/media/buffer/back-buffer.js.map +1 -1
- package/dist/default/media/buffer/forward-buffer.js +32 -41
- package/dist/default/media/buffer/forward-buffer.js.map +1 -1
- package/dist/default/media/dom/capabilities.js +26 -37
- package/dist/default/media/dom/capabilities.js.map +1 -1
- package/dist/default/media/dom/mse/append-segment.js +3 -5
- package/dist/default/media/dom/mse/append-segment.js.map +1 -1
- package/dist/default/media/dom/mse/buffer-flusher.js +5 -5
- package/dist/default/media/dom/mse/buffer-flusher.js.map +1 -1
- package/dist/default/media/dom/mse/duration.js +23 -31
- package/dist/default/media/dom/mse/duration.js.map +1 -1
- package/dist/default/media/dom/mse/end-of-stream.js +3 -6
- package/dist/default/media/dom/mse/end-of-stream.js.map +1 -1
- package/dist/default/media/dom/mse/mediasource-setup.js +65 -81
- package/dist/default/media/dom/mse/mediasource-setup.js.map +1 -1
- package/dist/default/media/dom/screen.js +37 -54
- package/dist/default/media/dom/screen.js.map +1 -1
- package/dist/default/media/dom/text/resolve-vtt-segment.js.map +1 -1
- package/dist/default/media/dom/text/text-track-slots.js +15 -23
- package/dist/default/media/dom/text/text-track-slots.js.map +1 -1
- package/dist/default/media/errors.js +25 -34
- package/dist/default/media/errors.js.map +1 -1
- package/dist/default/media/hls/parse-attributes.js +9 -26
- package/dist/default/media/hls/parse-attributes.js.map +1 -1
- package/dist/default/media/hls/parse-media-playlist.js +25 -33
- package/dist/default/media/hls/parse-media-playlist.js.map +1 -1
- package/dist/default/media/hls/parse-multivariant.js +3 -3
- package/dist/default/media/hls/parse-multivariant.js.map +1 -1
- package/dist/default/media/hls/reload-policy.js +19 -27
- package/dist/default/media/hls/reload-policy.js.map +1 -1
- package/dist/default/media/hls/resolve-url.js +1 -3
- package/dist/default/media/hls/resolve-url.js.map +1 -1
- package/dist/default/media/live-window.js +9 -13
- package/dist/default/media/live-window.js.map +1 -1
- package/dist/default/media/media-tracks/media-tracks.js +12 -17
- package/dist/default/media/media-tracks/media-tracks.js.map +1 -1
- package/dist/default/media/mp4/box.js +4 -5
- package/dist/default/media/mp4/box.js.map +1 -1
- package/dist/default/media/mp4/timestamp-origin.js +30 -42
- package/dist/default/media/mp4/timestamp-origin.js.map +1 -1
- package/dist/default/media/primitives/resolution.js +5 -8
- package/dist/default/media/primitives/resolution.js.map +1 -1
- package/dist/default/media/primitives/select-tracks.js +24 -34
- package/dist/default/media/primitives/select-tracks.js.map +1 -1
- package/dist/default/media/text/parse-vtt-timestamp-map.js +6 -8
- package/dist/default/media/text/parse-vtt-timestamp-map.js.map +1 -1
- package/dist/default/media/text/resolve-vtt-metadata.js +8 -9
- package/dist/default/media/text/resolve-vtt-metadata.js.map +1 -1
- package/dist/default/media/types/index.js +10 -18
- package/dist/default/media/types/index.js.map +1 -1
- package/dist/default/media/utils/cdn.js +10 -16
- package/dist/default/media/utils/cdn.js.map +1 -1
- package/dist/default/media/utils/preload.js +4 -6
- package/dist/default/media/utils/preload.js.map +1 -1
- package/dist/default/media/utils/track-selection.js +10 -14
- package/dist/default/media/utils/track-selection.js.map +1 -1
- package/dist/default/media/utils/tracks.js +56 -54
- package/dist/default/media/utils/tracks.js.map +1 -1
- package/dist/default/network/bandwidth-estimator.js +18 -19
- package/dist/default/network/bandwidth-estimator.js.map +1 -1
- package/dist/default/network/chunked-stream-iterable.js +4 -6
- package/dist/default/network/chunked-stream-iterable.js.map +1 -1
- package/dist/default/network/ewma.js +22 -25
- package/dist/default/network/ewma.js.map +1 -1
- package/dist/default/network/fetch.js +30 -37
- package/dist/default/network/fetch.js.map +1 -1
- package/dist/default/playback/actors/dom/segment-loader.js +28 -44
- package/dist/default/playback/actors/dom/segment-loader.js.map +1 -1
- package/dist/default/playback/actors/dom/source-buffer.js.map +1 -1
- package/dist/default/playback/actors/dom/text-tracks.js.map +1 -1
- package/dist/default/playback/actors/text-track-segment-loader.js +24 -35
- package/dist/default/playback/actors/text-track-segment-loader.js.map +1 -1
- package/dist/default/playback/adapters/hls-audio/adapter.js +23 -31
- package/dist/default/playback/adapters/hls-audio/adapter.js.map +1 -1
- package/dist/default/playback/adapters/hls-audio/media.js.map +1 -1
- package/dist/default/playback/adapters/hls-background-video/adapter.js +50 -70
- package/dist/default/playback/adapters/hls-background-video/adapter.js.map +1 -1
- package/dist/default/playback/adapters/hls-background-video/host.js +12 -16
- package/dist/default/playback/adapters/hls-background-video/host.js.map +1 -1
- package/dist/default/playback/adapters/hls-background-video/media.js +5 -8
- package/dist/default/playback/adapters/hls-background-video/media.js.map +1 -1
- package/dist/default/playback/adapters/hls-video/adapter.js +43 -60
- package/dist/default/playback/adapters/hls-video/adapter.js.map +1 -1
- package/dist/default/playback/adapters/hls-video/error-surface.js +13 -18
- package/dist/default/playback/adapters/hls-video/error-surface.js.map +1 -1
- package/dist/default/playback/adapters/hls-video/media-tracks.js +4 -5
- package/dist/default/playback/adapters/hls-video/media-tracks.js.map +1 -1
- package/dist/default/playback/adapters/hls-video/media.js.map +1 -1
- package/dist/default/playback/adapters/mux-audio/media.js +8 -12
- package/dist/default/playback/adapters/mux-audio/media.js.map +1 -1
- package/dist/default/playback/adapters/mux-video/adapter.js +25 -33
- package/dist/default/playback/adapters/mux-video/adapter.js.map +1 -1
- package/dist/default/playback/adapters/mux-video/media.js +7 -9
- package/dist/default/playback/adapters/mux-video/media.js.map +1 -1
- package/dist/default/playback/behaviors/calculate-presentation-duration.js +5 -8
- package/dist/default/playback/behaviors/calculate-presentation-duration.js.map +1 -1
- package/dist/default/playback/behaviors/collect-errors.js +39 -52
- package/dist/default/playback/behaviors/collect-errors.js.map +1 -1
- package/dist/default/playback/behaviors/derive-cdn-priority.js +16 -23
- package/dist/default/playback/behaviors/derive-cdn-priority.js.map +1 -1
- package/dist/default/playback/behaviors/dom/airplay.js +38 -61
- package/dist/default/playback/behaviors/dom/airplay.js.map +1 -1
- package/dist/default/playback/behaviors/dom/apply-start-position.js +23 -35
- package/dist/default/playback/behaviors/dom/apply-start-position.js.map +1 -1
- package/dist/default/playback/behaviors/dom/end-of-stream.js +11 -16
- package/dist/default/playback/behaviors/dom/end-of-stream.js.map +1 -1
- package/dist/default/playback/behaviors/dom/load-segments.js +27 -39
- package/dist/default/playback/behaviors/dom/load-segments.js.map +1 -1
- package/dist/default/playback/behaviors/dom/recover-end-stall.js +21 -26
- package/dist/default/playback/behaviors/dom/recover-end-stall.js.map +1 -1
- package/dist/default/playback/behaviors/dom/seek-to-live-edge.js +41 -60
- package/dist/default/playback/behaviors/dom/seek-to-live-edge.js.map +1 -1
- package/dist/default/playback/behaviors/dom/setup-buffer-actors.js +50 -74
- package/dist/default/playback/behaviors/dom/setup-buffer-actors.js.map +1 -1
- package/dist/default/playback/behaviors/dom/setup-mediasource.js +29 -43
- package/dist/default/playback/behaviors/dom/setup-mediasource.js.map +1 -1
- package/dist/default/playback/behaviors/dom/setup-text-track-actors.js.map +1 -1
- package/dist/default/playback/behaviors/dom/sync-live-seekable-range.js +3 -4
- package/dist/default/playback/behaviors/dom/sync-live-seekable-range.js.map +1 -1
- package/dist/default/playback/behaviors/dom/sync-text-tracks.js +30 -45
- package/dist/default/playback/behaviors/dom/sync-text-tracks.js.map +1 -1
- package/dist/default/playback/behaviors/dom/track-current-time.js +9 -11
- package/dist/default/playback/behaviors/dom/track-current-time.js.map +1 -1
- package/dist/default/playback/behaviors/dom/track-load-triggers.js +24 -32
- package/dist/default/playback/behaviors/dom/track-load-triggers.js.map +1 -1
- package/dist/default/playback/behaviors/dom/track-playback-rate.js +6 -8
- package/dist/default/playback/behaviors/dom/track-playback-rate.js.map +1 -1
- package/dist/default/playback/behaviors/dom/track-player-resolution.js +10 -14
- package/dist/default/playback/behaviors/dom/track-player-resolution.js.map +1 -1
- package/dist/default/playback/behaviors/dom/track-screen-resolution.js +8 -9
- package/dist/default/playback/behaviors/dom/track-screen-resolution.js.map +1 -1
- package/dist/default/playback/behaviors/dom/update-mediasource-duration.js +28 -43
- package/dist/default/playback/behaviors/dom/update-mediasource-duration.js.map +1 -1
- package/dist/default/playback/behaviors/establish-start-media-time.js +32 -42
- package/dist/default/playback/behaviors/establish-start-media-time.js.map +1 -1
- package/dist/default/playback/behaviors/resolve-presentation.js +13 -22
- package/dist/default/playback/behaviors/resolve-presentation.js.map +1 -1
- package/dist/default/playback/behaviors/resolve-track.js +5 -12
- package/dist/default/playback/behaviors/resolve-track.js.map +1 -1
- package/dist/default/playback/behaviors/select-tracks.js +77 -104
- package/dist/default/playback/behaviors/select-tracks.js.map +1 -1
- package/dist/default/playback/behaviors/setup-failover-monitor.js +11 -16
- package/dist/default/playback/behaviors/setup-failover-monitor.js.map +1 -1
- package/dist/default/playback/behaviors/sync-preload.js +9 -13
- package/dist/default/playback/behaviors/sync-preload.js.map +1 -1
- package/dist/default/playback/behaviors/track-switching.js +189 -173
- package/dist/default/playback/behaviors/track-switching.js.map +1 -1
- package/dist/default/playback/engines/hls/engine-audio-only.js +20 -24
- package/dist/default/playback/engines/hls/engine-audio-only.js.map +1 -1
- package/dist/default/playback/engines/hls/engine-background-video.js +22 -27
- package/dist/default/playback/engines/hls/engine-background-video.js.map +1 -1
- package/dist/default/playback/engines/hls/engine.js +22 -25
- package/dist/default/playback/engines/hls/engine.js.map +1 -1
- package/dist/default/playback/primitives/error-messages.js +16 -25
- package/dist/default/playback/primitives/error-messages.js.map +1 -1
- package/dist/default/playback/primitives/failover-fetch.js +9 -14
- package/dist/default/playback/primitives/failover-fetch.js.map +1 -1
- package/dist/default/playback/primitives/head-peek.js +7 -10
- package/dist/default/playback/primitives/head-peek.js.map +1 -1
- package/dist/default/playback/primitives/live-window.js +12 -15
- package/dist/default/playback/primitives/live-window.js.map +1 -1
- package/dist/default/playback/primitives/relocation-pipelines.js +34 -46
- package/dist/default/playback/primitives/relocation-pipelines.js.map +1 -1
- package/dist/default/playback/primitives/report-track-conditions.js +26 -38
- package/dist/default/playback/primitives/report-track-conditions.js.map +1 -1
- package/dist/default/playback/primitives/segment-load-pipeline.js +15 -15
- package/dist/default/playback/primitives/segment-load-pipeline.js.map +1 -1
- package/dist/default/playback/primitives/selection-rules.js +65 -36
- package/dist/default/playback/primitives/selection-rules.js.map +1 -1
- package/dist/default/playback/primitives/text-segment-load-pipeline.js +4 -5
- package/dist/default/playback/primitives/text-segment-load-pipeline.js.map +1 -1
- package/dist/default/playback/primitives/track-types.js +10 -18
- package/dist/default/playback/primitives/track-types.js.map +1 -1
- package/dist/dev/core/actors/actor.d.ts +4 -4
- package/dist/dev/core/actors/actor.d.ts.map +1 -1
- package/dist/dev/core/actors/create-machine-actor.d.ts +38 -47
- package/dist/dev/core/actors/create-machine-actor.d.ts.map +1 -1
- package/dist/dev/core/actors/create-machine-actor.js +23 -25
- package/dist/dev/core/actors/create-machine-actor.js.map +1 -1
- package/dist/dev/core/actors/create-transition-actor.d.ts +11 -15
- package/dist/dev/core/actors/create-transition-actor.d.ts.map +1 -1
- package/dist/dev/core/actors/create-transition-actor.js +7 -9
- package/dist/dev/core/actors/create-transition-actor.js.map +1 -1
- package/dist/dev/core/composition/create-composition.d.ts +70 -102
- package/dist/dev/core/composition/create-composition.d.ts.map +1 -1
- package/dist/dev/core/composition/create-composition.js +26 -29
- package/dist/dev/core/composition/create-composition.js.map +1 -1
- package/dist/dev/core/composition/share-signals.d.ts +17 -24
- package/dist/dev/core/composition/share-signals.d.ts.map +1 -1
- package/dist/dev/core/composition/share-signals.js +12 -17
- package/dist/dev/core/composition/share-signals.js.map +1 -1
- package/dist/dev/core/machine.d.ts +4 -4
- package/dist/dev/core/machine.js +3 -4
- package/dist/dev/core/machine.js.map +1 -1
- package/dist/dev/core/reactors/create-machine-reactor.d.ts +33 -39
- package/dist/dev/core/reactors/create-machine-reactor.d.ts.map +1 -1
- package/dist/dev/core/reactors/create-machine-reactor.js +20 -19
- package/dist/dev/core/reactors/create-machine-reactor.js.map +1 -1
- package/dist/dev/core/signals/effect.d.ts +3 -4
- package/dist/dev/core/signals/effect.d.ts.map +1 -1
- package/dist/dev/core/signals/effect.js +24 -4
- package/dist/dev/core/signals/effect.js.map +1 -1
- package/dist/dev/core/signals/primitives.d.ts +10 -12
- package/dist/dev/core/signals/primitives.d.ts.map +1 -1
- package/dist/dev/core/signals/primitives.js +10 -14
- package/dist/dev/core/signals/primitives.js.map +1 -1
- package/dist/dev/core/signals/when.js +6 -8
- package/dist/dev/core/signals/when.js.map +1 -1
- package/dist/dev/core/tasks/delayed-reschedule.js +7 -11
- package/dist/dev/core/tasks/delayed-reschedule.js.map +1 -1
- package/dist/dev/core/tasks/task.d.ts +51 -73
- package/dist/dev/core/tasks/task.d.ts.map +1 -1
- package/dist/dev/core/tasks/task.js +59 -82
- package/dist/dev/core/tasks/task.js.map +1 -1
- package/dist/dev/hls.d.ts +3 -1
- package/dist/dev/hls.js +3 -1
- package/dist/dev/index.d.ts +2 -3
- package/dist/dev/index.d.ts.map +1 -1
- package/dist/dev/index.js +2 -3
- package/dist/dev/index.js.map +1 -1
- package/dist/dev/media/abr/quality-selection.d.ts +7 -10
- package/dist/dev/media/abr/quality-selection.d.ts.map +1 -1
- package/dist/dev/media/abr/quality-selection.js +3 -7
- package/dist/dev/media/abr/quality-selection.js.map +1 -1
- package/dist/dev/media/buffer/back-buffer.d.ts +2 -7
- package/dist/dev/media/buffer/back-buffer.d.ts.map +1 -1
- package/dist/dev/media/buffer/back-buffer.js +15 -19
- package/dist/dev/media/buffer/back-buffer.js.map +1 -1
- package/dist/dev/media/buffer/forward-buffer.d.ts +2 -7
- package/dist/dev/media/buffer/forward-buffer.d.ts.map +1 -1
- package/dist/dev/media/buffer/forward-buffer.js +32 -41
- package/dist/dev/media/buffer/forward-buffer.js.map +1 -1
- package/dist/dev/media/dom/capabilities.js +26 -37
- package/dist/dev/media/dom/capabilities.js.map +1 -1
- package/dist/dev/media/dom/mse/append-segment.d.ts +3 -5
- package/dist/dev/media/dom/mse/append-segment.d.ts.map +1 -1
- package/dist/dev/media/dom/mse/append-segment.js +3 -5
- package/dist/dev/media/dom/mse/append-segment.js.map +1 -1
- package/dist/dev/media/dom/mse/buffer-flusher.d.ts +5 -5
- package/dist/dev/media/dom/mse/buffer-flusher.js +5 -5
- package/dist/dev/media/dom/mse/buffer-flusher.js.map +1 -1
- package/dist/dev/media/dom/mse/duration.js +23 -31
- package/dist/dev/media/dom/mse/duration.js.map +1 -1
- package/dist/dev/media/dom/mse/end-of-stream.js +3 -6
- package/dist/dev/media/dom/mse/end-of-stream.js.map +1 -1
- package/dist/dev/media/dom/mse/mediasource-setup.js +65 -81
- package/dist/dev/media/dom/mse/mediasource-setup.js.map +1 -1
- package/dist/dev/media/dom/screen.d.ts.map +1 -1
- package/dist/dev/media/dom/screen.js +37 -54
- package/dist/dev/media/dom/screen.js.map +1 -1
- package/dist/dev/media/dom/text/resolve-vtt-segment.d.ts.map +1 -1
- package/dist/dev/media/dom/text/resolve-vtt-segment.js.map +1 -1
- package/dist/dev/media/dom/text/text-track-slots.d.ts +10 -16
- package/dist/dev/media/dom/text/text-track-slots.d.ts.map +1 -1
- package/dist/dev/media/dom/text/text-track-slots.js +15 -23
- package/dist/dev/media/dom/text/text-track-slots.js.map +1 -1
- package/dist/dev/media/errors.d.ts +32 -46
- package/dist/dev/media/errors.d.ts.map +1 -1
- package/dist/dev/media/errors.js +25 -34
- package/dist/dev/media/errors.js.map +1 -1
- package/dist/dev/media/hls/parse-attributes.js +9 -26
- package/dist/dev/media/hls/parse-attributes.js.map +1 -1
- package/dist/dev/media/hls/parse-media-playlist.js +25 -33
- package/dist/dev/media/hls/parse-media-playlist.js.map +1 -1
- package/dist/dev/media/hls/parse-multivariant.js +3 -3
- package/dist/dev/media/hls/parse-multivariant.js.map +1 -1
- package/dist/dev/media/hls/reload-policy.js +19 -27
- package/dist/dev/media/hls/reload-policy.js.map +1 -1
- package/dist/dev/media/hls/resolve-url.js +1 -3
- package/dist/dev/media/hls/resolve-url.js.map +1 -1
- package/dist/dev/media/live-window.js +9 -13
- package/dist/dev/media/live-window.js.map +1 -1
- package/dist/dev/media/media-tracks/media-tracks.d.ts +8 -13
- package/dist/dev/media/media-tracks/media-tracks.d.ts.map +1 -1
- package/dist/dev/media/media-tracks/media-tracks.js +12 -17
- package/dist/dev/media/media-tracks/media-tracks.js.map +1 -1
- package/dist/dev/media/mp4/box.js +4 -5
- package/dist/dev/media/mp4/box.js.map +1 -1
- package/dist/dev/media/mp4/timestamp-origin.js +30 -42
- package/dist/dev/media/mp4/timestamp-origin.js.map +1 -1
- package/dist/dev/media/primitives/resolution.d.ts +6 -8
- package/dist/dev/media/primitives/resolution.d.ts.map +1 -1
- package/dist/dev/media/primitives/resolution.js +5 -8
- package/dist/dev/media/primitives/resolution.js.map +1 -1
- package/dist/dev/media/primitives/select-tracks.js +24 -34
- package/dist/dev/media/primitives/select-tracks.js.map +1 -1
- package/dist/dev/media/text/parse-vtt-timestamp-map.js +6 -8
- package/dist/dev/media/text/parse-vtt-timestamp-map.js.map +1 -1
- package/dist/dev/media/text/resolve-vtt-metadata.js +8 -9
- package/dist/dev/media/text/resolve-vtt-metadata.js.map +1 -1
- package/dist/dev/media/types/index.d.ts +106 -177
- package/dist/dev/media/types/index.d.ts.map +1 -1
- package/dist/dev/media/types/index.js +10 -18
- package/dist/dev/media/types/index.js.map +1 -1
- package/dist/dev/media/utils/cdn.d.ts +4 -6
- package/dist/dev/media/utils/cdn.d.ts.map +1 -1
- package/dist/dev/media/utils/cdn.js +10 -16
- package/dist/dev/media/utils/cdn.js.map +1 -1
- package/dist/dev/media/utils/preload.js +4 -6
- package/dist/dev/media/utils/preload.js.map +1 -1
- package/dist/dev/media/utils/track-selection.js +10 -14
- package/dist/dev/media/utils/track-selection.js.map +1 -1
- package/dist/dev/media/utils/tracks.js +56 -54
- package/dist/dev/media/utils/tracks.js.map +1 -1
- package/dist/dev/network/bandwidth-estimator.d.ts +7 -9
- package/dist/dev/network/bandwidth-estimator.d.ts.map +1 -1
- package/dist/dev/network/bandwidth-estimator.js +18 -19
- package/dist/dev/network/bandwidth-estimator.js.map +1 -1
- package/dist/dev/network/chunked-stream-iterable.js +4 -6
- package/dist/dev/network/chunked-stream-iterable.js.map +1 -1
- package/dist/dev/network/ewma.js +22 -25
- package/dist/dev/network/ewma.js.map +1 -1
- package/dist/dev/network/fetch.js +30 -37
- package/dist/dev/network/fetch.js.map +1 -1
- package/dist/dev/playback/actors/dom/segment-loader.d.ts +7 -11
- package/dist/dev/playback/actors/dom/segment-loader.d.ts.map +1 -1
- package/dist/dev/playback/actors/dom/segment-loader.js +28 -44
- package/dist/dev/playback/actors/dom/segment-loader.js.map +1 -1
- package/dist/dev/playback/actors/dom/source-buffer.d.ts +5 -7
- package/dist/dev/playback/actors/dom/source-buffer.d.ts.map +1 -1
- package/dist/dev/playback/actors/dom/source-buffer.js.map +1 -1
- package/dist/dev/playback/actors/dom/text-tracks.js.map +1 -1
- package/dist/dev/playback/actors/text-track-segment-loader.d.ts +10 -16
- package/dist/dev/playback/actors/text-track-segment-loader.d.ts.map +1 -1
- package/dist/dev/playback/actors/text-track-segment-loader.js +24 -35
- package/dist/dev/playback/actors/text-track-segment-loader.js.map +1 -1
- package/dist/dev/playback/actors/text-tracks.d.ts +5 -8
- package/dist/dev/playback/actors/text-tracks.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-audio/adapter.d.ts +11 -14
- package/dist/dev/playback/adapters/hls-audio/adapter.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-audio/adapter.js +23 -31
- package/dist/dev/playback/adapters/hls-audio/adapter.js.map +1 -1
- package/dist/dev/playback/adapters/hls-audio/media.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-audio/media.js.map +1 -1
- package/dist/dev/playback/adapters/hls-background-video/adapter.d.ts +28 -39
- package/dist/dev/playback/adapters/hls-background-video/adapter.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-background-video/adapter.js +50 -70
- package/dist/dev/playback/adapters/hls-background-video/adapter.js.map +1 -1
- package/dist/dev/playback/adapters/hls-background-video/host.d.ts +12 -16
- package/dist/dev/playback/adapters/hls-background-video/host.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-background-video/host.js +12 -16
- package/dist/dev/playback/adapters/hls-background-video/host.js.map +1 -1
- package/dist/dev/playback/adapters/hls-background-video/media.d.ts +5 -8
- package/dist/dev/playback/adapters/hls-background-video/media.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-background-video/media.js +5 -8
- package/dist/dev/playback/adapters/hls-background-video/media.js.map +1 -1
- package/dist/dev/playback/adapters/hls-video/adapter.d.ts +12 -14
- package/dist/dev/playback/adapters/hls-video/adapter.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-video/adapter.js +43 -60
- package/dist/dev/playback/adapters/hls-video/adapter.js.map +1 -1
- package/dist/dev/playback/adapters/hls-video/error-surface.d.ts +4 -5
- package/dist/dev/playback/adapters/hls-video/error-surface.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-video/error-surface.js +13 -18
- package/dist/dev/playback/adapters/hls-video/error-surface.js.map +1 -1
- package/dist/dev/playback/adapters/hls-video/media-tracks.d.ts +4 -5
- package/dist/dev/playback/adapters/hls-video/media-tracks.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-video/media-tracks.js +4 -5
- package/dist/dev/playback/adapters/hls-video/media-tracks.js.map +1 -1
- package/dist/dev/playback/adapters/hls-video/media.d.ts.map +1 -1
- package/dist/dev/playback/adapters/hls-video/media.js.map +1 -1
- package/dist/dev/playback/adapters/mux-audio/media.d.ts +8 -12
- package/dist/dev/playback/adapters/mux-audio/media.d.ts.map +1 -1
- package/dist/dev/playback/adapters/mux-audio/media.js +8 -12
- package/dist/dev/playback/adapters/mux-audio/media.js.map +1 -1
- package/dist/dev/playback/adapters/mux-video/adapter.d.ts +9 -11
- package/dist/dev/playback/adapters/mux-video/adapter.d.ts.map +1 -1
- package/dist/dev/playback/adapters/mux-video/adapter.js +25 -33
- package/dist/dev/playback/adapters/mux-video/adapter.js.map +1 -1
- package/dist/dev/playback/adapters/mux-video/media.d.ts +7 -9
- package/dist/dev/playback/adapters/mux-video/media.d.ts.map +1 -1
- package/dist/dev/playback/adapters/mux-video/media.js +7 -9
- package/dist/dev/playback/adapters/mux-video/media.js.map +1 -1
- package/dist/dev/playback/behaviors/calculate-presentation-duration.d.ts +5 -8
- package/dist/dev/playback/behaviors/calculate-presentation-duration.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/calculate-presentation-duration.js +5 -8
- package/dist/dev/playback/behaviors/calculate-presentation-duration.js.map +1 -1
- package/dist/dev/playback/behaviors/collect-errors.d.ts +2 -0
- package/dist/dev/playback/behaviors/collect-errors.js +39 -52
- package/dist/dev/playback/behaviors/collect-errors.js.map +1 -1
- package/dist/dev/playback/behaviors/derive-cdn-priority.js +16 -23
- package/dist/dev/playback/behaviors/derive-cdn-priority.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/airplay.js +38 -61
- package/dist/dev/playback/behaviors/dom/airplay.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/apply-start-position.js +23 -35
- package/dist/dev/playback/behaviors/dom/apply-start-position.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/end-of-stream.js +11 -16
- package/dist/dev/playback/behaviors/dom/end-of-stream.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/load-segments.d.ts +5 -8
- package/dist/dev/playback/behaviors/dom/load-segments.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/dom/load-segments.js +27 -39
- package/dist/dev/playback/behaviors/dom/load-segments.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/recover-end-stall.js +21 -26
- package/dist/dev/playback/behaviors/dom/recover-end-stall.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/seek-to-live-edge.js +41 -60
- package/dist/dev/playback/behaviors/dom/seek-to-live-edge.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/setup-buffer-actors.js +50 -74
- package/dist/dev/playback/behaviors/dom/setup-buffer-actors.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/setup-mediasource.js +29 -43
- package/dist/dev/playback/behaviors/dom/setup-mediasource.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/setup-text-track-actors.d.ts +3 -3
- package/dist/dev/playback/behaviors/dom/setup-text-track-actors.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/dom/setup-text-track-actors.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/sync-live-seekable-range.js +3 -4
- package/dist/dev/playback/behaviors/dom/sync-live-seekable-range.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/sync-text-tracks.js +30 -45
- package/dist/dev/playback/behaviors/dom/sync-text-tracks.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/track-current-time.d.ts +2 -2
- package/dist/dev/playback/behaviors/dom/track-current-time.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/dom/track-current-time.js +9 -11
- package/dist/dev/playback/behaviors/dom/track-current-time.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/track-load-triggers.d.ts +6 -12
- package/dist/dev/playback/behaviors/dom/track-load-triggers.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/dom/track-load-triggers.js +24 -32
- package/dist/dev/playback/behaviors/dom/track-load-triggers.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/track-playback-rate.d.ts +2 -2
- package/dist/dev/playback/behaviors/dom/track-playback-rate.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/dom/track-playback-rate.js +6 -8
- package/dist/dev/playback/behaviors/dom/track-playback-rate.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/track-player-resolution.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/dom/track-player-resolution.js +10 -14
- package/dist/dev/playback/behaviors/dom/track-player-resolution.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/track-screen-resolution.js +8 -9
- package/dist/dev/playback/behaviors/dom/track-screen-resolution.js.map +1 -1
- package/dist/dev/playback/behaviors/dom/update-mediasource-duration.js +28 -43
- package/dist/dev/playback/behaviors/dom/update-mediasource-duration.js.map +1 -1
- package/dist/dev/playback/behaviors/establish-start-media-time.d.ts +15 -19
- package/dist/dev/playback/behaviors/establish-start-media-time.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/establish-start-media-time.js +32 -42
- package/dist/dev/playback/behaviors/establish-start-media-time.js.map +1 -1
- package/dist/dev/playback/behaviors/resolve-presentation.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/resolve-presentation.js +13 -22
- package/dist/dev/playback/behaviors/resolve-presentation.js.map +1 -1
- package/dist/dev/playback/behaviors/resolve-track.js +5 -12
- package/dist/dev/playback/behaviors/resolve-track.js.map +1 -1
- package/dist/dev/playback/behaviors/select-tracks.d.ts +28 -39
- package/dist/dev/playback/behaviors/select-tracks.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/select-tracks.js +77 -104
- package/dist/dev/playback/behaviors/select-tracks.js.map +1 -1
- package/dist/dev/playback/behaviors/setup-failover-monitor.d.ts +1 -4
- package/dist/dev/playback/behaviors/setup-failover-monitor.d.ts.map +1 -1
- package/dist/dev/playback/behaviors/setup-failover-monitor.js +11 -16
- package/dist/dev/playback/behaviors/setup-failover-monitor.js.map +1 -1
- package/dist/dev/playback/behaviors/sync-preload.js +9 -13
- package/dist/dev/playback/behaviors/sync-preload.js.map +1 -1
- package/dist/dev/playback/behaviors/track-switching.d.ts +110 -0
- package/dist/dev/playback/behaviors/track-switching.d.ts.map +1 -0
- package/dist/dev/playback/behaviors/track-switching.js +189 -173
- package/dist/dev/playback/behaviors/track-switching.js.map +1 -1
- package/dist/dev/playback/engines/hls/engine-audio-only.d.ts +59 -72
- package/dist/dev/playback/engines/hls/engine-audio-only.d.ts.map +1 -1
- package/dist/dev/playback/engines/hls/engine-audio-only.js +20 -24
- package/dist/dev/playback/engines/hls/engine-audio-only.js.map +1 -1
- package/dist/dev/playback/engines/hls/engine-background-video.d.ts +51 -78
- package/dist/dev/playback/engines/hls/engine-background-video.d.ts.map +1 -1
- package/dist/dev/playback/engines/hls/engine-background-video.js +22 -27
- package/dist/dev/playback/engines/hls/engine-background-video.js.map +1 -1
- package/dist/dev/playback/engines/hls/engine.d.ts +115 -155
- package/dist/dev/playback/engines/hls/engine.d.ts.map +1 -1
- package/dist/dev/playback/engines/hls/engine.js +22 -25
- package/dist/dev/playback/engines/hls/engine.js.map +1 -1
- package/dist/dev/playback/primitives/derive-start-media-time.d.ts +3 -3
- package/dist/dev/playback/primitives/derive-start-media-time.d.ts.map +1 -1
- package/dist/dev/playback/primitives/error-messages.js +16 -25
- package/dist/dev/playback/primitives/error-messages.js.map +1 -1
- package/dist/dev/playback/primitives/failover-fetch.js +9 -14
- package/dist/dev/playback/primitives/failover-fetch.js.map +1 -1
- package/dist/dev/playback/primitives/head-peek.js +7 -10
- package/dist/dev/playback/primitives/head-peek.js.map +1 -1
- package/dist/dev/playback/primitives/live-window.js +12 -15
- package/dist/dev/playback/primitives/live-window.js.map +1 -1
- package/dist/dev/playback/primitives/relocation-pipelines.js +34 -46
- package/dist/dev/playback/primitives/relocation-pipelines.js.map +1 -1
- package/dist/dev/playback/primitives/report-track-conditions.d.ts +1 -4
- package/dist/dev/playback/primitives/report-track-conditions.d.ts.map +1 -1
- package/dist/dev/playback/primitives/report-track-conditions.js +26 -38
- package/dist/dev/playback/primitives/report-track-conditions.js.map +1 -1
- package/dist/dev/playback/primitives/segment-load-pipeline.js +15 -15
- package/dist/dev/playback/primitives/segment-load-pipeline.js.map +1 -1
- package/dist/dev/playback/primitives/selection-rules.d.ts +45 -17
- package/dist/dev/playback/primitives/selection-rules.d.ts.map +1 -1
- package/dist/dev/playback/primitives/selection-rules.js +65 -36
- package/dist/dev/playback/primitives/selection-rules.js.map +1 -1
- package/dist/dev/playback/primitives/source-buffer-messages.d.ts +6 -9
- package/dist/dev/playback/primitives/source-buffer-messages.d.ts.map +1 -1
- package/dist/dev/playback/primitives/text-segment-load-pipeline.d.ts +20 -29
- package/dist/dev/playback/primitives/text-segment-load-pipeline.d.ts.map +1 -1
- package/dist/dev/playback/primitives/text-segment-load-pipeline.js +4 -5
- package/dist/dev/playback/primitives/text-segment-load-pipeline.js.map +1 -1
- package/dist/dev/playback/primitives/text-track-messages.d.ts.map +1 -1
- package/dist/dev/playback/primitives/track-types.js +10 -18
- package/dist/dev/playback/primitives/track-types.js.map +1 -1
- package/package.json +25 -28
|
@@ -6,33 +6,29 @@ const muxMediaDefaultProps = {
|
|
|
6
6
|
source: null
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* Mux identity over any SPF Media: the structured `source`, the `src` derived
|
|
10
|
-
* from it, and the image URLs it describes.
|
|
9
|
+
* Mux identity over any SPF Media: the structured `source`, the `src` derived from it, and the image URLs it describes.
|
|
11
10
|
*
|
|
12
|
-
* Everything here is Mux identity, so it carries no engine and both flavors get
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* on, only a common `src` accessor to write through.
|
|
11
|
+
* Everything here is Mux identity, so it carries no engine and both flavors get it unchanged — the video Media over the
|
|
12
|
+
* full HLS engine, the audio-only Media over the subtractive one. A mixin rather than a shared base class because each
|
|
13
|
+
* flavor extends a different SPF Media, so there is no common class to put this on, only a common `src` accessor to
|
|
14
|
+
* write through.
|
|
17
15
|
*
|
|
18
|
-
* Unlike the hls.js-backed `MuxMedia`, there is no inherited `source` to
|
|
19
|
-
*
|
|
20
|
-
* source and dispatches `sourcechange` itself.
|
|
16
|
+
* Unlike the hls.js-backed `MuxMedia`, there is no inherited `source` to delegate to — the SPF Medias know only `src` —
|
|
17
|
+
* so this owns the structured source and dispatches `sourcechange` itself.
|
|
21
18
|
*
|
|
22
|
-
* @fires sourcechange - Fired when `source` changes, either directly or by parsing a new `src`. Read `source` for the
|
|
19
|
+
* @fires sourcechange - Fired when `source` changes, either directly or by parsing a new `src`. Read `source` for the
|
|
20
|
+
* new value.
|
|
23
21
|
* @fires contentdatachange - Fired when the derived `contentData` changes. Read `contentData` for the new value.
|
|
24
22
|
*/
|
|
25
23
|
function MuxMediaMixin(BaseClass) {
|
|
26
24
|
class MuxMediaImpl extends BaseClass {
|
|
27
25
|
/**
|
|
28
|
-
* Named on the error copy when this engine can't play a source: the
|
|
29
|
-
*
|
|
30
|
-
* SPF does not, and it backs both `<mux-video>` and `<mux-audio>`.
|
|
26
|
+
* Named on the error copy when this engine can't play a source: the hls.js-backed Mux Media plays the MPEG-TS and
|
|
27
|
+
* DRM-protected sources that SPF does not, and it backs both `<mux-video>` and `<mux-audio>`.
|
|
31
28
|
*
|
|
32
|
-
* Names the flavor rather than an import path, because one Media is reached
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* common to the layers a consumer imports elements and components from.
|
|
29
|
+
* Names the flavor rather than an import path, because one Media is reached through three of them —
|
|
30
|
+
* `@videojs/html`, `@videojs/react`, and this package — and each has a different counterpart. The flavor suffix is
|
|
31
|
+
* the one thing common to the layers a consumer imports elements and components from.
|
|
36
32
|
*/
|
|
37
33
|
static get alternativeMediaSuggestion() {
|
|
38
34
|
return "Try the hls.js-backed Mux media instead: import the `hls-js` flavor in place of the `spf` one.";
|
|
@@ -40,13 +36,11 @@ function MuxMediaMixin(BaseClass) {
|
|
|
40
36
|
#source = muxMediaDefaultProps.source;
|
|
41
37
|
#contentData = {};
|
|
42
38
|
/**
|
|
43
|
-
* Media source URL. Setting a Mux stream URL
|
|
44
|
-
*
|
|
45
|
-
* and query params into `source`; other URLs are kept as a plain `source.src`.
|
|
39
|
+
* Media source URL. Setting a Mux stream URL (`https://stream.mux.com/<playback-id>.m3u8?...`) extracts the
|
|
40
|
+
* playback ID and query params into `source`; other URLs are kept as a plain `source.src`.
|
|
46
41
|
*
|
|
47
|
-
* Only playback options carry over. Mux identity comes from the URL, and the
|
|
48
|
-
*
|
|
49
|
-
* so carrying them onto a different source would build rejected URLs.
|
|
42
|
+
* Only playback options carry over. Mux identity comes from the URL, and the signed `poster`, `storyboard`, and
|
|
43
|
+
* `drm` tokens are scoped to a playback ID, so carrying them onto a different source would build rejected URLs.
|
|
50
44
|
*/
|
|
51
45
|
get src() {
|
|
52
46
|
return super.src;
|
|
@@ -56,10 +50,9 @@ function MuxMediaMixin(BaseClass) {
|
|
|
56
50
|
this.source = parseMuxVideoURL(value) ?? (value ? { src: value } : null);
|
|
57
51
|
}
|
|
58
52
|
/**
|
|
59
|
-
* Structured Mux source. Setting it derives `src` from the playback ID, custom
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* token.
|
|
53
|
+
* Structured Mux source. Setting it derives `src` from the playback ID, custom domain, and `playback` params
|
|
54
|
+
* (appended as `snake_case` query params). A `playback.token` replaces all other params — signed URLs bake them
|
|
55
|
+
* into the token.
|
|
63
56
|
*/
|
|
64
57
|
get source() {
|
|
65
58
|
return this.#source;
|
|
@@ -74,12 +67,11 @@ function MuxMediaMixin(BaseClass) {
|
|
|
74
67
|
if (contentDataChanged) this.dispatchEvent?.(new Event("contentdatachange"));
|
|
75
68
|
}
|
|
76
69
|
/**
|
|
77
|
-
* Image URLs `source` describes rather than plays: `poster` from its `poster`
|
|
78
|
-
*
|
|
70
|
+
* Image URLs `source` describes rather than plays: `poster` from its `poster` params, `storyboard` from its
|
|
71
|
+
* `storyboard` params.
|
|
79
72
|
*
|
|
80
|
-
* Derived from `source` and nothing else. The same object is handed back
|
|
81
|
-
*
|
|
82
|
-
* it does. Nothing here is applied for you.
|
|
73
|
+
* Derived from `source` and nothing else. The same object is handed back until one of those URLs changes, and
|
|
74
|
+
* `contentdatachange` announces it when it does. Nothing here is applied for you.
|
|
83
75
|
*/
|
|
84
76
|
get contentData() {
|
|
85
77
|
return this.#contentData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","names":["#source","#refreshContentData","#contentData"],"sources":["../../../../../src/playback/adapters/mux-video/adapter.ts"],"sourcesContent":["import {\n createMuxPosterURL,\n createMuxStoryboardURL,\n createMuxVideoURL,\n type MuxContentData,\n type MuxSourceBase,\n parseMuxVideoURL,\n} from '@videojs/media/dom/mux/source';\nimport { shallowEqual } from '@videojs/utils/object';\nimport type { Constructor, MixinReturn } from '@videojs/utils/types';\n\nexport interface MuxMediaProps {\n src: string;\n source: MuxSourceBase | null;\n}\n\nexport const muxMediaDefaultProps: MuxMediaProps = {\n src: '',\n source: null,\n};\n\nexport interface MuxMediaAPI extends MuxMediaProps {\n readonly contentData: MuxContentData;\n}\n\n/**\n * Mux identity over any SPF Media: the structured `source`, the `src` derived
|
|
1
|
+
{"version":3,"file":"adapter.js","names":["#source","#refreshContentData","#contentData"],"sources":["../../../../../src/playback/adapters/mux-video/adapter.ts"],"sourcesContent":["import {\n createMuxPosterURL,\n createMuxStoryboardURL,\n createMuxVideoURL,\n type MuxContentData,\n type MuxSourceBase,\n parseMuxVideoURL,\n} from '@videojs/media/dom/mux/source';\nimport { shallowEqual } from '@videojs/utils/object';\nimport type { Constructor, MixinReturn } from '@videojs/utils/types';\n\nexport interface MuxMediaProps {\n src: string;\n source: MuxSourceBase | null;\n}\n\nexport const muxMediaDefaultProps: MuxMediaProps = {\n src: '',\n source: null,\n};\n\nexport interface MuxMediaAPI extends MuxMediaProps {\n readonly contentData: MuxContentData;\n}\n\n/**\n * Mux identity over any SPF Media: the structured `source`, the `src` derived from it, and the image URLs it describes.\n *\n * Everything here is Mux identity, so it carries no engine and both flavors get it unchanged — the video Media over the\n * full HLS engine, the audio-only Media over the subtractive one. A mixin rather than a shared base class because each\n * flavor extends a different SPF Media, so there is no common class to put this on, only a common `src` accessor to\n * write through.\n *\n * Unlike the hls.js-backed `MuxMedia`, there is no inherited `source` to delegate to — the SPF Medias know only `src` —\n * so this owns the structured source and dispatches `sourcechange` itself.\n *\n * @fires sourcechange - Fired when `source` changes, either directly or by parsing a new `src`. Read `source` for the\n * new value.\n * @fires contentdatachange - Fired when the derived `contentData` changes. Read `contentData` for the new value.\n */\nexport function MuxMediaMixin<Base extends Constructor<any>>(BaseClass: Base) {\n class MuxMediaImpl extends BaseClass {\n /**\n * Named on the error copy when this engine can't play a source: the hls.js-backed Mux Media plays the MPEG-TS and\n * DRM-protected sources that SPF does not, and it backs both `<mux-video>` and `<mux-audio>`.\n *\n * Names the flavor rather than an import path, because one Media is reached through three of them —\n * `@videojs/html`, `@videojs/react`, and this package — and each has a different counterpart. The flavor suffix is\n * the one thing common to the layers a consumer imports elements and components from.\n */\n static get alternativeMediaSuggestion(): string | undefined {\n return 'Try the hls.js-backed Mux media instead: import the `hls-js` flavor in place of the `spf` one.';\n }\n\n #source: MuxSourceBase | null = muxMediaDefaultProps.source;\n #contentData: MuxContentData = {};\n\n /**\n * Media source URL. Setting a Mux stream URL (`https://stream.mux.com/<playback-id>.m3u8?...`) extracts the\n * playback ID and query params into `source`; other URLs are kept as a plain `source.src`.\n *\n * Only playback options carry over. Mux identity comes from the URL, and the signed `poster`, `storyboard`, and\n * `drm` tokens are scoped to a playback ID, so carrying them onto a different source would build rejected URLs.\n */\n get src(): string {\n return super.src;\n }\n\n set src(value: string) {\n // A URL already describing the current source leaves it alone. The elements\n // reflect the derived `src` back to the host, and re-deriving would drop the\n // params a Mux URL does not carry, such as `poster`.\n if (super.src === value) return;\n\n this.source = parseMuxVideoURL(value) ?? (value ? { src: value } : null);\n }\n\n /**\n * Structured Mux source. Setting it derives `src` from the playback ID, custom domain, and `playback` params\n * (appended as `snake_case` query params). A `playback.token` replaces all other params — signed URLs bake them\n * into the token.\n */\n get source(): MuxSourceBase | null {\n return this.#source;\n }\n\n set source(value: MuxSourceBase | null) {\n const source = value ?? null;\n // Changing anything takes a new object, so handing the same one back costs\n // nothing.\n if (source === this.#source) return;\n\n this.#source = source;\n\n // Refresh the bag before announcing `sourcechange`, because listeners read\n // `contentData` from that event. Announcing its own change waits until\n // after, so `src` is in step by the time either event fires.\n const contentDataChanged = this.#refreshContentData();\n\n super.src = (source && (createMuxVideoURL(source) ?? source.src)) || '';\n\n this.dispatchEvent?.(new Event('sourcechange'));\n\n if (contentDataChanged) this.dispatchEvent?.(new Event('contentdatachange'));\n }\n\n /**\n * Image URLs `source` describes rather than plays: `poster` from its `poster` params, `storyboard` from its\n * `storyboard` params.\n *\n * Derived from `source` and nothing else. The same object is handed back until one of those URLs changes, and\n * `contentdatachange` announces it when it does. Nothing here is applied for you.\n */\n get contentData(): MuxContentData {\n return this.#contentData;\n }\n\n /** Rebuild the derived bag, reporting whether anything about it changed. */\n #refreshContentData(): boolean {\n const poster = createMuxPosterURL(this.#source);\n const storyboard = createMuxStoryboardURL(this.#source);\n\n const next: MuxContentData = {\n ...(poster && { poster }),\n ...(storyboard && { storyboard }),\n };\n if (shallowEqual(this.#contentData, next)) return false;\n\n this.#contentData = next;\n return true;\n }\n }\n\n // `MixinReturn` sources statics from `Base`, so this mixin's own needs adding\n // back to the type or callers can't read it.\n return MuxMediaImpl as unknown as MixinReturn<Base, MuxMediaAPI> & {\n readonly alternativeMediaSuggestion: string | undefined;\n };\n}\n"],"mappings":";;;AAgBA,MAAa,uBAAsC;CACjD,KAAK;CACL,QAAQ;AACV;;;;;;;;;;;;;;;;AAqBA,SAAgB,cAA6C,WAAiB;CAC5E,MAAM,qBAAqB,UAAU;;;;;;;;;EASnC,WAAW,6BAAiD;GAC1D,OAAO;EACT;EAEA,UAAgC,qBAAqB;EACrD,eAA+B,CAAC;;;;;;;;EAShC,IAAI,MAAc;GAChB,OAAO,MAAM;EACf;EAEA,IAAI,IAAI,OAAe;GAIrB,IAAI,MAAM,QAAQ,OAAO;GAEzB,KAAK,SAAS,iBAAiB,KAAK,MAAM,QAAQ,EAAE,KAAK,MAAM,IAAI;EACrE;;;;;;EAOA,IAAI,SAA+B;GACjC,OAAO,KAAKA;EACd;EAEA,IAAI,OAAO,OAA6B;GACtC,MAAM,SAAS,SAAS;GAGxB,IAAI,WAAW,KAAKA,SAAS;GAE7B,KAAKA,UAAU;GAKf,MAAM,qBAAqB,KAAKC,oBAAoB;GAEpD,MAAM,MAAO,WAAW,kBAAkB,MAAM,KAAK,OAAO,QAAS;GAErE,KAAK,gBAAgB,IAAI,MAAM,cAAc,CAAC;GAE9C,IAAI,oBAAoB,KAAK,gBAAgB,IAAI,MAAM,mBAAmB,CAAC;EAC7E;;;;;;;;EASA,IAAI,cAA8B;GAChC,OAAO,KAAKC;EACd;;EAGA,sBAA+B;GAC7B,MAAM,SAAS,mBAAmB,KAAKF,OAAO;GAC9C,MAAM,aAAa,uBAAuB,KAAKA,OAAO;GAEtD,MAAM,OAAuB;IAC3B,GAAI,UAAU,EAAE,OAAO;IACvB,GAAI,cAAc,EAAE,WAAW;GACjC;GACA,IAAI,aAAa,KAAKE,cAAc,IAAI,GAAG,OAAO;GAElD,KAAKA,eAAe;GACpB,OAAO;EACT;CACF;CAIA,OAAO;AAGT"}
|
|
@@ -5,16 +5,14 @@ const MuxVideoMediaBase = MuxMediaMixin(HlsVideoMedia);
|
|
|
5
5
|
/**
|
|
6
6
|
* The Mux Media over the SPF HLS engine.
|
|
7
7
|
*
|
|
8
|
-
* Mirrors `@videojs/media/dom/mux`'s hls.js-backed `MuxMedia` — same class shape,
|
|
9
|
-
* same
|
|
10
|
-
* engine
|
|
11
|
-
*
|
|
12
|
-
* engine-shaped config for a consumer to pass, so the source is Mux identity and
|
|
13
|
-
* nothing else.
|
|
8
|
+
* Mirrors `@videojs/media/dom/mux`'s hls.js-backed `MuxMedia` — same class shape, same `src`/`source` relationship,
|
|
9
|
+
* same derived `contentData` — over a different engine, though named for the flavor rather than sharing that class's
|
|
10
|
+
* name. It carries no `engine` or `preferPlayback`: SPF publishes no engine-shaped config for a consumer to pass, so
|
|
11
|
+
* the source is Mux identity and nothing else.
|
|
14
12
|
*
|
|
15
|
-
* `source.drm` is accepted but inert. SPF prunes encrypted renditions and reports
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* `source.drm` is accepted but inert. SPF prunes encrypted renditions and reports unsupported DRM, and
|
|
14
|
+
* `alternativeMediaSuggestion` points at the hls.js-backed import, so a protected source fails with copy that says
|
|
15
|
+
* where to go.
|
|
18
16
|
*/
|
|
19
17
|
var MuxVideoMedia = class extends MuxVideoMediaBase {};
|
|
20
18
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","names":[],"sources":["../../../../../src/playback/adapters/mux-video/media.ts"],"sourcesContent":["import { HlsVideoMedia } from '../hls-video/media';\nimport { MuxMediaMixin } from './adapter';\n\nconst MuxVideoMediaBase = MuxMediaMixin(HlsVideoMedia);\n\n/**\n * The Mux Media over the SPF HLS engine.\n *\n * Mirrors `@videojs/media/dom/mux`'s hls.js-backed `MuxMedia` — same class shape
|
|
1
|
+
{"version":3,"file":"media.js","names":[],"sources":["../../../../../src/playback/adapters/mux-video/media.ts"],"sourcesContent":["import { HlsVideoMedia } from '../hls-video/media';\nimport { MuxMediaMixin } from './adapter';\n\nconst MuxVideoMediaBase = MuxMediaMixin(HlsVideoMedia);\n\n/**\n * The Mux Media over the SPF HLS engine.\n *\n * Mirrors `@videojs/media/dom/mux`'s hls.js-backed `MuxMedia` — same class shape, same `src`/`source` relationship,\n * same derived `contentData` — over a different engine, though named for the flavor rather than sharing that class's\n * name. It carries no `engine` or `preferPlayback`: SPF publishes no engine-shaped config for a consumer to pass, so\n * the source is Mux identity and nothing else.\n *\n * `source.drm` is accepted but inert. SPF prunes encrypted renditions and reports unsupported DRM, and\n * `alternativeMediaSuggestion` points at the hls.js-backed import, so a protected source fails with copy that says\n * where to go.\n */\nexport class MuxVideoMedia extends MuxVideoMediaBase {}\n"],"mappings":";;;AAGA,MAAM,oBAAoB,cAAc,aAAa;;;;;;;;;;;;;AAcrD,IAAa,gBAAb,cAAmC,kBAAkB,CAAC"}
|
|
@@ -16,14 +16,11 @@ function calculatePresentationDurationSetup({ state, config }) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* `calculatePresentationDuration` uses a manual `Behavior<>` literal
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* reason: the behavior is uniform-across-tracks and reads slots
|
|
25
|
-
* contributed by other behaviors, so it shouldn't leak those slot
|
|
26
|
-
* declarations into variants that don't compose the contributors.
|
|
19
|
+
* `calculatePresentationDuration` uses a manual `Behavior<>` literal (rather than `defineBehavior`) so it can declare
|
|
20
|
+
* just `presentation` in its stateKeys while the typed setup-param shape includes the optional `selectedVideoTrackId` /
|
|
21
|
+
* `selectedAudioTrackId` reads used at runtime. Mirrors the pattern in `endOfStream` for the same reason: the behavior
|
|
22
|
+
* is uniform-across-tracks and reads slots contributed by other behaviors, so it shouldn't leak those slot declarations
|
|
23
|
+
* into variants that don't compose the contributors.
|
|
27
24
|
*/
|
|
28
25
|
const calculatePresentationDuration = {
|
|
29
26
|
stateKeys: ["presentation"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-presentation-duration.js","names":[],"sources":["../../../../src/playback/behaviors/calculate-presentation-duration.ts"],"sourcesContent":["/**\n * **Populate presentation duration via a config-supplied resolver.**\n *\n * Once a presentation is in place and its `duration` is still undefined
|
|
1
|
+
{"version":3,"file":"calculate-presentation-duration.js","names":[],"sources":["../../../../src/playback/behaviors/calculate-presentation-duration.ts"],"sourcesContent":["/**\n * **Populate presentation duration via a config-supplied resolver.**\n *\n * Once a presentation is in place and its `duration` is still undefined, calls `config.resolveDuration(state)` whenever\n * a tracked slot changes. The resolver decides what counts as \"duration is now derivable\" for the variant in play; the\n * behavior itself stays variant-agnostic:\n *\n * - **VoD** — derive from the first resolved selected track's `duration` (video preferred, audio fallback). The HLS\n * engine wires `getResolvedSelectedTrackDuration` from `media/utils/track-selection.ts` as the default. Audio-only\n * falls out of the same resolver naturally (no video selected → audio is the first resolved track).\n * - **Live** — return `Number.POSITIVE_INFINITY` once the presentation is established as live. This is the MSE-spec value\n * for `mediaSource.duration` under live playback; downstream `updateMediaSourceDuration` propagates it through.\n *\n * Validation: writes whatever the resolver returns as long as it's a positive number, including `Infinity`. `undefined`\n * / `NaN` / `<= 0` are skipped.\n *\n * Fires at most once per presentation — an already-set `duration` is never overwritten, and the next reset arrives\n * structurally when a new (unresolved) presentation replaces the current one. The resolver may return `undefined` while\n * duration is still indeterminate; subsequent tracked-slot changes re-run the effect until the resolver commits a\n * value.\n *\n * Downstream of `resolveVideoTrack` / `resolveAudioTrack`; upstream of `updateMediaSourceDuration` (which writes the\n * value through to `mediaSource.duration`).\n */\nimport type { Behavior } from '../../core/composition/create-composition';\nimport { effect } from '../../core/signals/effect';\nimport { type ReadonlySignal, type Signal, untrack, update } from '../../core/signals/primitives';\nimport type { MaybeResolvedPresentation } from '../../media/types';\n\n/**\n * Input shape passed to the duration resolver. Represents the union of track-selection slots the default\n * `getResolvedSelectedTrackDuration` resolver inspects to pick a representative resolved track. Variants that compose\n * neither audio nor video selection still satisfy this shape — the missing fields read as `undefined` and the resolver\n * falls through.\n */\nexport interface PresentationDurationState {\n presentation?: MaybeResolvedPresentation;\n selectedVideoTrackId?: string;\n selectedAudioTrackId?: string;\n}\n\n/**\n * Resolver supplied via `config.resolveDuration`. Returns the duration to write to `presentation.duration`, or\n * `undefined` when it isn't yet derivable. Positive `Infinity` is the canonical live value.\n */\nexport type PresentationDurationResolver = (state: PresentationDurationState) => number | undefined;\n\nexport interface PresentationDurationConfig {\n resolveDuration: PresentationDurationResolver;\n}\n\nfunction calculatePresentationDurationSetup({\n state,\n config,\n}: {\n state: {\n presentation: Signal<PresentationDurationState['presentation']>;\n // selectedVideoTrackId / selectedAudioTrackId are read defensively —\n // they are *not* declared in this behavior's stateKeys. The slots are\n // contributed by other behaviors (`switchVideoTrack` writes the\n // video slot in the default engine; `selectAudioTrack` writes the\n // audio slot) which compose conditionally per engine variant. Treating\n // each signal as optional lets calculatePresentationDuration stay\n // variant-agnostic — it feeds whatever's present to the resolver and\n // lets the resolver decide.\n selectedVideoTrackId?: ReadonlySignal<PresentationDurationState['selectedVideoTrackId']>;\n selectedAudioTrackId?: ReadonlySignal<PresentationDurationState['selectedAudioTrackId']>;\n };\n config: PresentationDurationConfig;\n}): () => void {\n return effect(() => {\n const presentation = state.presentation.get();\n if (!presentation || presentation.duration !== undefined) return;\n\n // presentation drives the effect; selection-only changes can't yield a\n // writable duration on their own (resolver returns undefined until a\n // track resolves, at which point resolve-track writes back through\n // state.presentation anyway), so we read the rest untracked.\n const resolverInput: PresentationDurationState = untrack(() => ({\n presentation,\n selectedVideoTrackId: state.selectedVideoTrackId?.get(),\n selectedAudioTrackId: state.selectedAudioTrackId?.get(),\n }));\n const duration = config.resolveDuration(resolverInput);\n if (duration === undefined || Number.isNaN(duration) || duration <= 0) return;\n\n // Patch-object form requires `T extends object`; `state.presentation`'s\n // T is `MaybeResolvedPresentation | undefined`, which doesn't satisfy\n // the constraint. The guard at the top of the effect already\n // established that the slot holds a defined value, so cast to narrow\n // the signal type and use the cleaner merge form.\n update(state.presentation as Signal<MaybeResolvedPresentation>, { duration });\n });\n}\n\n/**\n * `calculatePresentationDuration` uses a manual `Behavior<>` literal (rather than `defineBehavior`) so it can declare\n * just `presentation` in its stateKeys while the typed setup-param shape includes the optional `selectedVideoTrackId` /\n * `selectedAudioTrackId` reads used at runtime. Mirrors the pattern in `endOfStream` for the same reason: the behavior\n * is uniform-across-tracks and reads slots contributed by other behaviors, so it shouldn't leak those slot declarations\n * into variants that don't compose the contributors.\n */\nexport const calculatePresentationDuration: Behavior<\n { presentation: Signal<PresentationDurationState['presentation']> },\n Record<string, never>,\n PresentationDurationConfig\n> = {\n stateKeys: ['presentation'],\n contextKeys: [],\n setup: calculatePresentationDurationSetup,\n};\n"],"mappings":";;;AAmDA,SAAS,mCAAmC,EAC1C,OACA,UAgBa;CACb,OAAO,aAAa;EAClB,MAAM,eAAe,MAAM,aAAa,IAAI;EAC5C,IAAI,CAAC,gBAAgB,aAAa,aAAa,KAAA,GAAW;EAM1D,MAAM,gBAA2C,eAAe;GAC9D;GACA,sBAAsB,MAAM,sBAAsB,IAAI;GACtD,sBAAsB,MAAM,sBAAsB,IAAI;EACxD,EAAE;EACF,MAAM,WAAW,OAAO,gBAAgB,aAAa;EACrD,IAAI,aAAa,KAAA,KAAa,OAAO,MAAM,QAAQ,KAAK,YAAY,GAAG;EAOvE,OAAO,MAAM,cAAmD,EAAE,SAAS,CAAC;CAC9E,CAAC;AACH;;;;;;;;AASA,MAAa,gCAIT;CACF,WAAW,CAAC,cAAc;CAC1B,aAAa,CAAC;CACd,OAAO;AACT"}
|
|
@@ -4,46 +4,37 @@ import { createMachineReactor } from "../../core/reactors/create-machine-reactor
|
|
|
4
4
|
import { isResolvedPresentation } from "../../media/types/index.js";
|
|
5
5
|
//#region src/playback/behaviors/collect-errors.ts
|
|
6
6
|
/**
|
|
7
|
-
* **Owns the engine's error sequence.** Reporters append through
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* unbounded across a session.
|
|
7
|
+
* **Owns the engine's error sequence.** Reporters append through {@link emitError}; this behavior owns the slot and its
|
|
8
|
+
* per-source lifecycle, clearing it on exit so a new source starts clean and the sequence can't grow unbounded across a
|
|
9
|
+
* session.
|
|
11
10
|
*
|
|
12
|
-
* Same split as `setupFailoverMonitor` and `failedCdns`: writes come from
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* is why this is a lifecycle owner rather than an error *handler*.
|
|
11
|
+
* Same split as `setupFailoverMonitor` and `failedCdns`: writes come from wherever the condition is detected, one
|
|
12
|
+
* behavior owns the slot. Deliberately has no `effects` — it holds no policy and derives nothing. Severity is decided
|
|
13
|
+
* at the adapter, not here (see `internal/design/spf/features/errors.md`), which is why this is a lifecycle owner
|
|
14
|
+
* rather than an error _handler_.
|
|
17
15
|
*
|
|
18
|
-
* Clearing binds to
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* prior source's errors forward; `resolve-track` guards the same transition with
|
|
24
|
-
* a commit-time id check, and doing likewise here is a follow-up.
|
|
16
|
+
* Clearing binds to _exit_ of `presentation-resolved`, mirroring the sibling mixins' clear-on-teardown (`emptied` /
|
|
17
|
+
* `MEDIA_DETACHED`). A live reload swaps the presentation object without leaving the resolved state, so it doesn't
|
|
18
|
+
* clear — only an actual source change or destroy does. Known gap: a resolved→resolved source swap that never passes
|
|
19
|
+
* through unresolved carries the prior source's errors forward; `resolve-track` guards the same transition with a
|
|
20
|
+
* commit-time id check, and doing likewise here is a follow-up.
|
|
25
21
|
*
|
|
26
|
-
* The vocabulary itself ({@link SvtaError} and the codes) is DOM- and
|
|
27
|
-
*
|
|
28
|
-
* it writes.
|
|
22
|
+
* The vocabulary itself ({@link SvtaError} and the codes) is DOM- and signal-free in `media/errors`; only the write
|
|
23
|
+
* seam lives here, with the slot it writes.
|
|
29
24
|
*/
|
|
30
25
|
/**
|
|
31
|
-
* Append `error` to the engine's error sequence. No-op when no owner is
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* Writes go through `update` so concurrent reporters can't lose each other's
|
|
35
|
-
* appends.
|
|
26
|
+
* Append `error` to the engine's error sequence. No-op when no owner is composed. Replaces the array rather than
|
|
27
|
+
* mutating it, so signal consumers notify; duplicates are kept, since a repeated condition is a real observation.
|
|
28
|
+
* Writes go through `update` so concurrent reporters can't lose each other's appends.
|
|
36
29
|
*
|
|
37
|
-
* Every emission is logged, deliberately
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* reaching a person: only *verdicts* are promoted to the media surface, so every
|
|
43
|
-
* cause (and any non-fatal notice) is otherwise invisible outside a debugger.
|
|
30
|
+
* Every emission is logged, deliberately _before_ the owner check. A condition emitted with no `collectErrors` composed
|
|
31
|
+
* is dropped on the floor — that's the case where a log is the only evidence it happened at all, so gating the log on
|
|
32
|
+
* the same check would hide exactly what's worth seeing. Emissions that _are_ collected still get logged, because
|
|
33
|
+
* reaching `state.errors` is no guarantee of reaching a person: only _verdicts_ are promoted to the media surface, so
|
|
34
|
+
* every cause (and any non-fatal notice) is otherwise invisible outside a debugger.
|
|
44
35
|
*
|
|
45
|
-
* Ungated rather than `__DEV__`-only, matching the other reporting paths in this
|
|
46
|
-
*
|
|
36
|
+
* Ungated rather than `__DEV__`-only, matching the other reporting paths in this package (`resolve-presentation`,
|
|
37
|
+
* `track-switching`, the segment actors).
|
|
47
38
|
*/
|
|
48
39
|
function emitError(state, error) {
|
|
49
40
|
console.error("[spf] reported condition", error);
|
|
@@ -51,31 +42,27 @@ function emitError(state, error) {
|
|
|
51
42
|
update(state.errors, (errors) => [...errors ?? [], error]);
|
|
52
43
|
}
|
|
53
44
|
/**
|
|
54
|
-
* A "constraint" that reports a type the source carries **no** renditions of, for
|
|
55
|
-
*
|
|
45
|
+
* A "constraint" that reports a type the source carries **no** renditions of, for a composition that can't play without
|
|
46
|
+
* it.
|
|
56
47
|
*
|
|
57
|
-
* Strange on purpose, and the strangeness is the point: it never constrains
|
|
58
|
-
*
|
|
59
|
-
* composition opts in by adding it to `constraints` — nothing to thread through
|
|
48
|
+
* Strange on purpose, and the strangeness is the point: it never constrains anything, always returning its input
|
|
49
|
+
* untouched. It is shaped as a rule so a composition opts in by adding it to `constraints` — nothing to thread through
|
|
60
50
|
* config, and no cost at all to a composition that leaves it out.
|
|
61
51
|
*
|
|
62
|
-
* **Belongs last in the chain.** A constraint sees the list as it stands at its
|
|
63
|
-
*
|
|
64
|
-
* here" — none of this type offered, or the constraints ahead pruned them all.
|
|
52
|
+
* **Belongs last in the chain.** A constraint sees the list as it stands at its own position, so only at the tail does
|
|
53
|
+
* an empty input mean "nothing playable here" — none of this type offered, or the constraints ahead pruned them all.
|
|
65
54
|
*
|
|
66
|
-
* These are the failures no per-rendition cause can report: causes come from
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* aren't knowable until one does; CODECS is, so an undecodable ladder isn't.
|
|
55
|
+
* These are the failures no per-rendition cause can report: causes come from `reportUnsupportedTrackConditions` as each
|
|
56
|
+
* media playlist resolves, and a rendition pruned before selection never resolves. Container and encryption aren't
|
|
57
|
+
* knowable until one does; CODECS is, so an undecodable ladder isn't.
|
|
70
58
|
*
|
|
71
|
-
* Idempotent because the constraint chain runs inside a `computed` that re-derives
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* from subscribing to the slot this writes.
|
|
59
|
+
* Idempotent because the constraint chain runs inside a `computed` that re-derives on every `presentation` write —
|
|
60
|
+
* segment appends and live reloads included — and the sequence deliberately keeps duplicates. `peek` is what keeps that
|
|
61
|
+
* computed from subscribing to the slot this writes.
|
|
75
62
|
*
|
|
76
63
|
* @example
|
|
77
|
-
*
|
|
78
|
-
*
|
|
64
|
+
* // engine-background-video.ts — video-only, so a source with none can't play
|
|
65
|
+
* constraints: [excludeUnplayableTracks, reportAbsentTrackType(SVTA_NO_SUPPORTED_VIDEO_TRACK)];
|
|
79
66
|
*/
|
|
80
67
|
function reportAbsentTrackType(code) {
|
|
81
68
|
return (tracks, { state }) => {
|
|
@@ -88,7 +75,7 @@ function reportAbsentTrackType(code) {
|
|
|
88
75
|
* Own `errors` for the resolved source's lifetime.
|
|
89
76
|
*
|
|
90
77
|
* @example
|
|
91
|
-
*
|
|
78
|
+
* const reactor = collectErrors.setup({ state });
|
|
92
79
|
*/
|
|
93
80
|
const collectErrors = defineBehavior({
|
|
94
81
|
stateKeys: ["presentation", "errors"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-errors.js","names":[],"sources":["../../../../src/playback/behaviors/collect-errors.ts"],"sourcesContent":["/**\n * **Owns the engine's error sequence.** Reporters append through
|
|
1
|
+
{"version":3,"file":"collect-errors.js","names":[],"sources":["../../../../src/playback/behaviors/collect-errors.ts"],"sourcesContent":["/**\n * **Owns the engine's error sequence.** Reporters append through {@link emitError}; this behavior owns the slot and its\n * per-source lifecycle, clearing it on exit so a new source starts clean and the sequence can't grow unbounded across a\n * session.\n *\n * Same split as `setupFailoverMonitor` and `failedCdns`: writes come from wherever the condition is detected, one\n * behavior owns the slot. Deliberately has no `effects` — it holds no policy and derives nothing. Severity is decided\n * at the adapter, not here (see `internal/design/spf/features/errors.md`), which is why this is a lifecycle owner\n * rather than an error _handler_.\n *\n * Clearing binds to _exit_ of `presentation-resolved`, mirroring the sibling mixins' clear-on-teardown (`emptied` /\n * `MEDIA_DETACHED`). A live reload swaps the presentation object without leaving the resolved state, so it doesn't\n * clear — only an actual source change or destroy does. Known gap: a resolved→resolved source swap that never passes\n * through unresolved carries the prior source's errors forward; `resolve-track` guards the same transition with a\n * commit-time id check, and doing likewise here is a follow-up.\n *\n * The vocabulary itself ({@link SvtaError} and the codes) is DOM- and signal-free in `media/errors`; only the write\n * seam lives here, with the slot it writes.\n */\n\nimport { defineBehavior } from '../../core/composition/create-composition';\nimport { createMachineReactor } from '../../core/reactors/create-machine-reactor';\nimport { computed, peek, type ReadonlySignal, type Signal, update } from '../../core/signals/primitives';\nimport type { SvtaError } from '../../media/errors';\nimport { isResolvedPresentation, type MaybeResolvedPresentation } from '../../media/types';\nimport type { SelectionRule } from '../primitives/selection-rules';\n\nexport interface CollectErrorsState {\n presentation?: MaybeResolvedPresentation;\n errors?: SvtaError[];\n}\n\n/**\n * State an error reporter writes into. The slot is _optional_: a behavior reports through this seam without declaring\n * ownership in its own typed slice, and emission no-ops when `collectErrors` isn't composed. Same contract as\n * `failedCdns` / `failoverFetch`.\n */\nexport interface ErrorEmitterState {\n errors?: Signal<SvtaError[] | undefined>;\n}\n\n/**\n * Append `error` to the engine's error sequence. No-op when no owner is composed. Replaces the array rather than\n * mutating it, so signal consumers notify; duplicates are kept, since a repeated condition is a real observation.\n * Writes go through `update` so concurrent reporters can't lose each other's appends.\n *\n * Every emission is logged, deliberately _before_ the owner check. A condition emitted with no `collectErrors` composed\n * is dropped on the floor — that's the case where a log is the only evidence it happened at all, so gating the log on\n * the same check would hide exactly what's worth seeing. Emissions that _are_ collected still get logged, because\n * reaching `state.errors` is no guarantee of reaching a person: only _verdicts_ are promoted to the media surface, so\n * every cause (and any non-fatal notice) is otherwise invisible outside a debugger.\n *\n * Ungated rather than `__DEV__`-only, matching the other reporting paths in this package (`resolve-presentation`,\n * `track-switching`, the segment actors).\n */\nexport function emitError(state: ErrorEmitterState, error: SvtaError): void {\n console.error('[spf] reported condition', error);\n\n if (!state.errors) return;\n\n update(state.errors, (errors) => [...(errors ?? []), error]);\n}\n\n/**\n * A \"constraint\" that reports a type the source carries **no** renditions of, for a composition that can't play without\n * it.\n *\n * Strange on purpose, and the strangeness is the point: it never constrains anything, always returning its input\n * untouched. It is shaped as a rule so a composition opts in by adding it to `constraints` — nothing to thread through\n * config, and no cost at all to a composition that leaves it out.\n *\n * **Belongs last in the chain.** A constraint sees the list as it stands at its own position, so only at the tail does\n * an empty input mean \"nothing playable here\" — none of this type offered, or the constraints ahead pruned them all.\n *\n * These are the failures no per-rendition cause can report: causes come from `reportUnsupportedTrackConditions` as each\n * media playlist resolves, and a rendition pruned before selection never resolves. Container and encryption aren't\n * knowable until one does; CODECS is, so an undecodable ladder isn't.\n *\n * Idempotent because the constraint chain runs inside a `computed` that re-derives on every `presentation` write —\n * segment appends and live reloads included — and the sequence deliberately keeps duplicates. `peek` is what keeps that\n * computed from subscribing to the slot this writes.\n *\n * @example\n * // engine-background-video.ts — video-only, so a source with none can't play\n * constraints: [excludeUnplayableTracks, reportAbsentTrackType(SVTA_NO_SUPPORTED_VIDEO_TRACK)];\n */\nexport function reportAbsentTrackType<T>(code: number): SelectionRule<T, ErrorEmitterState> {\n return (tracks, { state }) => {\n const reported = state.errors && peek(state.errors);\n\n if (!tracks.length && !reported?.some((error) => error.code === code)) {\n emitError(state, { code });\n }\n\n return tracks;\n };\n}\n\n/**\n * Own `errors` for the resolved source's lifetime.\n *\n * @example\n * const reactor = collectErrors.setup({ state });\n */\nexport const collectErrors = defineBehavior({\n stateKeys: ['presentation', 'errors'],\n contextKeys: [],\n setup: ({\n state,\n }: {\n state: {\n presentation: ReadonlySignal<CollectErrorsState['presentation']>;\n errors: Signal<CollectErrorsState['errors']>;\n };\n }) => {\n const derivedStateSignal = computed(() =>\n isResolvedPresentation(state.presentation.get())\n ? ('presentation-resolved' as const)\n : ('presentation-unresolved' as const)\n );\n\n return createMachineReactor({\n initial: 'presentation-unresolved',\n monitor: () => derivedStateSignal.get(),\n states: {\n 'presentation-unresolved': {},\n 'presentation-resolved': {\n // Cleanup-binds-to-setup: reset for the next source on exit (src\n // unload + destroy).\n entry: () => () => state.errors.set(undefined),\n },\n },\n });\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,SAAgB,UAAU,OAA0B,OAAwB;CAC1E,QAAQ,MAAM,4BAA4B,KAAK;CAE/C,IAAI,CAAC,MAAM,QAAQ;CAEnB,OAAO,MAAM,SAAS,WAAW,CAAC,GAAI,UAAU,CAAC,GAAI,KAAK,CAAC;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,sBAAyB,MAAmD;CAC1F,QAAQ,QAAQ,EAAE,YAAY;EAC5B,MAAM,WAAW,MAAM,UAAU,KAAK,MAAM,MAAM;EAElD,IAAI,CAAC,OAAO,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,SAAS,IAAI,GAClE,UAAU,OAAO,EAAE,KAAK,CAAC;EAG3B,OAAO;CACT;AACF;;;;;;;AAQA,MAAa,gBAAgB,eAAe;CAC1C,WAAW,CAAC,gBAAgB,QAAQ;CACpC,aAAa,CAAC;CACd,QAAQ,EACN,YAMI;EACJ,MAAM,qBAAqB,eACzB,uBAAuB,MAAM,aAAa,IAAI,CAAC,IAC1C,0BACA,yBACP;EAEA,OAAO,qBAAqB;GAC1B,SAAS;GACT,eAAe,mBAAmB,IAAI;GACtC,QAAQ;IACN,2BAA2B,CAAC;IAC5B,yBAAyB,EAGvB,mBAAmB,MAAM,OAAO,IAAI,KAAA,CAAS,EAC/C;GACF;EACF,CAAC;CACH;AACF,CAAC"}
|
|
@@ -5,38 +5,31 @@ import { isResolvedPresentation } from "../../media/types/index.js";
|
|
|
5
5
|
import { getCdnId, getOrderedCdnIds } from "../../media/utils/cdn.js";
|
|
6
6
|
//#region src/playback/behaviors/derive-cdn-priority.ts
|
|
7
7
|
/**
|
|
8
|
-
* **Session-level CDN priority.** While a presentation is resolved, owns the
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* on src unload. The name mirrors HLS content steering's `PATHWAY-PRIORITY`.
|
|
8
|
+
* **Session-level CDN priority.** While a presentation is resolved, owns the `cdnPriority` signal: the distinct CDNs
|
|
9
|
+
* the source is served from (origin of each track's URL), in manifest priority order — most-preferred first. Cleared on
|
|
10
|
+
* src unload. The name mirrors HLS content steering's `PATHWAY-PRIORITY`.
|
|
12
11
|
*
|
|
13
|
-
* Redundant-stream sources (e.g. Mux's `?redundant_streams=true`) list the same
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* narrows each type's candidates to the first CDN with surviving tracks — so
|
|
18
|
-
* video / audio / text all resolve from one host (the shared list is the
|
|
12
|
+
* Redundant-stream sources (e.g. Mux's `?redundant_streams=true`) list the same content on multiple hosts, so the
|
|
13
|
+
* candidate tracks already include one variant per CDN. This behavior publishes _which_ CDNs exist and their priority;
|
|
14
|
+
* the `preferActiveCdn` scope rule in `track-switching` reads `cdnPriority` and narrows each type's candidates to the
|
|
15
|
+
* first CDN with surviving tracks — so video / audio / text all resolve from one host (the shared list is the
|
|
19
16
|
* per-presentation coherence guarantee).
|
|
20
17
|
*
|
|
21
|
-
* The "active" CDN is not stored — it's derived by the scope as the
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* the scope falls to the next CDN; when the primary recovers, it snaps back.
|
|
26
|
-
* Content steering, when it lands, reorders `cdnPriority` (pathway priority as a
|
|
27
|
-
* sort key).
|
|
18
|
+
* The "active" CDN is not stored — it's derived by the scope as the highest-priority entry in `cdnPriority` that still
|
|
19
|
+
* has tracks after the constraints pre-pass. That makes failover a pure consequence of the (future) failed-CDN
|
|
20
|
+
* constraint: when the primary's tracks are pruned during cooldown, the scope falls to the next CDN; when the primary
|
|
21
|
+
* recovers, it snaps back. Content steering, when it lands, reorders `cdnPriority` (pathway priority as a sort key).
|
|
28
22
|
*
|
|
29
|
-
* Lifecycle: `'presentation-unresolved'` ↔ `'presentation-resolved'`, mirroring
|
|
30
|
-
*
|
|
31
|
-
*
|
|
23
|
+
* Lifecycle: `'presentation-unresolved'` ↔ `'presentation-resolved'`, mirroring `setupTrackSwitching`. The resolved
|
|
24
|
+
* state owns the signal; its entry-returned cleanup clears it on exit (canonical cleanup-binds-to-setup per
|
|
25
|
+
* `reactors.md`).
|
|
32
26
|
*/
|
|
33
27
|
const samePriority = (a, b) => !!a && a.length === b.length && a.every((cdn, i) => cdn === b[i]);
|
|
34
28
|
/**
|
|
35
|
-
* Manage `cdnPriority`: publish the manifest-ordered CDN list on src load, clear
|
|
36
|
-
* on src unload.
|
|
29
|
+
* Manage `cdnPriority`: publish the manifest-ordered CDN list on src load, clear on src unload.
|
|
37
30
|
*
|
|
38
31
|
* @example
|
|
39
|
-
*
|
|
32
|
+
* const reactor = deriveCdnPriority.setup({ state });
|
|
40
33
|
*/
|
|
41
34
|
const deriveCdnPriority = defineBehavior({
|
|
42
35
|
stateKeys: ["presentation", "cdnPriority"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive-cdn-priority.js","names":["getCdnId","defaultGetCdnId"],"sources":["../../../../src/playback/behaviors/derive-cdn-priority.ts"],"sourcesContent":["/**\n * **Session-level CDN priority.** While a presentation is resolved, owns the
|
|
1
|
+
{"version":3,"file":"derive-cdn-priority.js","names":["getCdnId","defaultGetCdnId"],"sources":["../../../../src/playback/behaviors/derive-cdn-priority.ts"],"sourcesContent":["/**\n * **Session-level CDN priority.** While a presentation is resolved, owns the `cdnPriority` signal: the distinct CDNs\n * the source is served from (origin of each track's URL), in manifest priority order — most-preferred first. Cleared on\n * src unload. The name mirrors HLS content steering's `PATHWAY-PRIORITY`.\n *\n * Redundant-stream sources (e.g. Mux's `?redundant_streams=true`) list the same content on multiple hosts, so the\n * candidate tracks already include one variant per CDN. This behavior publishes _which_ CDNs exist and their priority;\n * the `preferActiveCdn` scope rule in `track-switching` reads `cdnPriority` and narrows each type's candidates to the\n * first CDN with surviving tracks — so video / audio / text all resolve from one host (the shared list is the\n * per-presentation coherence guarantee).\n *\n * The \"active\" CDN is not stored — it's derived by the scope as the highest-priority entry in `cdnPriority` that still\n * has tracks after the constraints pre-pass. That makes failover a pure consequence of the (future) failed-CDN\n * constraint: when the primary's tracks are pruned during cooldown, the scope falls to the next CDN; when the primary\n * recovers, it snaps back. Content steering, when it lands, reorders `cdnPriority` (pathway priority as a sort key).\n *\n * Lifecycle: `'presentation-unresolved'` ↔ `'presentation-resolved'`, mirroring `setupTrackSwitching`. The resolved\n * state owns the signal; its entry-returned cleanup clears it on exit (canonical cleanup-binds-to-setup per\n * `reactors.md`).\n */\n\nimport { defineBehavior } from '../../core/composition/create-composition';\nimport { createMachineReactor } from '../../core/reactors/create-machine-reactor';\nimport { computed, peek, type ReadonlySignal, type Signal } from '../../core/signals/primitives';\nimport { isResolvedPresentation, type MaybeResolvedPresentation } from '../../media/types';\nimport { getCdnId as defaultGetCdnId, type GetCdnId, getOrderedCdnIds } from '../../media/utils/cdn';\n\nexport interface DeriveCdnPriorityState {\n presentation?: MaybeResolvedPresentation;\n cdnPriority?: string[];\n}\n\nconst samePriority = (a: string[] | undefined, b: string[]): boolean =>\n !!a && a.length === b.length && a.every((cdn, i) => cdn === b[i]);\n\n/**\n * Manage `cdnPriority`: publish the manifest-ordered CDN list on src load, clear on src unload.\n *\n * @example\n * const reactor = deriveCdnPriority.setup({ state });\n */\nexport const deriveCdnPriority = defineBehavior({\n stateKeys: ['presentation', 'cdnPriority'],\n contextKeys: [],\n setup: ({\n state,\n config = {},\n }: {\n state: {\n presentation: ReadonlySignal<DeriveCdnPriorityState['presentation']>;\n cdnPriority: Signal<DeriveCdnPriorityState['cdnPriority']>;\n };\n config?: { getCdnId?: GetCdnId };\n }) => {\n const getCdnId = config.getCdnId ?? defaultGetCdnId;\n const derivedStateSignal = computed(() =>\n isResolvedPresentation(state.presentation.get())\n ? ('presentation-resolved' as const)\n : ('presentation-unresolved' as const)\n );\n\n return createMachineReactor({\n initial: 'presentation-unresolved',\n monitor: () => derivedStateSignal.get(),\n states: {\n 'presentation-unresolved': {},\n 'presentation-resolved': {\n // Cleanup-binds-to-setup: the CDN priority list is valid for exactly\n // 'presentation-resolved'. Clear fires on exit (src unload + destroy).\n entry: () => () => state.cdnPriority.set(undefined),\n effects: [\n () => {\n const presentation = state.presentation.get();\n if (!isResolvedPresentation(presentation)) return;\n\n const next = getOrderedCdnIds(presentation, getCdnId);\n\n // Skip the write when the CDN set is unchanged — a live reload swaps\n // in a new presentation object with the same hosts, and re-setting a\n // fresh array would re-fire the scope for an identical result.\n // `peek` reads without subscribing, so this never self-triggers.\n if (!samePriority(peek(state.cdnPriority), next)) state.cdnPriority.set(next);\n },\n ],\n },\n },\n });\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,gBAAgB,GAAyB,MAC7C,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,KAAK,MAAM,QAAQ,EAAE,EAAE;;;;;;;AAQlE,MAAa,oBAAoB,eAAe;CAC9C,WAAW,CAAC,gBAAgB,aAAa;CACzC,aAAa,CAAC;CACd,QAAQ,EACN,OACA,SAAS,CAAC,QAON;EACJ,MAAMA,aAAW,OAAO,YAAYC;EACpC,MAAM,qBAAqB,eACzB,uBAAuB,MAAM,aAAa,IAAI,CAAC,IAC1C,0BACA,yBACP;EAEA,OAAO,qBAAqB;GAC1B,SAAS;GACT,eAAe,mBAAmB,IAAI;GACtC,QAAQ;IACN,2BAA2B,CAAC;IAC5B,yBAAyB;KAGvB,mBAAmB,MAAM,YAAY,IAAI,KAAA,CAAS;KAClD,SAAS,OACD;MACJ,MAAM,eAAe,MAAM,aAAa,IAAI;MAC5C,IAAI,CAAC,uBAAuB,YAAY,GAAG;MAE3C,MAAM,OAAO,iBAAiB,cAAcD,UAAQ;MAMpD,IAAI,CAAC,aAAa,KAAK,MAAM,WAAW,GAAG,IAAI,GAAG,MAAM,YAAY,IAAI,IAAI;KAC9E,CACF;IACF;GACF;EACF,CAAC;CACH;AACF,CAAC"}
|