mattebox 0.10.0 → 0.12.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/README.md +1 -1
- package/dist/cdn/mattebox.dash-drm.min.js +3 -3
- package/dist/cdn/mattebox.dash.min.js +3 -3
- package/dist/cdn/mattebox.dual-drm.min.js +3 -3
- package/dist/cdn/mattebox.dual-ts-drm.min.js +3 -3
- package/dist/cdn/mattebox.dual-ts.min.js +3 -3
- package/dist/cdn/mattebox.dual.min.js +3 -3
- package/dist/cdn/mattebox.hls-drm.min.js +3 -3
- package/dist/cdn/mattebox.hls-ts-drm.min.js +3 -3
- package/dist/cdn/mattebox.hls-ts.min.js +3 -3
- package/dist/cdn/mattebox.hls.min.js +3 -3
- package/dist/cdn/mattebox.kernel.min.js +1 -1
- package/dist/cdn/mattebox.min.js +6 -2
- package/dist/containers/captions.d.ts +6 -5
- package/dist/containers/captions.d.ts.map +1 -1
- package/dist/containers/captions.js +9 -9
- package/dist/containers/captions.js.map +1 -1
- package/dist/containers/codec-probe/index.d.ts +15 -0
- package/dist/containers/codec-probe/index.d.ts.map +1 -1
- package/dist/containers/codec-probe/index.js +72 -5
- package/dist/containers/codec-probe/index.js.map +1 -1
- package/dist/containers/emsg.d.ts +15 -0
- package/dist/containers/emsg.d.ts.map +1 -0
- package/dist/containers/emsg.js +91 -0
- package/dist/containers/emsg.js.map +1 -0
- package/dist/containers/id3.d.ts +12 -0
- package/dist/containers/id3.d.ts.map +1 -1
- package/dist/containers/id3.js +53 -4
- package/dist/containers/id3.js.map +1 -1
- package/dist/containers/metadata.d.ts +18 -0
- package/dist/containers/metadata.d.ts.map +1 -0
- package/dist/containers/metadata.js +20 -0
- package/dist/containers/metadata.js.map +1 -0
- package/dist/containers/mp4-box/index.d.ts +16 -0
- package/dist/containers/mp4-box/index.d.ts.map +1 -1
- package/dist/containers/mp4-box/index.js +28 -0
- package/dist/containers/mp4-box/index.js.map +1 -1
- package/dist/containers/scte35.d.ts +12 -0
- package/dist/containers/scte35.d.ts.map +1 -0
- package/dist/containers/scte35.js +116 -0
- package/dist/containers/scte35.js.map +1 -0
- package/dist/containers/ts-transmux/demux.d.ts +2 -2
- package/dist/containers/ts-transmux/demux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/demux.js +2 -18
- package/dist/containers/ts-transmux/demux.js.map +1 -1
- package/dist/containers/ts-transmux/index.d.ts.map +1 -1
- package/dist/containers/ts-transmux/index.js +14 -3
- package/dist/containers/ts-transmux/index.js.map +1 -1
- package/dist/containers/ts-transmux/module.d.ts +8 -0
- package/dist/containers/ts-transmux/module.d.ts.map +1 -0
- package/dist/containers/ts-transmux/module.js +8 -0
- package/dist/containers/ts-transmux/module.js.map +1 -0
- package/dist/containers/ts-transmux/runner.d.ts +20 -8
- package/dist/containers/ts-transmux/runner.d.ts.map +1 -1
- package/dist/containers/ts-transmux/runner.js +19 -22
- package/dist/containers/ts-transmux/runner.js.map +1 -1
- package/dist/containers/ts-transmux/serve.d.ts +35 -0
- package/dist/containers/ts-transmux/serve.d.ts.map +1 -0
- package/dist/containers/ts-transmux/serve.js +33 -0
- package/dist/containers/ts-transmux/serve.js.map +1 -0
- package/dist/containers/ts-transmux/sniff.d.ts +11 -0
- package/dist/containers/ts-transmux/sniff.d.ts.map +1 -0
- package/dist/containers/ts-transmux/sniff.js +25 -0
- package/dist/containers/ts-transmux/sniff.js.map +1 -0
- package/dist/containers/ts-transmux/source.d.ts +10 -0
- package/dist/containers/ts-transmux/source.d.ts.map +1 -0
- package/dist/containers/ts-transmux/source.js +5 -0
- package/dist/containers/ts-transmux/source.js.map +1 -0
- package/dist/containers/ts-transmux/transmux.d.ts +19 -1
- package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/transmux.js +46 -7
- package/dist/containers/ts-transmux/transmux.js.map +1 -1
- package/dist/containers/ts-transmux/transmux.worker.js +7 -28
- package/dist/containers/ts-transmux/transmux.worker.js.map +1 -1
- package/dist/containers/webvtt.d.ts +2 -0
- package/dist/containers/webvtt.d.ts.map +1 -1
- package/dist/containers/webvtt.js +4 -0
- package/dist/containers/webvtt.js.map +1 -1
- package/dist/containers/wvtt.d.ts +12 -0
- package/dist/containers/wvtt.d.ts.map +1 -0
- package/dist/containers/wvtt.js +46 -0
- package/dist/containers/wvtt.js.map +1 -0
- package/dist/eme/index.d.ts +34 -0
- package/dist/eme/index.d.ts.map +1 -0
- package/dist/eme/index.js +75 -0
- package/dist/eme/index.js.map +1 -0
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectWithoutProperties.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/containers/captions.js +8 -8
- package/dist/es2015/containers/codec-probe/index.js +105 -6
- package/dist/es2015/containers/emsg.js +81 -0
- package/dist/es2015/containers/id3.js +54 -4
- package/dist/es2015/containers/metadata.js +20 -0
- package/dist/es2015/containers/mp4-box/index.js +27 -1
- package/dist/es2015/containers/scte35.js +114 -0
- package/dist/es2015/containers/ts-transmux/demux.js +12 -24
- package/dist/es2015/containers/ts-transmux/h264.js +1 -1
- package/dist/es2015/containers/ts-transmux/index.js +12 -4
- package/dist/es2015/containers/ts-transmux/runner.js +34 -27
- package/dist/es2015/containers/ts-transmux/serve.js +36 -0
- package/dist/es2015/containers/ts-transmux/sniff.js +13 -0
- package/dist/es2015/containers/ts-transmux/source.js +7 -0
- package/dist/es2015/containers/ts-transmux/transmux.js +42 -8
- package/dist/es2015/containers/ts-transmux/transmux.worker.js +7 -26
- package/dist/es2015/containers/webvtt.js +6 -2
- package/dist/es2015/containers/wvtt.js +40 -0
- package/dist/es2015/eme/index.js +79 -0
- package/dist/es2015/index.js +63 -27
- package/dist/es2015/kernel/append-queue.js +1 -1
- package/dist/es2015/kernel/base64.js +14 -3
- package/dist/es2015/kernel/bus.js +11 -8
- package/dist/es2015/kernel/context.js +5 -0
- package/dist/es2015/kernel/lifecycle.js +1 -0
- package/dist/es2015/kernel/loader.js +2 -2
- package/dist/es2015/kernel/mime.js +12 -1
- package/dist/es2015/kernel/mse.js +47 -6
- package/dist/es2015/kernel/prepare.js +2 -2
- package/dist/es2015/kernel/reducer.js +83 -26
- package/dist/es2015/kernel/refresh.js +2 -2
- package/dist/es2015/kernel/rendition-select.js +91 -16
- package/dist/es2015/kernel/scheduler.js +1 -1
- package/dist/es2015/kernel/sinks/caption-tracks.js +82 -0
- package/dist/es2015/kernel/sinks/native-sync.js +46 -0
- package/dist/es2015/kernel/sinks/text-formats.js +64 -0
- package/dist/es2015/kernel/sinks/text-track-sink.js +15 -4
- package/dist/es2015/kernel/timeline.js +12 -8
- package/dist/es2015/kernel/trace.js +1 -1
- package/dist/es2015/kernel/track-registry.js +6 -3
- package/dist/es2015/kernel/transport.js +34 -7
- package/dist/es2015/presets/define.js +2 -2
- package/dist/es2015/presets/full/index.js +22 -2
- package/dist/es2015/protocols/dash-cmaf/index.js +61 -14
- package/dist/es2015/protocols/dash-cmaf/parse.js +421 -121
- package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +134 -0
- package/dist/es2015/protocols/dash-cmaf/periods.js +178 -0
- package/dist/es2015/protocols/dash-live/index.js +1 -1
- package/dist/es2015/protocols/hls-cmaf/index.js +41 -17
- package/dist/es2015/protocols/hls-cmaf/lexer.js +2 -1
- package/dist/es2015/protocols/hls-cmaf/parse.js +161 -39
- package/dist/es2015/protocols/hls-cmaf/unavailable.js +37 -6
- package/dist/es2015/protocols/hls-live/index.js +36 -10
- package/dist/es2015/stages/abr/index.js +18 -7
- package/dist/es2015/stages/abr-persist/index.js +1 -1
- package/dist/es2015/stages/aes-128/index.js +1 -1
- package/dist/es2015/stages/alt-audio/index.js +7 -5
- package/dist/es2015/stages/chapters/index.js +2 -2
- package/dist/es2015/stages/chapters/parse.js +2 -2
- package/dist/es2015/stages/cmcd/index.js +30 -3
- package/dist/es2015/stages/cmsd/index.js +72 -0
- package/dist/es2015/stages/codec-probe/index.js +28 -3
- package/dist/es2015/stages/content-steering/index.js +1 -1
- package/dist/es2015/stages/eme-core/index.js +31 -7
- package/dist/es2015/stages/eme-fairplay/index.js +18 -9
- package/dist/es2015/stages/hdr/index.js +214 -0
- package/dist/es2015/stages/meta-id3/index.js +6 -1
- package/dist/es2015/stages/qoe/index.js +111 -0
- package/dist/es2015/stages/recovery/index.js +1 -1
- package/dist/es2015/stages/rendition-names/index.js +101 -0
- package/dist/es2015/stages/text-cea608/decode.js +57 -6
- package/dist/es2015/stages/text-cea608/index.js +26 -93
- package/dist/es2015/stages/text-cea708/decode.js +379 -0
- package/dist/es2015/stages/text-cea708/index.js +98 -0
- package/dist/es2015/stages/text-ttml/index.js +88 -0
- package/dist/es2015/stages/text-ttml/parse.js +255 -0
- package/dist/es2015/stages/text-webvtt/index.js +30 -65
- package/dist/es2015/stages/thumbnails/index.js +1 -1
- package/dist/es2015/stages/timed-metadata/index.js +331 -0
- package/dist/es2015/stages/trick-play/index.js +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -19
- package/dist/index.js.map +1 -1
- package/dist/kernel/base64.d.ts +7 -2
- package/dist/kernel/base64.d.ts.map +1 -1
- package/dist/kernel/base64.js +14 -2
- package/dist/kernel/base64.js.map +1 -1
- package/dist/kernel/bus.d.ts.map +1 -1
- package/dist/kernel/bus.js +12 -9
- package/dist/kernel/bus.js.map +1 -1
- package/dist/kernel/context.d.ts +3 -1
- package/dist/kernel/context.d.ts.map +1 -1
- package/dist/kernel/context.js +5 -0
- package/dist/kernel/context.js.map +1 -1
- package/dist/kernel/lifecycle.d.ts +3 -1
- package/dist/kernel/lifecycle.d.ts.map +1 -1
- package/dist/kernel/lifecycle.js +1 -0
- package/dist/kernel/lifecycle.js.map +1 -1
- package/dist/kernel/loader.d.ts.map +1 -1
- package/dist/kernel/loader.js +3 -2
- package/dist/kernel/loader.js.map +1 -1
- package/dist/kernel/mime.d.ts +7 -0
- package/dist/kernel/mime.d.ts.map +1 -1
- package/dist/kernel/mime.js +12 -0
- package/dist/kernel/mime.js.map +1 -1
- package/dist/kernel/mse.d.ts.map +1 -1
- package/dist/kernel/mse.js +47 -3
- package/dist/kernel/mse.js.map +1 -1
- package/dist/kernel/reducer.d.ts.map +1 -1
- package/dist/kernel/reducer.js +88 -12
- package/dist/kernel/reducer.js.map +1 -1
- package/dist/kernel/refresh.d.ts.map +1 -1
- package/dist/kernel/refresh.js +1 -0
- package/dist/kernel/refresh.js.map +1 -1
- package/dist/kernel/rendition-select.d.ts +29 -1
- package/dist/kernel/rendition-select.d.ts.map +1 -1
- package/dist/kernel/rendition-select.js +99 -21
- package/dist/kernel/rendition-select.js.map +1 -1
- package/dist/kernel/sinks/caption-tracks.d.ts +11 -0
- package/dist/kernel/sinks/caption-tracks.d.ts.map +1 -0
- package/dist/kernel/sinks/caption-tracks.js +87 -0
- package/dist/kernel/sinks/caption-tracks.js.map +1 -0
- package/dist/kernel/sinks/native-sync.d.ts +24 -0
- package/dist/kernel/sinks/native-sync.d.ts.map +1 -0
- package/dist/kernel/sinks/native-sync.js +42 -0
- package/dist/kernel/sinks/native-sync.js.map +1 -0
- package/dist/kernel/sinks/text-formats.d.ts +25 -0
- package/dist/kernel/sinks/text-formats.d.ts.map +1 -0
- package/dist/kernel/sinks/text-formats.js +69 -0
- package/dist/kernel/sinks/text-formats.js.map +1 -0
- package/dist/kernel/sinks/text-track-sink.d.ts.map +1 -1
- package/dist/kernel/sinks/text-track-sink.js +22 -4
- package/dist/kernel/sinks/text-track-sink.js.map +1 -1
- package/dist/kernel/timeline.d.ts +10 -6
- package/dist/kernel/timeline.d.ts.map +1 -1
- package/dist/kernel/timeline.js +14 -6
- package/dist/kernel/timeline.js.map +1 -1
- package/dist/kernel/track-registry.d.ts +2 -2
- package/dist/kernel/track-registry.d.ts.map +1 -1
- package/dist/kernel/track-registry.js +5 -3
- package/dist/kernel/track-registry.js.map +1 -1
- package/dist/kernel/transport.d.ts +8 -0
- package/dist/kernel/transport.d.ts.map +1 -1
- package/dist/kernel/transport.js +28 -1
- package/dist/kernel/transport.js.map +1 -1
- package/dist/presets/full/index.d.ts.map +1 -1
- package/dist/presets/full/index.js +21 -1
- package/dist/presets/full/index.js.map +1 -1
- package/dist/protocols/adapter-shared.d.ts +8 -0
- package/dist/protocols/adapter-shared.d.ts.map +1 -1
- package/dist/protocols/adapter-shared.js +6 -0
- package/dist/protocols/adapter-shared.js.map +1 -1
- package/dist/protocols/dash-cmaf/index.d.ts +9 -1
- package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/index.js +78 -14
- package/dist/protocols/dash-cmaf/index.js.map +1 -1
- package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/parse.js +430 -94
- package/dist/protocols/dash-cmaf/parse.js.map +1 -1
- package/dist/protocols/dash-cmaf/periods-runtime.d.ts +6 -0
- package/dist/protocols/dash-cmaf/periods-runtime.d.ts.map +1 -0
- package/dist/protocols/dash-cmaf/periods-runtime.js +121 -0
- package/dist/protocols/dash-cmaf/periods-runtime.js.map +1 -0
- package/dist/protocols/dash-cmaf/periods.d.ts +24 -0
- package/dist/protocols/dash-cmaf/periods.d.ts.map +1 -0
- package/dist/protocols/dash-cmaf/periods.js +210 -0
- package/dist/protocols/dash-cmaf/periods.js.map +1 -0
- package/dist/protocols/hls-cmaf/index.d.ts +9 -1
- package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/index.js +49 -20
- package/dist/protocols/hls-cmaf/index.js.map +1 -1
- package/dist/protocols/hls-cmaf/lexer.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/lexer.js +1 -0
- package/dist/protocols/hls-cmaf/lexer.js.map +1 -1
- package/dist/protocols/hls-cmaf/parse.d.ts +3 -1
- package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/parse.js +208 -24
- package/dist/protocols/hls-cmaf/parse.js.map +1 -1
- package/dist/protocols/hls-cmaf/unavailable.d.ts +9 -1
- package/dist/protocols/hls-cmaf/unavailable.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/unavailable.js +29 -3
- package/dist/protocols/hls-cmaf/unavailable.js.map +1 -1
- package/dist/protocols/hls-live/index.d.ts +9 -1
- package/dist/protocols/hls-live/index.d.ts.map +1 -1
- package/dist/protocols/hls-live/index.js +36 -7
- package/dist/protocols/hls-live/index.js.map +1 -1
- package/dist/stages/abr/index.d.ts.map +1 -1
- package/dist/stages/abr/index.js +24 -8
- package/dist/stages/abr/index.js.map +1 -1
- package/dist/stages/alt-audio/index.d.ts +3 -1
- package/dist/stages/alt-audio/index.d.ts.map +1 -1
- package/dist/stages/alt-audio/index.js +8 -5
- package/dist/stages/alt-audio/index.js.map +1 -1
- package/dist/stages/cmcd/index.d.ts.map +1 -1
- package/dist/stages/cmcd/index.js +39 -3
- package/dist/stages/cmcd/index.js.map +1 -1
- package/dist/stages/cmsd/index.d.ts +22 -0
- package/dist/stages/cmsd/index.d.ts.map +1 -0
- package/dist/stages/cmsd/index.js +65 -0
- package/dist/stages/cmsd/index.js.map +1 -0
- package/dist/stages/codec-probe/index.d.ts.map +1 -1
- package/dist/stages/codec-probe/index.js +30 -3
- package/dist/stages/codec-probe/index.js.map +1 -1
- package/dist/stages/eme-core/index.d.ts +14 -0
- package/dist/stages/eme-core/index.d.ts.map +1 -1
- package/dist/stages/eme-core/index.js +38 -5
- package/dist/stages/eme-core/index.js.map +1 -1
- package/dist/stages/eme-fairplay/index.d.ts +5 -0
- package/dist/stages/eme-fairplay/index.d.ts.map +1 -1
- package/dist/stages/eme-fairplay/index.js +17 -6
- package/dist/stages/eme-fairplay/index.js.map +1 -1
- package/dist/stages/hdr/index.d.ts +22 -0
- package/dist/stages/hdr/index.d.ts.map +1 -0
- package/dist/stages/hdr/index.js +191 -0
- package/dist/stages/hdr/index.js.map +1 -0
- package/dist/stages/meta-id3/index.d.ts.map +1 -1
- package/dist/stages/meta-id3/index.js +6 -2
- package/dist/stages/meta-id3/index.js.map +1 -1
- package/dist/stages/qoe/index.d.ts +32 -0
- package/dist/stages/qoe/index.d.ts.map +1 -0
- package/dist/stages/qoe/index.js +116 -0
- package/dist/stages/qoe/index.js.map +1 -0
- package/dist/stages/rendition-names/index.d.ts +41 -0
- package/dist/stages/rendition-names/index.d.ts.map +1 -0
- package/dist/stages/rendition-names/index.js +101 -0
- package/dist/stages/rendition-names/index.js.map +1 -0
- package/dist/stages/text-cea608/decode.d.ts +23 -2
- package/dist/stages/text-cea608/decode.d.ts.map +1 -1
- package/dist/stages/text-cea608/decode.js +59 -6
- package/dist/stages/text-cea608/decode.js.map +1 -1
- package/dist/stages/text-cea608/index.d.ts +9 -9
- package/dist/stages/text-cea608/index.d.ts.map +1 -1
- package/dist/stages/text-cea608/index.js +31 -105
- package/dist/stages/text-cea608/index.js.map +1 -1
- package/dist/stages/text-cea708/decode.d.ts +79 -0
- package/dist/stages/text-cea708/decode.d.ts.map +1 -0
- package/dist/stages/text-cea708/decode.js +410 -0
- package/dist/stages/text-cea708/decode.js.map +1 -0
- package/dist/stages/text-cea708/index.d.ts +3 -0
- package/dist/stages/text-cea708/index.d.ts.map +1 -0
- package/dist/stages/text-cea708/index.js +93 -0
- package/dist/stages/text-cea708/index.js.map +1 -0
- package/dist/stages/text-ttml/index.d.ts +3 -0
- package/dist/stages/text-ttml/index.d.ts.map +1 -0
- package/dist/stages/text-ttml/index.js +74 -0
- package/dist/stages/text-ttml/index.js.map +1 -0
- package/dist/stages/text-ttml/parse.d.ts +16 -0
- package/dist/stages/text-ttml/parse.d.ts.map +1 -0
- package/dist/stages/text-ttml/parse.js +277 -0
- package/dist/stages/text-ttml/parse.js.map +1 -0
- package/dist/stages/text-webvtt/index.d.ts +6 -13
- package/dist/stages/text-webvtt/index.d.ts.map +1 -1
- package/dist/stages/text-webvtt/index.js +21 -68
- package/dist/stages/text-webvtt/index.js.map +1 -1
- package/dist/stages/timed-metadata/index.d.ts +15 -0
- package/dist/stages/timed-metadata/index.d.ts.map +1 -0
- package/dist/stages/timed-metadata/index.js +370 -0
- package/dist/stages/timed-metadata/index.js.map +1 -0
- package/dist/types/error.d.ts +1 -1
- package/dist/types/error.d.ts.map +1 -1
- package/dist/types/facade.d.ts +8 -10
- package/dist/types/facade.d.ts.map +1 -1
- package/dist/types/ir.d.ts +90 -0
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/kernel.d.ts +8 -0
- package/dist/types/kernel.d.ts.map +1 -1
- package/dist/types/messages.d.ts +10 -1
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/metadata.d.ts +59 -0
- package/dist/types/metadata.d.ts.map +1 -0
- package/dist/types/metadata.js +7 -0
- package/dist/types/metadata.js.map +1 -0
- package/dist/types/quality.d.ts +10 -0
- package/dist/types/quality.d.ts.map +1 -1
- package/dist/types/stage.d.ts +17 -0
- package/dist/types/stage.d.ts.map +1 -1
- package/package.json +10 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { findTrackSite } from "../../kernel/presentation.js";
|
|
3
|
-
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
|
|
4
4
|
import { chaptersFromInput, parseAppleChapters, parseChapterTrack } from "./parse.js";
|
|
5
5
|
//#region src/stages/chapters/index.ts
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import _objectWithoutProperties from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _objectWithoutProperties from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectWithoutProperties.js";
|
|
3
3
|
import { parseVtt } from "../../containers/webvtt.js";
|
|
4
4
|
import { resolveUrl } from "../../kernel/url.js";
|
|
5
5
|
//#region src/stages/chapters/parse.ts
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { findRendition } from "../../kernel/presentation.js";
|
|
2
|
+
import { segmentAt } from "../../kernel/timeline.js";
|
|
3
|
+
import { bytesToHex } from "../../kernel/base64.js";
|
|
2
4
|
//#region src/stages/cmcd/index.ts
|
|
3
5
|
/**
|
|
4
6
|
* Common Media Client Data (CTA-5004). The engine already exposes the seam
|
|
@@ -8,8 +10,9 @@ import { findRendition } from "../../kernel/presentation.js";
|
|
|
8
10
|
* argument or request headers.
|
|
9
11
|
*
|
|
10
12
|
* It computes nothing the kernel does not already track: the active rendition
|
|
11
|
-
* bitrate, the measured throughput EWMA,
|
|
12
|
-
* from the media element
|
|
13
|
+
* bitrate, the measured throughput EWMA, the buffer ahead of the playhead
|
|
14
|
+
* from the media element, and the segment after the one requested (`nor`,
|
|
15
|
+
* `nrr`), so a CDN can prefetch it. No new kernel state, no new effect.
|
|
13
16
|
*/
|
|
14
17
|
/** The CMCD object type, inferred from the URL the request is fetching. */
|
|
15
18
|
function objectType(url) {
|
|
@@ -46,9 +49,24 @@ function sessionUuid() {
|
|
|
46
49
|
const bytes = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
|
|
47
50
|
bytes[6] = bytes[6] & 15 | 64;
|
|
48
51
|
bytes[8] = bytes[8] & 63 | 128;
|
|
49
|
-
const hex =
|
|
52
|
+
const hex = bytesToHex(bytes);
|
|
50
53
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
51
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* `to` as a path relative to `from`, as `nor` needs (CTA-5004 §3.3.1):
|
|
57
|
+
* the file name in the same directory, `../` steps up, or the absolute URL
|
|
58
|
+
* on another origin.
|
|
59
|
+
*/
|
|
60
|
+
function relativePath(from, to) {
|
|
61
|
+
const a = new URL(from);
|
|
62
|
+
const b = new URL(to);
|
|
63
|
+
if (a.origin !== b.origin) return to;
|
|
64
|
+
const fromDirs = a.pathname.split("/").slice(0, -1);
|
|
65
|
+
const toParts = b.pathname.split("/");
|
|
66
|
+
let common = 0;
|
|
67
|
+
while (common < fromDirs.length && fromDirs[common] === toParts[common]) common += 1;
|
|
68
|
+
return `${"../".repeat(fromDirs.length - common)}${toParts.slice(common).join("/")}${b.search}`;
|
|
69
|
+
}
|
|
52
70
|
function cmcd(options = {}) {
|
|
53
71
|
var _options$sessionId, _options$mode;
|
|
54
72
|
const sessionId = (_options$sessionId = options.sessionId) !== null && _options$sessionId !== void 0 ? _options$sessionId : sessionUuid();
|
|
@@ -74,6 +92,15 @@ function cmcd(options = {}) {
|
|
|
74
92
|
const ahead = bufferAhead(el);
|
|
75
93
|
if (ahead !== null) keys.bl = Math.round(ahead * 1e3 / 100) * 100;
|
|
76
94
|
if (ahead !== null && ahead < 1) keys.su = true;
|
|
95
|
+
const request = state.scheduling.inflight.get(req.token);
|
|
96
|
+
if (request !== void 0 && request.seq >= 0 && request.renditionId !== void 0) {
|
|
97
|
+
const site = findRendition(state.presentation, request.renditionId);
|
|
98
|
+
const next = site === null ? null : segmentAt(site.rendition.segments, request.seq + 1, site.period.start);
|
|
99
|
+
if (next !== null) {
|
|
100
|
+
if (next.url !== request.url) keys.nor = encodeURIComponent(relativePath(request.url, next.url));
|
|
101
|
+
if (next.byteRange !== void 0) keys.nrr = `${next.byteRange.start}-${next.byteRange.end}`;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
77
104
|
const payload = serialize(keys);
|
|
78
105
|
if (mode === "header") req.headers["CMCD-Request"] = payload;
|
|
79
106
|
else {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region src/stages/cmsd/index.ts
|
|
2
|
+
/** Splits on commas or semicolons outside double quotes. */
|
|
3
|
+
function split(value, separator) {
|
|
4
|
+
const parts = [];
|
|
5
|
+
let current = "";
|
|
6
|
+
let quoted = false;
|
|
7
|
+
for (const char of value) {
|
|
8
|
+
if (char === "\"") quoted = !quoted;
|
|
9
|
+
if (char === separator && !quoted) {
|
|
10
|
+
parts.push(current);
|
|
11
|
+
current = "";
|
|
12
|
+
} else current += char;
|
|
13
|
+
}
|
|
14
|
+
parts.push(current);
|
|
15
|
+
return parts;
|
|
16
|
+
}
|
|
17
|
+
/** The numeric parameters of the list's last member: `"CDN-B";etp=480;mb=6000`. */
|
|
18
|
+
function cmsdParams(header) {
|
|
19
|
+
var _members;
|
|
20
|
+
const members = split(header, ",");
|
|
21
|
+
const last = (_members = members[members.length - 1]) !== null && _members !== void 0 ? _members : "";
|
|
22
|
+
const params = /* @__PURE__ */ new Map();
|
|
23
|
+
for (const param of split(last, ";").slice(1)) {
|
|
24
|
+
const [key, value] = param.trim().split("=");
|
|
25
|
+
const number = value === void 0 ? NaN : Number(value);
|
|
26
|
+
if (Number.isFinite(number)) params.set(key, number);
|
|
27
|
+
}
|
|
28
|
+
return params;
|
|
29
|
+
}
|
|
30
|
+
function cmsd() {
|
|
31
|
+
return {
|
|
32
|
+
name: "cmsd",
|
|
33
|
+
provides: ["cmsd"],
|
|
34
|
+
requires: ["transport", "rendition-select"],
|
|
35
|
+
install(ctx) {
|
|
36
|
+
let etp = null;
|
|
37
|
+
let mb = null;
|
|
38
|
+
ctx.addResponseHook((response) => {
|
|
39
|
+
var _response$headers;
|
|
40
|
+
const header = response.outcome === "success" ? (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get("CMSD-Dynamic") : null;
|
|
41
|
+
if (header === null || header === void 0) return;
|
|
42
|
+
const params = cmsdParams(header);
|
|
43
|
+
const kbps = (key) => {
|
|
44
|
+
const value = params.get(key);
|
|
45
|
+
return value !== void 0 && value > 0 ? value * 1e3 : null;
|
|
46
|
+
};
|
|
47
|
+
const nextEtp = kbps("etp");
|
|
48
|
+
if (nextEtp !== etp) {
|
|
49
|
+
etp = nextEtp;
|
|
50
|
+
ctx.dispatch({
|
|
51
|
+
type: "THROUGHPUT_HINT",
|
|
52
|
+
bps: etp
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const nextMb = kbps("mb");
|
|
56
|
+
if (nextMb !== mb) {
|
|
57
|
+
mb = nextMb;
|
|
58
|
+
ctx.dispatch(mb === null ? {
|
|
59
|
+
type: "RELEASE_CONSTRAINT",
|
|
60
|
+
source: "cmsd"
|
|
61
|
+
} : {
|
|
62
|
+
type: "CONSTRAIN",
|
|
63
|
+
source: "cmsd",
|
|
64
|
+
constraint: { maxBitrate: mb }
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { cmsdParams, cmsd as default };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import { findRendition } from "../../kernel/presentation.js";
|
|
3
|
+
import { codecMismatch, probeInitSegment } from "../../containers/codec-probe/index.js";
|
|
2
4
|
//#region src/stages/codec-probe/index.ts
|
|
3
5
|
/**
|
|
4
6
|
* codec-probe as a loadable stage. The derivation itself lives in the
|
|
@@ -11,8 +13,10 @@ import { probeInitSegment } from "../../containers/codec-probe/index.js";
|
|
|
11
13
|
* It also registers the composition's type probe: a rendition the manifest
|
|
12
14
|
* left codec-less (a bare media playlist) gets its SourceBuffer typed from
|
|
13
15
|
* its first segment instead of the bare `video/mp4` Chrome refuses. A
|
|
14
|
-
* manifest that does declare codecs still creates the buffer as declared
|
|
15
|
-
*
|
|
16
|
+
* manifest that does declare codecs still creates the buffer as declared.
|
|
17
|
+
* When the init segment holds another codec or another profile, the stage
|
|
18
|
+
* reports it once per rendition as a non-fatal MEDIA_CODEC_MISMATCH error:
|
|
19
|
+
* Chrome can refuse the appends of a buffer typed with the wrong profile.
|
|
16
20
|
*/
|
|
17
21
|
/** A media segment carries a moof; only an init segment carries a moov. */
|
|
18
22
|
function isInitSegment(data) {
|
|
@@ -27,6 +31,26 @@ function codecProbe() {
|
|
|
27
31
|
install(ctx) {
|
|
28
32
|
let detected = [];
|
|
29
33
|
let mimeType = null;
|
|
34
|
+
const reported = /* @__PURE__ */ new Set();
|
|
35
|
+
/** Reports an init segment whose codec is not the one its rendition declares. */
|
|
36
|
+
function checkDeclared(codecs, renditionId) {
|
|
37
|
+
var _findRendition$rendit, _findRendition;
|
|
38
|
+
const presentation = ctx.getState().presentation;
|
|
39
|
+
const declared = (_findRendition$rendit = (_findRendition = findRendition(presentation, renditionId)) === null || _findRendition === void 0 ? void 0 : _findRendition.rendition.codecs) !== null && _findRendition$rendit !== void 0 ? _findRendition$rendit : null;
|
|
40
|
+
if (presentation === null || declared === null) return;
|
|
41
|
+
const mismatch = codecMismatch(declared, codecs);
|
|
42
|
+
if (mismatch === null) return;
|
|
43
|
+
const key = `${presentation.id}|${renditionId}|${mismatch.probed}`;
|
|
44
|
+
if (reported.has(key)) return;
|
|
45
|
+
reported.add(key);
|
|
46
|
+
ctx.emit("error", {
|
|
47
|
+
category: "media",
|
|
48
|
+
code: "MEDIA_CODEC_MISMATCH",
|
|
49
|
+
fatal: false,
|
|
50
|
+
recoverable: true,
|
|
51
|
+
context: _objectSpread2({ renditionId }, mismatch)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
30
54
|
ctx.registerNamespace("codecProbe", {
|
|
31
55
|
get detected() {
|
|
32
56
|
return detected;
|
|
@@ -54,6 +78,7 @@ function codecProbe() {
|
|
|
54
78
|
codecs: result.codecs,
|
|
55
79
|
mimeType: result.mimeType
|
|
56
80
|
});
|
|
81
|
+
checkDeclared(result.codecs, meta.renditionId);
|
|
57
82
|
}
|
|
58
83
|
return data;
|
|
59
84
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { scheduled, tickAfter } from "../../kernel/effects.js";
|
|
3
3
|
//#region src/stages/content-steering/index.ts
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
|
|
3
3
|
import { bytesToBase64 } from "../../kernel/base64.js";
|
|
4
4
|
import { keySystemHandlers, normalizeSystemId } from "../drm-shared.js";
|
|
5
5
|
//#region src/stages/eme-core/index.ts
|
|
@@ -83,6 +83,7 @@ function emeCore(options = {}) {
|
|
|
83
83
|
let keySystem = null;
|
|
84
84
|
let handler = null;
|
|
85
85
|
let licenseUrl = (_options$licenseUrl = options.licenseUrl) !== null && _options$licenseUrl !== void 0 ? _options$licenseUrl : null;
|
|
86
|
+
let certificateUrl = options.certificateUrl;
|
|
86
87
|
const statuses = /* @__PURE__ */ new Map();
|
|
87
88
|
const initDataSeen = /* @__PURE__ */ new Set();
|
|
88
89
|
const open = /* @__PURE__ */ new Map();
|
|
@@ -100,6 +101,9 @@ function emeCore(options = {}) {
|
|
|
100
101
|
},
|
|
101
102
|
setLicenseUrl(url) {
|
|
102
103
|
licenseUrl = url;
|
|
104
|
+
},
|
|
105
|
+
setCertificateUrl(url) {
|
|
106
|
+
certificateUrl = url;
|
|
103
107
|
}
|
|
104
108
|
});
|
|
105
109
|
function fail(code, recoverable, cause) {
|
|
@@ -128,13 +132,13 @@ function emeCore(options = {}) {
|
|
|
128
132
|
const candidates = preferredSystemIds.length > 0 ? ordered.filter((h) => h.systemIds.some((id) => preferredSystemIds.includes(id))) : ordered;
|
|
129
133
|
let lastError;
|
|
130
134
|
for (const candidate of candidates.length > 0 ? candidates : ordered) try {
|
|
131
|
-
var _candidate$fairplay;
|
|
135
|
+
var _candidate$fairplay$c;
|
|
132
136
|
const keys = yield (yield navigator.requestMediaKeySystemAccess(candidate.keySystem, accessConfig(candidate))).createMediaKeys();
|
|
133
137
|
if (disposed) return false;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const response = yield ctx.request(
|
|
137
|
-
if (!response.ok) throw new Error(`certificate ${
|
|
138
|
+
const certificate = candidate.fairplay === void 0 ? void 0 : (_candidate$fairplay$c = candidate.fairplay.certificateUrl) !== null && _candidate$fairplay$c !== void 0 ? _candidate$fairplay$c : certificateUrl;
|
|
139
|
+
if (certificate !== void 0) {
|
|
140
|
+
const response = yield ctx.request(certificate, {});
|
|
141
|
+
if (!response.ok) throw new Error(`certificate ${certificate}: HTTP ${response.status}`);
|
|
138
142
|
yield keys.setServerCertificate(yield response.arrayBuffer());
|
|
139
143
|
}
|
|
140
144
|
yield element.setMediaKeys(keys);
|
|
@@ -294,6 +298,24 @@ function emeCore(options = {}) {
|
|
|
294
298
|
}
|
|
295
299
|
};
|
|
296
300
|
element.addEventListener("play", onPlay);
|
|
301
|
+
let released = [];
|
|
302
|
+
const offSuspended = ctx.on("lifecycle:suspended", () => {
|
|
303
|
+
if (options.releaseOnSuspend !== true || open.size === 0) return;
|
|
304
|
+
released = [...open.entries()].filter(([session]) => ![...open.values()].some((r) => r.replaces === session)).map(([, record]) => ({
|
|
305
|
+
initDataType: record.initDataType,
|
|
306
|
+
initData: record.initData,
|
|
307
|
+
replaces: null,
|
|
308
|
+
usable: false
|
|
309
|
+
}));
|
|
310
|
+
for (const session of [...open.keys()]) retire(session);
|
|
311
|
+
statuses.clear();
|
|
312
|
+
ctx.emit("drm:released", { sessions: released.length });
|
|
313
|
+
});
|
|
314
|
+
const offResumed = ctx.on("lifecycle:resumed", () => {
|
|
315
|
+
const records = released;
|
|
316
|
+
released = [];
|
|
317
|
+
for (const record of records) startSession(record);
|
|
318
|
+
});
|
|
297
319
|
const onEncrypted = (event) => {
|
|
298
320
|
const e = event;
|
|
299
321
|
if (e.initData === null) return;
|
|
@@ -314,6 +336,8 @@ function emeCore(options = {}) {
|
|
|
314
336
|
element.removeEventListener("encrypted", onEncrypted);
|
|
315
337
|
element.removeEventListener("play", onPlay);
|
|
316
338
|
offManifest();
|
|
339
|
+
offSuspended();
|
|
340
|
+
offResumed();
|
|
317
341
|
for (const session of [...open.keys()]) retire(session);
|
|
318
342
|
if (mediaKeys !== null) element.setMediaKeys(null).catch(() => {});
|
|
319
343
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { base64ToBytes, bytesToBase64 } from "../../kernel/base64.js";
|
|
3
3
|
import { registerKeySystem } from "../drm-shared.js";
|
|
4
4
|
//#region src/stages/eme-fairplay/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* FairPlay Streaming: the non-standard SPC/CKC flow. Safari only, and it
|
|
7
|
-
* differs from CENC enough to warrant its own stage
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* differs from CENC enough to warrant its own stage: the CDM message is an
|
|
8
|
+
* SPC to POST, the response is a CKC, and the content id comes from the
|
|
9
|
+
* skd:// URI the hls parser stored in licenseUrl. Registers a handler;
|
|
10
|
+
* eme-core drives it, including the certificate fetch.
|
|
11
|
+
*
|
|
12
|
+
* Key servers differ in the body they take. Most, Irdeto's among them,
|
|
13
|
+
* take the SPC bytes as they are; some take an `spc=` form field with the
|
|
14
|
+
* SPC in base64. The `licenseBody` option picks one.
|
|
11
15
|
*/
|
|
12
16
|
const FAIRPLAY_SYSTEM_ID = "94ce86fb-07ff-4f43-adb8-93d2fa968ca2";
|
|
13
17
|
/** The content id from a skd:// init data blob: the URI's opaque tail. */
|
|
@@ -40,15 +44,20 @@ function emeFairplay(options = {}) {
|
|
|
40
44
|
provides: ["eme-fairplay"],
|
|
41
45
|
requires: ["eme-core"],
|
|
42
46
|
install() {
|
|
43
|
-
registerKeySystem({
|
|
47
|
+
registerKeySystem(_objectSpread2(_objectSpread2({
|
|
44
48
|
keySystem: "com.apple.fps",
|
|
45
49
|
systemIds: [FAIRPLAY_SYSTEM_ID],
|
|
46
|
-
initDataTypes: ["sinf", "skd"]
|
|
50
|
+
initDataTypes: ["sinf", "skd"]
|
|
51
|
+
}, options.licenseBody === "form" ? {
|
|
47
52
|
licenseHeaders: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
48
|
-
buildLicenseRequest: buildSpcRequest
|
|
53
|
+
buildLicenseRequest: buildSpcRequest
|
|
54
|
+
} : {
|
|
55
|
+
licenseHeaders: { "Content-Type": "application/octet-stream" },
|
|
56
|
+
buildLicenseRequest: (message) => message
|
|
57
|
+
}), {}, {
|
|
49
58
|
parseLicenseResponse: parseCkcResponse,
|
|
50
59
|
fairplay: _objectSpread2(_objectSpread2({}, options.certificateUrl !== void 0 ? { certificateUrl: options.certificateUrl } : {}), {}, { contentId: contentIdFromSkd })
|
|
51
|
-
});
|
|
60
|
+
}));
|
|
52
61
|
}
|
|
53
62
|
};
|
|
54
63
|
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
|
|
2
|
+
//#region src/stages/hdr/index.ts
|
|
3
|
+
const SOURCE = "hdr";
|
|
4
|
+
/** The display's answer, or null when the browser does not know `dynamic-range`. */
|
|
5
|
+
function displayHdr() {
|
|
6
|
+
if (typeof matchMedia !== "function") return null;
|
|
7
|
+
if (matchMedia("(dynamic-range: high)").matches) return true;
|
|
8
|
+
return matchMedia("(dynamic-range: standard)").matches ? false : null;
|
|
9
|
+
}
|
|
10
|
+
function capabilities() {
|
|
11
|
+
var _mediaCapabilities;
|
|
12
|
+
return (_mediaCapabilities = navigator.mediaCapabilities) !== null && _mediaCapabilities !== void 0 ? _mediaCapabilities : null;
|
|
13
|
+
}
|
|
14
|
+
/** True when `decodingInfo` reads the HDR fields: an invalid enum value is then a TypeError. */
|
|
15
|
+
function knowsHdrFields(_x) {
|
|
16
|
+
return _knowsHdrFields.apply(this, arguments);
|
|
17
|
+
}
|
|
18
|
+
function _knowsHdrFields() {
|
|
19
|
+
_knowsHdrFields = _asyncToGenerator(function* (api) {
|
|
20
|
+
try {
|
|
21
|
+
yield api.decodingInfo({
|
|
22
|
+
type: "media-source",
|
|
23
|
+
video: {
|
|
24
|
+
contentType: "video/mp4; codecs=\"avc1.42E01E\"",
|
|
25
|
+
width: 640,
|
|
26
|
+
height: 360,
|
|
27
|
+
bitrate: 1e6,
|
|
28
|
+
framerate: 30,
|
|
29
|
+
hdrMetadataType: "unknown"
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return false;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
return error instanceof TypeError;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return _knowsHdrFields.apply(this, arguments);
|
|
38
|
+
}
|
|
39
|
+
function isHdr(rendition) {
|
|
40
|
+
return rendition.videoRange === "PQ" || rendition.videoRange === "HLG";
|
|
41
|
+
}
|
|
42
|
+
const formatOf = (rendition) => {
|
|
43
|
+
var _rendition$codecs;
|
|
44
|
+
return `${(_rendition$codecs = rendition.codecs) !== null && _rendition$codecs !== void 0 ? _rendition$codecs : ""}|${rendition.videoRange}`;
|
|
45
|
+
};
|
|
46
|
+
function hdr(options = {}) {
|
|
47
|
+
return {
|
|
48
|
+
name: "hdr",
|
|
49
|
+
provides: ["hdr"],
|
|
50
|
+
requires: ["rendition-select"],
|
|
51
|
+
install(ctx) {
|
|
52
|
+
let state = {
|
|
53
|
+
display: null,
|
|
54
|
+
formats: {},
|
|
55
|
+
source: null,
|
|
56
|
+
allowed: true
|
|
57
|
+
};
|
|
58
|
+
let seen = null;
|
|
59
|
+
let run = 0;
|
|
60
|
+
let constrained = false;
|
|
61
|
+
function videoRenditions() {
|
|
62
|
+
var _ctx$getState$present, _ctx$getState$present2;
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const period of (_ctx$getState$present = (_ctx$getState$present2 = ctx.getState().presentation) === null || _ctx$getState$present2 === void 0 ? void 0 : _ctx$getState$present2.periods) !== null && _ctx$getState$present !== void 0 ? _ctx$getState$present : []) for (const track of period.tracks) if (track.contentType === "video") out.push(...track.renditions);
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
const hdrRenditions = () => videoRenditions().filter(isHdr);
|
|
68
|
+
function apply(excluded) {
|
|
69
|
+
if (excluded === "all" && videoRenditions().every(isHdr) || excluded === "none" || excluded !== "all" && excluded.length === 0) {
|
|
70
|
+
if (constrained) ctx.dispatch({
|
|
71
|
+
type: "RELEASE_CONSTRAINT",
|
|
72
|
+
source: SOURCE
|
|
73
|
+
});
|
|
74
|
+
constrained = false;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
constrained = true;
|
|
78
|
+
ctx.dispatch({
|
|
79
|
+
type: "CONSTRAIN",
|
|
80
|
+
source: SOURCE,
|
|
81
|
+
constraint: excluded === "all" ? { hdr: false } : { excludeIds: excluded.map((r) => r.id) }
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function evaluate() {
|
|
85
|
+
return _evaluate.apply(this, arguments);
|
|
86
|
+
}
|
|
87
|
+
function _evaluate() {
|
|
88
|
+
_evaluate = _asyncToGenerator(function* () {
|
|
89
|
+
run += 1;
|
|
90
|
+
const mine = run;
|
|
91
|
+
const renditions = hdrRenditions();
|
|
92
|
+
if (renditions.length === 0) {
|
|
93
|
+
state = {
|
|
94
|
+
display: null,
|
|
95
|
+
formats: {},
|
|
96
|
+
source: null,
|
|
97
|
+
allowed: true
|
|
98
|
+
};
|
|
99
|
+
apply("none");
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const display = displayHdr();
|
|
103
|
+
if (options.supported !== void 0) {
|
|
104
|
+
const answer = typeof options.supported === "function" ? yield options.supported() : options.supported;
|
|
105
|
+
if (mine !== run) return;
|
|
106
|
+
state = {
|
|
107
|
+
display,
|
|
108
|
+
formats: {},
|
|
109
|
+
source: "option",
|
|
110
|
+
allowed: answer
|
|
111
|
+
};
|
|
112
|
+
apply(answer ? "none" : "all");
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const formats = {};
|
|
116
|
+
const api = capabilities();
|
|
117
|
+
const known = api !== null && (yield knowsHdrFields(api));
|
|
118
|
+
for (const rendition of renditions) {
|
|
119
|
+
const key = formatOf(rendition);
|
|
120
|
+
if (key in formats) continue;
|
|
121
|
+
formats[key] = null;
|
|
122
|
+
if (!known || api === null) continue;
|
|
123
|
+
try {
|
|
124
|
+
var _rendition$codecs2, _rendition$width, _rendition$height, _rendition$frameRate;
|
|
125
|
+
formats[key] = (yield api.decodingInfo({
|
|
126
|
+
type: "media-source",
|
|
127
|
+
video: {
|
|
128
|
+
contentType: `video/mp4; codecs="${(_rendition$codecs2 = rendition.codecs) !== null && _rendition$codecs2 !== void 0 ? _rendition$codecs2 : ""}"`,
|
|
129
|
+
width: (_rendition$width = rendition.width) !== null && _rendition$width !== void 0 ? _rendition$width : 1920,
|
|
130
|
+
height: (_rendition$height = rendition.height) !== null && _rendition$height !== void 0 ? _rendition$height : 1080,
|
|
131
|
+
bitrate: rendition.bitrate || 5e6,
|
|
132
|
+
framerate: (_rendition$frameRate = rendition.frameRate) !== null && _rendition$frameRate !== void 0 ? _rendition$frameRate : 30,
|
|
133
|
+
transferFunction: rendition.videoRange === "HLG" ? "hlg" : "pq",
|
|
134
|
+
colorGamut: "rec2020"
|
|
135
|
+
}
|
|
136
|
+
})).supported;
|
|
137
|
+
} catch (_unused) {
|
|
138
|
+
formats[key] = false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (mine !== run) return;
|
|
142
|
+
if (display === null && !known) {
|
|
143
|
+
state = {
|
|
144
|
+
display,
|
|
145
|
+
formats,
|
|
146
|
+
source: "default",
|
|
147
|
+
allowed: false
|
|
148
|
+
};
|
|
149
|
+
apply("all");
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (display === false) {
|
|
153
|
+
state = {
|
|
154
|
+
display,
|
|
155
|
+
formats,
|
|
156
|
+
source: "probe",
|
|
157
|
+
allowed: false
|
|
158
|
+
};
|
|
159
|
+
apply("all");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const unsupported = renditions.filter((r) => formats[formatOf(r)] === false);
|
|
163
|
+
state = {
|
|
164
|
+
display,
|
|
165
|
+
formats,
|
|
166
|
+
source: "probe",
|
|
167
|
+
allowed: unsupported.length < renditions.length
|
|
168
|
+
};
|
|
169
|
+
apply(unsupported.length === renditions.length ? "all" : unsupported);
|
|
170
|
+
});
|
|
171
|
+
return _evaluate.apply(this, arguments);
|
|
172
|
+
}
|
|
173
|
+
function onPresentation() {
|
|
174
|
+
const presentation = ctx.getState().presentation;
|
|
175
|
+
if (presentation === seen) return;
|
|
176
|
+
seen = presentation;
|
|
177
|
+
evaluate();
|
|
178
|
+
}
|
|
179
|
+
const query = typeof matchMedia === "function" ? matchMedia("(dynamic-range: high)") : null;
|
|
180
|
+
const onChange = () => {
|
|
181
|
+
evaluate();
|
|
182
|
+
};
|
|
183
|
+
if (query !== null) {
|
|
184
|
+
if (typeof query.addEventListener === "function") query.addEventListener("change", onChange);
|
|
185
|
+
else query.addListener(onChange);
|
|
186
|
+
}
|
|
187
|
+
const off = ctx.on("tracks:changed", onPresentation);
|
|
188
|
+
ctx.registerNamespace("hdr", {
|
|
189
|
+
get display() {
|
|
190
|
+
return state.display;
|
|
191
|
+
},
|
|
192
|
+
get formats() {
|
|
193
|
+
return state.formats;
|
|
194
|
+
},
|
|
195
|
+
get source() {
|
|
196
|
+
return state.source;
|
|
197
|
+
},
|
|
198
|
+
get allowed() {
|
|
199
|
+
return state.allowed;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
return () => {
|
|
203
|
+
run += 1;
|
|
204
|
+
off();
|
|
205
|
+
if (query !== null) {
|
|
206
|
+
if (typeof query.removeEventListener === "function") query.removeEventListener("change", onChange);
|
|
207
|
+
else query.removeListener(onChange);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
export { hdr as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { id3Cues } from "../../containers/id3.js";
|
|
1
|
+
import { id3Cues, id3Events } from "../../containers/id3.js";
|
|
2
|
+
import { deliverMetadata, metadataWanted } from "../../containers/metadata.js";
|
|
2
3
|
import { createMetadataSink } from "../../kernel/sinks/metadata-sink.js";
|
|
3
4
|
//#region src/stages/meta-id3/index.ts
|
|
4
5
|
/**
|
|
@@ -13,6 +14,10 @@ import { createMetadataSink } from "../../kernel/sinks/metadata-sink.js";
|
|
|
13
14
|
* legacy segments it rides in.
|
|
14
15
|
*/
|
|
15
16
|
function parseId3Segment(data, meta) {
|
|
17
|
+
if (metadataWanted()) deliverMetadata(id3Events([{
|
|
18
|
+
time: meta.start,
|
|
19
|
+
bytes: data
|
|
20
|
+
}]));
|
|
16
21
|
return id3Cues(data, meta.start);
|
|
17
22
|
}
|
|
18
23
|
function metaId3() {
|