mattebox 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +3 -6
- package/dist/containers/adts.d.ts +10 -0
- package/dist/containers/adts.d.ts.map +1 -1
- package/dist/containers/adts.js +27 -7
- package/dist/containers/adts.js.map +1 -1
- package/dist/containers/codec-probe/index.d.ts +0 -6
- package/dist/containers/codec-probe/index.d.ts.map +1 -1
- package/dist/containers/codec-probe/index.js +14 -23
- package/dist/containers/codec-probe/index.js.map +1 -1
- package/dist/containers/fmp4/fit.d.ts +26 -0
- package/dist/containers/fmp4/fit.d.ts.map +1 -0
- package/dist/containers/fmp4/fit.js +49 -0
- package/dist/containers/fmp4/fit.js.map +1 -0
- package/dist/containers/fmp4/writer.d.ts +7 -0
- package/dist/containers/fmp4/writer.d.ts.map +1 -1
- package/dist/containers/fmp4/writer.js +9 -1
- package/dist/containers/fmp4/writer.js.map +1 -1
- package/dist/containers/id3.d.ts.map +1 -1
- package/dist/containers/id3.js +2 -1
- package/dist/containers/id3.js.map +1 -1
- package/dist/containers/mp4-box/index.d.ts +75 -7
- package/dist/containers/mp4-box/index.d.ts.map +1 -1
- package/dist/containers/mp4-box/index.js +225 -49
- package/dist/containers/mp4-box/index.js.map +1 -1
- package/dist/containers/packed-audio/index.d.ts.map +1 -1
- package/dist/containers/packed-audio/index.js +9 -27
- package/dist/containers/packed-audio/index.js.map +1 -1
- package/dist/containers/sei.d.ts +5 -0
- package/dist/containers/sei.d.ts.map +1 -1
- package/dist/containers/sei.js +5 -2
- package/dist/containers/sei.js.map +1 -1
- package/dist/containers/ts-transmux/demux.d.ts +7 -1
- package/dist/containers/ts-transmux/demux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/demux.js +38 -17
- package/dist/containers/ts-transmux/demux.js.map +1 -1
- package/dist/containers/ts-transmux/h264.d.ts.map +1 -1
- package/dist/containers/ts-transmux/h264.js +1 -17
- package/dist/containers/ts-transmux/h264.js.map +1 -1
- package/dist/containers/ts-transmux/index.d.ts.map +1 -1
- package/dist/containers/ts-transmux/index.js +11 -2
- package/dist/containers/ts-transmux/index.js.map +1 -1
- package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/transmux.js +6 -36
- package/dist/containers/ts-transmux/transmux.js.map +1 -1
- package/dist/{stages/text-webvtt/parse.d.ts → containers/webvtt.d.ts} +4 -3
- package/dist/containers/webvtt.d.ts.map +1 -0
- package/dist/{stages/text-webvtt/parse.js → containers/webvtt.js} +1 -1
- package/dist/containers/webvtt.js.map +1 -0
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/objectWithoutProperties.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/containers/adts.js +28 -8
- package/dist/es2015/containers/codec-probe/index.js +17 -26
- package/dist/es2015/containers/fmp4/fit.js +46 -0
- package/dist/es2015/containers/fmp4/writer.js +9 -1
- package/dist/es2015/containers/id3.js +3 -3
- package/dist/es2015/containers/mp4-box/index.js +224 -39
- package/dist/es2015/containers/packed-audio/index.js +6 -33
- package/dist/es2015/containers/sei.js +6 -3
- package/dist/es2015/containers/ts-transmux/demux.js +41 -22
- package/dist/es2015/containers/ts-transmux/h264.js +2 -18
- package/dist/es2015/containers/ts-transmux/index.js +9 -9
- package/dist/es2015/containers/ts-transmux/transmux.js +8 -39
- package/dist/es2015/{stages/text-webvtt/parse.js → containers/webvtt.js} +2 -2
- package/dist/es2015/index.js +40 -42
- package/dist/es2015/kernel/append-queue.js +1 -1
- package/dist/es2015/kernel/base64.js +25 -0
- package/dist/es2015/kernel/context.js +7 -0
- package/dist/es2015/kernel/effects.js +21 -1
- package/dist/es2015/kernel/loader.js +5 -4
- package/dist/es2015/kernel/mime.js +5 -1
- package/dist/es2015/kernel/mse.js +27 -71
- package/dist/es2015/kernel/prepare.js +77 -0
- package/dist/es2015/kernel/presentation.js +24 -0
- package/dist/es2015/kernel/reducer.js +279 -124
- package/dist/es2015/kernel/refresh.js +35 -0
- package/dist/es2015/kernel/rendition-select.js +109 -4
- package/dist/es2015/kernel/scheduler.js +23 -5
- package/dist/es2015/kernel/sinks/text-track-sink.js +27 -26
- package/dist/es2015/kernel/timeline.js +22 -1
- package/dist/es2015/kernel/trace.js +1 -1
- package/dist/es2015/kernel/track-registry.js +10 -2
- package/dist/es2015/kernel/transport.js +4 -4
- package/dist/es2015/kernel/url.js +12 -0
- package/dist/es2015/presets/define.js +2 -2
- package/dist/es2015/presets/full/index.js +9 -3
- package/dist/es2015/presets/tiers.js +7 -6
- package/dist/es2015/protocols/adapter-shared.js +28 -0
- package/dist/es2015/protocols/dash-cmaf/index.js +132 -88
- package/dist/es2015/protocols/dash-cmaf/parse.js +62 -64
- package/dist/es2015/protocols/dash-live/index.js +62 -37
- package/dist/es2015/protocols/dimensions.js +15 -0
- package/dist/es2015/protocols/hls-cmaf/index.js +108 -95
- package/dist/es2015/protocols/hls-cmaf/lexer.js +3 -0
- package/dist/es2015/protocols/hls-cmaf/parse.js +167 -56
- package/dist/es2015/protocols/hls-cmaf/unavailable.js +43 -0
- package/dist/es2015/protocols/hls-live/index.js +187 -109
- package/dist/es2015/stages/abr/index.js +8 -11
- package/dist/es2015/stages/abr-persist/index.js +18 -11
- package/dist/es2015/stages/aes-128/index.js +15 -8
- package/dist/es2015/stages/alt-audio/index.js +25 -13
- package/dist/es2015/stages/chapters/index.js +151 -0
- package/dist/es2015/stages/chapters/parse.js +149 -0
- package/dist/es2015/stages/cmaf-timing/index.js +24 -39
- package/dist/es2015/stages/cmcd/index.js +29 -6
- package/dist/es2015/stages/codec-switch/index.js +2 -5
- package/dist/es2015/stages/content-steering/index.js +13 -16
- package/dist/es2015/stages/eme-cenc/index.js +10 -4
- package/dist/es2015/stages/eme-core/index.js +31 -13
- package/dist/es2015/stages/eme-fairplay/index.js +12 -8
- package/dist/es2015/stages/nal-scan/index.js +30 -140
- package/dist/es2015/stages/recovery/index.js +47 -54
- package/dist/es2015/stages/text-cea608/decode.js +1 -1
- package/dist/es2015/stages/text-cea608/index.js +3 -17
- package/dist/es2015/stages/text-webvtt/index.js +1 -1
- package/dist/es2015/stages/text-webvtt-segmented/index.js +15 -8
- package/dist/es2015/stages/thumbnails/index.js +213 -43
- package/dist/es2015/stages/trick-play/index.js +463 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -53
- package/dist/index.js.map +1 -1
- package/dist/kernel/base64.d.ts +9 -0
- package/dist/kernel/base64.d.ts.map +1 -0
- package/dist/kernel/base64.js +26 -0
- package/dist/kernel/base64.js.map +1 -0
- package/dist/kernel/context.d.ts +5 -1
- package/dist/kernel/context.d.ts.map +1 -1
- package/dist/kernel/context.js +10 -0
- package/dist/kernel/context.js.map +1 -1
- package/dist/kernel/effects.d.ts +9 -1
- package/dist/kernel/effects.d.ts.map +1 -1
- package/dist/kernel/effects.js +12 -0
- package/dist/kernel/effects.js.map +1 -1
- package/dist/kernel/lifecycle.js +1 -1
- package/dist/kernel/lifecycle.js.map +1 -1
- package/dist/kernel/loader.d.ts.map +1 -1
- package/dist/kernel/loader.js +5 -7
- package/dist/kernel/loader.js.map +1 -1
- package/dist/kernel/mime.d.ts +2 -0
- package/dist/kernel/mime.d.ts.map +1 -1
- package/dist/kernel/mime.js +4 -0
- package/dist/kernel/mime.js.map +1 -1
- package/dist/kernel/mse.d.ts +6 -10
- package/dist/kernel/mse.d.ts.map +1 -1
- package/dist/kernel/mse.js +20 -73
- package/dist/kernel/mse.js.map +1 -1
- package/dist/kernel/prepare.d.ts +28 -0
- package/dist/kernel/prepare.d.ts.map +1 -0
- package/dist/kernel/prepare.js +89 -0
- package/dist/kernel/prepare.js.map +1 -0
- package/dist/kernel/presentation.d.ts +20 -0
- package/dist/kernel/presentation.d.ts.map +1 -0
- package/dist/kernel/presentation.js +25 -0
- package/dist/kernel/presentation.js.map +1 -0
- package/dist/kernel/reducer.d.ts +24 -0
- package/dist/kernel/reducer.d.ts.map +1 -1
- package/dist/kernel/reducer.js +375 -152
- package/dist/kernel/reducer.js.map +1 -1
- package/dist/kernel/refresh.d.ts +14 -0
- package/dist/kernel/refresh.d.ts.map +1 -0
- package/dist/kernel/refresh.js +51 -0
- package/dist/kernel/refresh.js.map +1 -0
- package/dist/kernel/rendition-select.d.ts +38 -5
- package/dist/kernel/rendition-select.d.ts.map +1 -1
- package/dist/kernel/rendition-select.js +134 -2
- package/dist/kernel/rendition-select.js.map +1 -1
- package/dist/kernel/scheduler.d.ts +18 -3
- package/dist/kernel/scheduler.d.ts.map +1 -1
- package/dist/kernel/scheduler.js +32 -7
- package/dist/kernel/scheduler.js.map +1 -1
- package/dist/kernel/sinks/text-track-sink.d.ts +9 -0
- package/dist/kernel/sinks/text-track-sink.d.ts.map +1 -1
- package/dist/kernel/sinks/text-track-sink.js +29 -29
- package/dist/kernel/sinks/text-track-sink.js.map +1 -1
- package/dist/kernel/timeline.d.ts +26 -7
- package/dist/kernel/timeline.d.ts.map +1 -1
- package/dist/kernel/timeline.js +21 -7
- package/dist/kernel/timeline.js.map +1 -1
- package/dist/kernel/track-registry.d.ts.map +1 -1
- package/dist/kernel/track-registry.js +17 -1
- package/dist/kernel/track-registry.js.map +1 -1
- package/dist/kernel/transport.d.ts.map +1 -1
- package/dist/kernel/transport.js +1 -0
- package/dist/kernel/transport.js.map +1 -1
- package/dist/kernel/url.d.ts +4 -0
- package/dist/kernel/url.d.ts.map +1 -0
- package/dist/kernel/url.js +11 -0
- package/dist/kernel/url.js.map +1 -0
- package/dist/presets/full/index.d.ts.map +1 -1
- package/dist/presets/full/index.js +8 -2
- package/dist/presets/full/index.js.map +1 -1
- package/dist/presets/tiers.d.ts +7 -6
- package/dist/presets/tiers.d.ts.map +1 -1
- package/dist/presets/tiers.js +7 -6
- package/dist/presets/tiers.js.map +1 -1
- package/dist/protocols/adapter-shared.d.ts +23 -0
- package/dist/protocols/adapter-shared.d.ts.map +1 -0
- package/dist/protocols/adapter-shared.js +23 -0
- package/dist/protocols/adapter-shared.js.map +1 -0
- package/dist/protocols/dash-cmaf/index.d.ts +2 -2
- package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/index.js +150 -97
- package/dist/protocols/dash-cmaf/index.js.map +1 -1
- package/dist/protocols/dash-cmaf/parse.d.ts +2 -5
- package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/parse.js +46 -39
- package/dist/protocols/dash-cmaf/parse.js.map +1 -1
- package/dist/protocols/dash-live/index.d.ts.map +1 -1
- package/dist/protocols/dash-live/index.js +67 -25
- package/dist/protocols/dash-live/index.js.map +1 -1
- package/dist/protocols/dimensions.d.ts +8 -0
- package/dist/protocols/dimensions.d.ts.map +1 -0
- package/dist/protocols/dimensions.js +13 -0
- package/dist/protocols/dimensions.js.map +1 -0
- package/dist/protocols/hls-cmaf/index.d.ts +3 -2
- package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/index.js +127 -114
- 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 +3 -0
- package/dist/protocols/hls-cmaf/lexer.js.map +1 -1
- package/dist/protocols/hls-cmaf/parse.d.ts +22 -14
- package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/parse.js +196 -69
- package/dist/protocols/hls-cmaf/parse.js.map +1 -1
- package/dist/protocols/hls-cmaf/unavailable.d.ts +17 -0
- package/dist/protocols/hls-cmaf/unavailable.d.ts.map +1 -0
- package/dist/protocols/hls-cmaf/unavailable.js +38 -0
- package/dist/protocols/hls-cmaf/unavailable.js.map +1 -0
- package/dist/protocols/hls-live/index.d.ts +17 -0
- package/dist/protocols/hls-live/index.d.ts.map +1 -1
- package/dist/protocols/hls-live/index.js +202 -106
- 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 +8 -14
- package/dist/stages/abr/index.js.map +1 -1
- package/dist/stages/abr-cap-size/index.d.ts +1 -1
- package/dist/stages/abr-persist/index.d.ts.map +1 -1
- package/dist/stages/abr-persist/index.js +17 -7
- package/dist/stages/abr-persist/index.js.map +1 -1
- package/dist/stages/aes-128/index.d.ts +0 -9
- package/dist/stages/aes-128/index.d.ts.map +1 -1
- package/dist/stages/aes-128/index.js +15 -13
- package/dist/stages/aes-128/index.js.map +1 -1
- package/dist/stages/alt-audio/index.d.ts +16 -0
- package/dist/stages/alt-audio/index.d.ts.map +1 -1
- package/dist/stages/alt-audio/index.js +28 -15
- package/dist/stages/alt-audio/index.js.map +1 -1
- package/dist/stages/chapters/index.d.ts +20 -0
- package/dist/stages/chapters/index.d.ts.map +1 -0
- package/dist/stages/chapters/index.js +141 -0
- package/dist/stages/chapters/index.js.map +1 -0
- package/dist/stages/chapters/parse.d.ts +47 -0
- package/dist/stages/chapters/parse.d.ts.map +1 -0
- package/dist/stages/chapters/parse.js +168 -0
- package/dist/stages/chapters/parse.js.map +1 -0
- package/dist/stages/cmaf-timing/index.d.ts.map +1 -1
- package/dist/stages/cmaf-timing/index.js +33 -42
- package/dist/stages/cmaf-timing/index.js.map +1 -1
- package/dist/stages/cmcd/index.d.ts +0 -11
- package/dist/stages/cmcd/index.d.ts.map +1 -1
- package/dist/stages/cmcd/index.js +30 -12
- package/dist/stages/cmcd/index.js.map +1 -1
- package/dist/stages/codec-switch/index.d.ts.map +1 -1
- package/dist/stages/codec-switch/index.js +3 -8
- package/dist/stages/codec-switch/index.js.map +1 -1
- package/dist/stages/content-steering/index.d.ts.map +1 -1
- package/dist/stages/content-steering/index.js +12 -9
- package/dist/stages/content-steering/index.js.map +1 -1
- package/dist/stages/eme-cenc/index.d.ts +0 -7
- package/dist/stages/eme-cenc/index.d.ts.map +1 -1
- package/dist/stages/eme-cenc/index.js +9 -5
- package/dist/stages/eme-cenc/index.js.map +1 -1
- package/dist/stages/eme-core/index.d.ts.map +1 -1
- package/dist/stages/eme-core/index.js +31 -15
- package/dist/stages/eme-core/index.js.map +1 -1
- package/dist/stages/eme-fairplay/index.d.ts +0 -7
- package/dist/stages/eme-fairplay/index.d.ts.map +1 -1
- package/dist/stages/eme-fairplay/index.js +11 -9
- package/dist/stages/eme-fairplay/index.js.map +1 -1
- package/dist/stages/nal-scan/index.d.ts.map +1 -1
- package/dist/stages/nal-scan/index.js +32 -145
- package/dist/stages/nal-scan/index.js.map +1 -1
- package/dist/stages/recovery/index.d.ts.map +1 -1
- package/dist/stages/recovery/index.js +42 -56
- package/dist/stages/recovery/index.js.map +1 -1
- package/dist/stages/text-cea608/index.d.ts +11 -0
- package/dist/stages/text-cea608/index.d.ts.map +1 -1
- package/dist/stages/text-cea608/index.js +3 -23
- package/dist/stages/text-cea608/index.js.map +1 -1
- package/dist/stages/text-webvtt/index.d.ts +12 -0
- package/dist/stages/text-webvtt/index.d.ts.map +1 -1
- package/dist/stages/text-webvtt/index.js +1 -1
- package/dist/stages/text-webvtt/index.js.map +1 -1
- package/dist/stages/text-webvtt-segmented/index.d.ts.map +1 -1
- package/dist/stages/text-webvtt-segmented/index.js +11 -8
- package/dist/stages/text-webvtt-segmented/index.js.map +1 -1
- package/dist/stages/thumbnails/index.d.ts +39 -10
- package/dist/stages/thumbnails/index.d.ts.map +1 -1
- package/dist/stages/thumbnails/index.js +220 -30
- package/dist/stages/thumbnails/index.js.map +1 -1
- package/dist/stages/trick-play/index.d.ts +51 -0
- package/dist/stages/trick-play/index.d.ts.map +1 -0
- package/dist/stages/trick-play/index.js +480 -0
- package/dist/stages/trick-play/index.js.map +1 -0
- package/dist/types/ir.d.ts +40 -1
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/kernel.d.ts +41 -13
- package/dist/types/kernel.d.ts.map +1 -1
- package/dist/types/kernel.js +2 -1
- package/dist/types/kernel.js.map +1 -1
- package/dist/types/messages.d.ts +61 -10
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/stage.d.ts +18 -0
- package/dist/types/stage.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/stages/text-webvtt/parse.d.ts.map +0 -1
- package/dist/stages/text-webvtt/parse.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
//#region src/kernel/refresh.ts
|
|
3
|
+
/** The presentation with the refresh merged, or null when it names no rendition the presentation holds. */
|
|
4
|
+
function applyRefresh(presentation, refresh) {
|
|
5
|
+
const renditionId = refresh.renditionId;
|
|
6
|
+
if (renditionId === void 0) return null;
|
|
7
|
+
let found = false;
|
|
8
|
+
const periods = presentation.periods.map((period) => _objectSpread2(_objectSpread2({}, period), {}, { tracks: period.tracks.map((track) => {
|
|
9
|
+
var _ref, _track$protection;
|
|
10
|
+
if (!track.renditions.some((r) => r.id === renditionId)) return track;
|
|
11
|
+
found = true;
|
|
12
|
+
return _objectSpread2(_objectSpread2({}, track), {}, {
|
|
13
|
+
protection: (_ref = (_track$protection = track.protection) !== null && _track$protection !== void 0 ? _track$protection : refresh.protection) !== null && _ref !== void 0 ? _ref : null,
|
|
14
|
+
renditions: track.renditions.map((rendition) => rendition.id === renditionId ? _objectSpread2(_objectSpread2(_objectSpread2({}, rendition), {}, { segments: refresh.segments }, refresh.init !== void 0 ? { init: refresh.init } : {}), refresh.tiles !== void 0 ? { tiles: refresh.tiles } : {}) : rendition)
|
|
15
|
+
});
|
|
16
|
+
}) }));
|
|
17
|
+
if (!found) return null;
|
|
18
|
+
if (refresh.endlist === void 0) return _objectSpread2(_objectSpread2({}, presentation), {}, { periods });
|
|
19
|
+
if (refresh.endlist) {
|
|
20
|
+
var _presentation$duratio;
|
|
21
|
+
const duration = refresh.segments.reduce((sum, s) => sum + s.duration, 0);
|
|
22
|
+
return _objectSpread2(_objectSpread2({}, presentation), {}, {
|
|
23
|
+
isLive: false,
|
|
24
|
+
duration: Math.max((_presentation$duratio = presentation.duration) !== null && _presentation$duratio !== void 0 ? _presentation$duratio : 0, duration),
|
|
25
|
+
periods
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return _objectSpread2(_objectSpread2({}, presentation), {}, {
|
|
29
|
+
isLive: true,
|
|
30
|
+
live: _objectSpread2(_objectSpread2(_objectSpread2({}, presentation.live), refresh.updatePeriod !== void 0 ? { updatePeriod: refresh.updatePeriod } : {}), refresh.dateAnchor !== void 0 ? { dateAnchor: refresh.dateAnchor } : {}),
|
|
31
|
+
periods
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { applyRefresh };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import { findRendition } from "./presentation.js";
|
|
2
3
|
import { segmentAtTime } from "./timeline.js";
|
|
3
4
|
import { bufferedEndFrom } from "./scheduler.js";
|
|
4
5
|
//#region src/kernel/rendition-select.ts
|
|
@@ -33,7 +34,111 @@ function lowest(allowed) {
|
|
|
33
34
|
for (const candidate of allowed) if (candidate.bitrate < best.bitrate) best = candidate;
|
|
34
35
|
return best;
|
|
35
36
|
}
|
|
36
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* The video renditions an adapter resolves ahead of need: the active one
|
|
39
|
+
* and the nearest rung below and above on its pathway. ABR moves one rung
|
|
40
|
+
* at a time from a full buffer, so its next pick is resolved before it is
|
|
41
|
+
* chosen; a longer jump resolves when it happens, while the buffer plays.
|
|
42
|
+
* Renditions a constraint excludes by id (another pathway, a failed
|
|
43
|
+
* playlist) are skipped, and renditions that share a playlist count once.
|
|
44
|
+
* Without a usable active rendition the lowest stands in, as arbitration picks it.
|
|
45
|
+
*/
|
|
46
|
+
function ladderNeighbours(renditions, activeId, constraints) {
|
|
47
|
+
var _pool$find;
|
|
48
|
+
const excluded = /* @__PURE__ */ new Set();
|
|
49
|
+
for (const constraint of constraints.values()) {
|
|
50
|
+
var _constraint$excludeId2;
|
|
51
|
+
for (const id of (_constraint$excludeId2 = constraint.excludeIds) !== null && _constraint$excludeId2 !== void 0 ? _constraint$excludeId2 : []) excluded.add(id);
|
|
52
|
+
}
|
|
53
|
+
const usable = renditions.filter((r) => !excluded.has(r.id));
|
|
54
|
+
const pool = [...usable.length > 0 ? usable : renditions].sort((a, b) => a.bitrate - b.bitrate);
|
|
55
|
+
const active = (_pool$find = pool.find((r) => r.id === activeId)) !== null && _pool$find !== void 0 ? _pool$find : pool[0];
|
|
56
|
+
if (active === void 0) return [];
|
|
57
|
+
const key = (r) => {
|
|
58
|
+
var _r$playlistUrl;
|
|
59
|
+
return (_r$playlistUrl = r.playlistUrl) !== null && _r$playlistUrl !== void 0 ? _r$playlistUrl : r.id;
|
|
60
|
+
};
|
|
61
|
+
const ladder = [];
|
|
62
|
+
const seen = /* @__PURE__ */ new Set();
|
|
63
|
+
for (const rendition of pool) {
|
|
64
|
+
if (rendition.pathway !== active.pathway || seen.has(key(rendition))) continue;
|
|
65
|
+
seen.add(key(rendition));
|
|
66
|
+
ladder.push(rendition);
|
|
67
|
+
}
|
|
68
|
+
const at = ladder.findIndex((r) => key(r) === key(active));
|
|
69
|
+
if (at === -1) return [active];
|
|
70
|
+
return [
|
|
71
|
+
...at > 0 ? [ladder[at - 1]] : [],
|
|
72
|
+
active,
|
|
73
|
+
...at + 1 < ladder.length ? [ladder[at + 1]] : []
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
/** The group of an audio or text track, from the adapters' `group:name` id convention. */
|
|
77
|
+
function groupOf(trackId) {
|
|
78
|
+
const colon = trackId.indexOf(":");
|
|
79
|
+
return colon === -1 ? trackId : trackId.slice(0, colon);
|
|
80
|
+
}
|
|
81
|
+
/** Companion groups present, as `contentType:groupId`, for the coupling filter. */
|
|
82
|
+
function availableGroups(kernel) {
|
|
83
|
+
var _kernel$presentation$, _kernel$presentation;
|
|
84
|
+
const groups = /* @__PURE__ */ new Set();
|
|
85
|
+
for (const period of (_kernel$presentation$ = (_kernel$presentation = kernel.presentation) === null || _kernel$presentation === void 0 ? void 0 : _kernel$presentation.periods) !== null && _kernel$presentation$ !== void 0 ? _kernel$presentation$ : []) for (const track of period.tracks) if (track.contentType === "audio" || track.contentType === "text") groups.add(`${track.contentType}:${groupOf(track.id)}`);
|
|
86
|
+
return groups;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The renditions of the active tracks an adapter resolves ahead of need,
|
|
90
|
+
* content type by content type in `types` order: for video the ladder
|
|
91
|
+
* neighbours of `videoId`, for the others every rendition of the active
|
|
92
|
+
* track. A track id repeated across periods yields each period's copy.
|
|
93
|
+
* Renditions asked for with RESOLVE_RENDITION follow.
|
|
94
|
+
*/
|
|
95
|
+
function activeRenditions(kernel, types, videoId) {
|
|
96
|
+
var _kernel$tracks$resolv;
|
|
97
|
+
const out = [];
|
|
98
|
+
for (const contentType of types) {
|
|
99
|
+
var _kernel$presentation$2, _kernel$presentation2;
|
|
100
|
+
const trackId = kernel.tracks.active.get(contentType);
|
|
101
|
+
if (trackId === void 0) continue;
|
|
102
|
+
for (const period of (_kernel$presentation$2 = (_kernel$presentation2 = kernel.presentation) === null || _kernel$presentation2 === void 0 ? void 0 : _kernel$presentation2.periods) !== null && _kernel$presentation$2 !== void 0 ? _kernel$presentation$2 : []) for (const track of period.tracks) {
|
|
103
|
+
if (track.id !== trackId) continue;
|
|
104
|
+
const candidates = contentType === "video" ? ladderNeighbours(track.renditions, videoId, kernel.quality.constraints) : track.renditions;
|
|
105
|
+
for (const rendition of candidates) out.push({
|
|
106
|
+
contentType,
|
|
107
|
+
rendition
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
for (const id of (_kernel$tracks$resolv = kernel.tracks.resolve) !== null && _kernel$tracks$resolv !== void 0 ? _kernel$tracks$resolv : []) {
|
|
112
|
+
if (out.some((entry) => entry.rendition.id === id)) continue;
|
|
113
|
+
const site = findRendition(kernel.presentation, id);
|
|
114
|
+
if (site !== null) out.push({
|
|
115
|
+
contentType: site.track.contentType,
|
|
116
|
+
rendition: site.rendition
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* `dead` plus the video variants that require an audio group none of whose
|
|
123
|
+
* renditions is left. A variant names its audio by group, and the group
|
|
124
|
+
* carries the audio playlist and codec, so a group that cannot play takes
|
|
125
|
+
* its variants with it, the way videojs-http-streaming excludes them.
|
|
126
|
+
* Another track in the group (another language) keeps it alive.
|
|
127
|
+
*/
|
|
128
|
+
function withDeadGroups(presentation, dead) {
|
|
129
|
+
const out = new Set(dead);
|
|
130
|
+
const known = /* @__PURE__ */ new Set();
|
|
131
|
+
const alive = /* @__PURE__ */ new Set();
|
|
132
|
+
for (const period of presentation.periods) for (const track of period.tracks) {
|
|
133
|
+
if (track.contentType !== "audio") continue;
|
|
134
|
+
const group = groupOf(track.id);
|
|
135
|
+
known.add(group);
|
|
136
|
+
if (track.renditions.some((r) => !dead.has(r.id))) alive.add(group);
|
|
137
|
+
}
|
|
138
|
+
for (const { renditionId, requires } of presentation.couplings) if (requires.audio !== void 0 && known.has(requires.audio) && !alive.has(requires.audio)) out.add(renditionId);
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
/** The strict arbitration order. Never deviate; never return zero renditions. */
|
|
37
142
|
function arbitrate(ctx) {
|
|
38
143
|
const events = [];
|
|
39
144
|
if (ctx.renditions.length === 0) return {
|
|
@@ -202,7 +307,7 @@ function canSwitchTo(current, target) {
|
|
|
202
307
|
return "reload";
|
|
203
308
|
}
|
|
204
309
|
/**
|
|
205
|
-
* The apply strategies
|
|
310
|
+
* The apply strategies. `next` costs nothing and waits out
|
|
206
311
|
* the buffer. `soon` flushes from the next segment boundary after
|
|
207
312
|
* currentTime plus a lead, so the switch is usually invisible. `now` pays
|
|
208
313
|
* a visible stall for immediacy.
|
|
@@ -261,4 +366,4 @@ function planPinApply(input) {
|
|
|
261
366
|
};
|
|
262
367
|
}
|
|
263
368
|
//#endregion
|
|
264
|
-
export { arbitrate, canSwitchTo, codecFamily, createArbiter, planPinApply };
|
|
369
|
+
export { activeRenditions, arbitrate, availableGroups, canSwitchTo, codecFamily, createArbiter, groupOf, ladderNeighbours, planPinApply, withDeadGroups };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import { buildEpochs, epochForSeq, segmentAtTime, timestampOffsetFor } from "./timeline.js";
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import { buildEpochs, epochForSeq, epochKey, segmentAtTime, timestampOffsetFor } from "./timeline.js";
|
|
3
3
|
//#region src/kernel/scheduler.ts
|
|
4
4
|
const DEFAULT_GAP_TOLERANCE = .25;
|
|
5
5
|
/**
|
|
@@ -32,6 +32,12 @@ function coveringSegment(ranges, segment, tolerance) {
|
|
|
32
32
|
const tail = Math.max(mid, segment.start + segment.duration - tolerance);
|
|
33
33
|
return (_ranges$find = ranges.find((range) => range.start <= mid && range.end > mid || range.start <= tail && range.end >= tail)) !== null && _ranges$find !== void 0 ? _ranges$find : null;
|
|
34
34
|
}
|
|
35
|
+
/** Whether the track's buffer received `seq` of the track's rendition since the last seek. */
|
|
36
|
+
function received(track, seq) {
|
|
37
|
+
var _track$appended;
|
|
38
|
+
const id = track.rendition.id;
|
|
39
|
+
return ((_track$appended = track.appended) === null || _track$appended === void 0 ? void 0 : _track$appended.some((entry) => entry.seq === seq && entry.renditionId === id)) === true;
|
|
40
|
+
}
|
|
35
41
|
function schedule(input) {
|
|
36
42
|
var _input$gapToleranceSe;
|
|
37
43
|
const tolerance = (_input$gapToleranceSe = input.gapToleranceSeconds) !== null && _input$gapToleranceSe !== void 0 ? _input$gapToleranceSe : DEFAULT_GAP_TOLERANCE;
|
|
@@ -39,6 +45,7 @@ function schedule(input) {
|
|
|
39
45
|
const requests = [];
|
|
40
46
|
let tokenSeq = input.tokenSeq;
|
|
41
47
|
for (const track of input.tracks) {
|
|
48
|
+
var _input$reconciled;
|
|
42
49
|
if (track.inflight.length > 0) continue;
|
|
43
50
|
const bufferedEnd = bufferedEndFrom(track.ranges, input.currentTime, tolerance);
|
|
44
51
|
if (bufferedEnd - input.currentTime >= input.bufferGoal) continue;
|
|
@@ -47,7 +54,16 @@ function schedule(input) {
|
|
|
47
54
|
let segment = segmentAtTime(track.rendition.segments, target + tolerance, track.period.start);
|
|
48
55
|
let frontier = bufferedEnd;
|
|
49
56
|
while (segment !== null) {
|
|
50
|
-
|
|
57
|
+
let covering = coveringSegment(track.ranges, segment, tolerance);
|
|
58
|
+
if (covering === null && received(track, segment.seq)) {
|
|
59
|
+
var _left$end;
|
|
60
|
+
const { start, duration } = segment;
|
|
61
|
+
const left = track.ranges.find((range) => range.start >= start && range.start < start + duration);
|
|
62
|
+
covering = {
|
|
63
|
+
start,
|
|
64
|
+
end: (_left$end = left === null || left === void 0 ? void 0 : left.end) !== null && _left$end !== void 0 ? _left$end : start + duration
|
|
65
|
+
};
|
|
66
|
+
}
|
|
51
67
|
if (covering === null) break;
|
|
52
68
|
frontier = Math.max(frontier, covering.end);
|
|
53
69
|
if (frontier - input.currentTime >= input.bufferGoal) {
|
|
@@ -63,6 +79,8 @@ function schedule(input) {
|
|
|
63
79
|
rendition: track.rendition
|
|
64
80
|
}]);
|
|
65
81
|
const epoch = epochForSeq(epochs, segment.seq);
|
|
82
|
+
const key = epoch === null ? void 0 : epochKey(epochs, epoch);
|
|
83
|
+
if (input.reconciles === true && key !== void 0 && track.sbId !== void 0 && track.sbId !== input.leadSbId && ((_input$reconciled = input.reconciled) === null || _input$reconciled === void 0 ? void 0 : _input$reconciled.has(key)) !== true && (input.leadPending === true || requests.some((r) => r.sbId === input.leadSbId))) continue;
|
|
66
84
|
tokenSeq += 1;
|
|
67
85
|
const token = `t${tokenSeq}:${track.trackId}:${segment.seq}`;
|
|
68
86
|
effects.push(_objectSpread2({
|
|
@@ -70,7 +88,7 @@ function schedule(input) {
|
|
|
70
88
|
token,
|
|
71
89
|
url: segment.url
|
|
72
90
|
}, segment.byteRange !== void 0 ? { range: segment.byteRange } : {}));
|
|
73
|
-
requests.push(_objectSpread2(_objectSpread2({
|
|
91
|
+
requests.push(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
74
92
|
token,
|
|
75
93
|
trackId: track.trackId,
|
|
76
94
|
seq: segment.seq,
|
|
@@ -78,7 +96,7 @@ function schedule(input) {
|
|
|
78
96
|
renditionId: track.rendition.id,
|
|
79
97
|
segmentStart: segment.start,
|
|
80
98
|
segmentDuration: segment.duration
|
|
81
|
-
}, track.sbId !== void 0 ? { sbId: track.sbId } : {}),
|
|
99
|
+
}, track.sbId !== void 0 ? { sbId: track.sbId } : {}), epoch !== null ? { timestampOffset: timestampOffsetFor(epoch) } : {}), key !== void 0 ? { epoch: key } : {}));
|
|
82
100
|
}
|
|
83
101
|
return {
|
|
84
102
|
effects,
|
|
@@ -35,35 +35,36 @@ function mergeRange(coverage, added) {
|
|
|
35
35
|
merged.push(pending);
|
|
36
36
|
return merged.sort((a, b) => a.start - b.start);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/** Empties a native track. `cues` reads null while disabled; hidden makes them removable. */
|
|
47
|
-
function empty(textTrack) {
|
|
48
|
-
textTrack.mode = "hidden";
|
|
49
|
-
const { cues } = textTrack;
|
|
50
|
-
if (cues !== null) for (let i = cues.length - 1; i >= 0; i -= 1) {
|
|
51
|
-
const cue = cues[i];
|
|
52
|
-
if (cue !== void 0) textTrack.removeCue(cue);
|
|
53
|
-
}
|
|
38
|
+
/** Empties a native track. `cues` reads null while disabled; hidden makes them removable. */
|
|
39
|
+
function emptyTextTrack(textTrack) {
|
|
40
|
+
textTrack.mode = "hidden";
|
|
41
|
+
const { cues } = textTrack;
|
|
42
|
+
if (cues === null) return;
|
|
43
|
+
for (let i = cues.length - 1; i >= 0; i -= 1) {
|
|
44
|
+
const cue = cues[i];
|
|
45
|
+
if (cue !== void 0) textTrack.removeCue(cue);
|
|
54
46
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A native track of this kind and label on the element, emptied, or a new
|
|
50
|
+
* one. The element has no removeTextTrack, so a previous attach on the same
|
|
51
|
+
* element (a rebuild, an element swap back) leaves its tracks behind;
|
|
52
|
+
* adopting one keeps the browser's caption menu free of duplicates.
|
|
53
|
+
*/
|
|
54
|
+
function adoptTextTrack(element, kind, label, lang) {
|
|
55
|
+
for (const existing of element.textTracks) {
|
|
56
|
+
if (existing.kind !== kind || existing.label !== label) continue;
|
|
57
|
+
emptyTextTrack(existing);
|
|
58
|
+
return existing;
|
|
62
59
|
}
|
|
60
|
+
return element.addTextTrack(kind, label, lang);
|
|
61
|
+
}
|
|
62
|
+
function createCueSink(contentType, kind, deps) {
|
|
63
|
+
const tracks = /* @__PURE__ */ new Map();
|
|
63
64
|
function retire(trackId) {
|
|
64
65
|
const entry = tracks.get(trackId);
|
|
65
66
|
if (entry === void 0) return;
|
|
66
|
-
|
|
67
|
+
emptyTextTrack(entry.textTrack);
|
|
67
68
|
entry.textTrack.mode = "disabled";
|
|
68
69
|
tracks.delete(trackId);
|
|
69
70
|
}
|
|
@@ -71,7 +72,7 @@ function createCueSink(contentType, kind, deps) {
|
|
|
71
72
|
let entry = tracks.get(trackId);
|
|
72
73
|
if (entry === void 0) {
|
|
73
74
|
var _deps$label;
|
|
74
|
-
const textTrack =
|
|
75
|
+
const textTrack = adoptTextTrack(deps.element, kind, `${(_deps$label = deps.label) !== null && _deps$label !== void 0 ? _deps$label : "mattebox"}:${trackId}`);
|
|
75
76
|
textTrack.mode = "hidden";
|
|
76
77
|
entry = {
|
|
77
78
|
textTrack,
|
|
@@ -164,4 +165,4 @@ function createTextTrackSink(deps) {
|
|
|
164
165
|
return createCueSink("text", "subtitles", deps);
|
|
165
166
|
}
|
|
166
167
|
//#endregion
|
|
167
|
-
export { createCueSink, createTextTrackSink };
|
|
168
|
+
export { adoptTextTrack, createCueSink, createTextTrackSink, emptyTextTrack };
|
|
@@ -55,6 +55,27 @@ function epochForSeq(epochs, seq) {
|
|
|
55
55
|
function timestampOffsetFor(epoch) {
|
|
56
56
|
return epoch.presentationStart - epoch.mediaStart;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* The name every track of a period shares for one epoch: the period alone
|
|
60
|
+
* for the epoch that opens it, the period and the discontinuity's
|
|
61
|
+
* presentation start after that. Sequence numbers are no part of it,
|
|
62
|
+
* because each rendition numbers its own playlist (RFC 8216 §6.2.2 aligns
|
|
63
|
+
* discontinuities across renditions in time, not in sequence). The start
|
|
64
|
+
* is rounded to the second, since each playlist sums its own durations.
|
|
65
|
+
*/
|
|
66
|
+
function epochKey(epochs, epoch) {
|
|
67
|
+
return epochs[0] === epoch ? epoch.periodId : `${epoch.periodId}:${Math.round(epoch.presentationStart)}`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The timestampOffset that lands a segment at its presentation start,
|
|
71
|
+
* given the decode time its bytes report. Manifests promise timing; the
|
|
72
|
+
* bytes tell the truth, so this replaces the epoch prediction the moment
|
|
73
|
+
* a segment lands. Same arithmetic as videojs-http-streaming's segment
|
|
74
|
+
* loader, which subtracts the probed start from the segment's start.
|
|
75
|
+
*/
|
|
76
|
+
function reconciledOffset(segmentStart, mediaStart) {
|
|
77
|
+
return segmentStart - mediaStart;
|
|
78
|
+
}
|
|
58
79
|
/** Materializes one segment from an indexed form. Null outside the window. */
|
|
59
80
|
function segmentAt(addressing, seq, periodStart = 0) {
|
|
60
81
|
var _addressing$presentat2;
|
|
@@ -124,4 +145,4 @@ function segmentAtTime(addressing, time, periodStart = 0) {
|
|
|
124
145
|
return null;
|
|
125
146
|
}
|
|
126
147
|
//#endregion
|
|
127
|
-
export { buildEpochs, epochForSeq, segmentAt, segmentAtTime, timestampOffsetFor };
|
|
148
|
+
export { buildEpochs, epochForSeq, epochKey, isIndexed, isUnresolved, reconciledOffset, segmentAt, segmentAtTime, timestampOffsetFor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
function isBytes(value) {
|
|
3
3
|
return value instanceof ArrayBuffer || ArrayBuffer.isView(value);
|
|
4
4
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { findTrackSite, isTrick } from "./presentation.js";
|
|
1
2
|
//#region src/kernel/track-registry.ts
|
|
2
3
|
function allTracks(state) {
|
|
3
4
|
if (state.presentation === null) return [];
|
|
@@ -5,8 +6,8 @@ function allTracks(state) {
|
|
|
5
6
|
}
|
|
6
7
|
function createTrackRegistry(deps) {
|
|
7
8
|
function find(trackId) {
|
|
8
|
-
var
|
|
9
|
-
return (
|
|
9
|
+
var _findTrackSite$track, _findTrackSite;
|
|
10
|
+
return (_findTrackSite$track = (_findTrackSite = findTrackSite(deps.getState().presentation, trackId)) === null || _findTrackSite === void 0 ? void 0 : _findTrackSite.track) !== null && _findTrackSite$track !== void 0 ? _findTrackSite$track : null;
|
|
10
11
|
}
|
|
11
12
|
return {
|
|
12
13
|
get available() {
|
|
@@ -23,6 +24,13 @@ function createTrackRegistry(deps) {
|
|
|
23
24
|
},
|
|
24
25
|
select(trackId) {
|
|
25
26
|
const track = find(trackId);
|
|
27
|
+
if (track !== null && isTrick(track)) {
|
|
28
|
+
deps.emitEvent("command:rejected", {
|
|
29
|
+
command: "SELECT_TRACK",
|
|
30
|
+
reason: `trick track: ${trackId}`
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
26
34
|
if (track !== null && !deps.hasSink(track.contentType)) {
|
|
27
35
|
deps.emitEvent("command:rejected", {
|
|
28
36
|
command: "SELECT_TRACK",
|
|
@@ -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.150.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _asyncToGenerator from "../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/asyncToGenerator.js";
|
|
3
3
|
//#region src/kernel/transport.ts
|
|
4
4
|
const DEFAULT_RETRY_POLICY = {
|
|
5
5
|
maxAttempts: 3,
|
|
@@ -196,12 +196,12 @@ function createTransport(options) {
|
|
|
196
196
|
registerHandlers(runner) {
|
|
197
197
|
runner.register("fetch", (effect) => {
|
|
198
198
|
var _options$inflight;
|
|
199
|
-
const request = (_options$inflight = options.inflight(effect.token)) !== null && _options$inflight !== void 0 ? _options$inflight : {
|
|
199
|
+
const request = (_options$inflight = options.inflight(effect.token)) !== null && _options$inflight !== void 0 ? _options$inflight : _objectSpread2({
|
|
200
200
|
token: effect.token,
|
|
201
201
|
trackId: effect.token,
|
|
202
202
|
seq: -1,
|
|
203
203
|
url: effect.url
|
|
204
|
-
};
|
|
204
|
+
}, effect.renditionId !== void 0 ? { renditionId: effect.renditionId } : {});
|
|
205
205
|
attempt(effect.token, request, effect.url, effect.range, effect.timeout, 1);
|
|
206
206
|
return () => cancel(effect.token);
|
|
207
207
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/kernel/url.ts
|
|
2
|
+
/** URL resolution shared by the manifest parsers and the stages that read files. */
|
|
3
|
+
/** A URI made absolute against the document that carried it; an unparsable one stays as written. */
|
|
4
|
+
function resolveUrl(uri, baseUrl) {
|
|
5
|
+
try {
|
|
6
|
+
return new URL(uri, baseUrl).href;
|
|
7
|
+
} catch (_unused) {
|
|
8
|
+
return uri;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { resolveUrl };
|
|
@@ -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.150.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/objectWithoutProperties.js";
|
|
3
3
|
import { mattebox } from "../index.js";
|
|
4
4
|
//#region src/presets/define.ts
|
|
5
5
|
const _excluded = ["stages", "without"];
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import trickPlay from "../../stages/trick-play/index.js";
|
|
1
2
|
import thumbnails from "../../stages/thumbnails/index.js";
|
|
2
3
|
import cmcd from "../../stages/cmcd/index.js";
|
|
4
|
+
import chapters from "../../stages/chapters/index.js";
|
|
3
5
|
import { definePreset } from "../define.js";
|
|
4
6
|
import { base, dashLine, drmTier, hlsLine, tsTier } from "../tiers.js";
|
|
5
7
|
//#region src/presets/full/index.ts
|
|
6
8
|
/**
|
|
7
9
|
* The `full` preset: every stage the catalogue ships. `dual-ts-drm` plus
|
|
8
|
-
* the accessories: CMCD (changes every request, so opt-in elsewhere)
|
|
9
|
-
* thumbnails (
|
|
10
|
+
* the accessories: CMCD (changes every request, so opt-in elsewhere),
|
|
11
|
+
* thumbnails (fetches image playlists, so opt-in elsewhere), chapters
|
|
12
|
+
* (loads a file the app names), and trick play (a UI control drives it).
|
|
13
|
+
* Feature parity with
|
|
10
14
|
* videojs-http-streaming; the modularity claim is measured against it, and
|
|
11
15
|
* the main CDN bundle exposes it.
|
|
12
16
|
*/
|
|
@@ -17,7 +21,9 @@ const preset = definePreset("full", () => [
|
|
|
17
21
|
...tsTier(),
|
|
18
22
|
...drmTier(),
|
|
19
23
|
cmcd(),
|
|
20
|
-
thumbnails()
|
|
24
|
+
thumbnails(),
|
|
25
|
+
chapters(),
|
|
26
|
+
trickPlay()
|
|
21
27
|
]);
|
|
22
28
|
//#endregion
|
|
23
29
|
export { preset as default };
|
|
@@ -50,12 +50,13 @@ function dashLine() {
|
|
|
50
50
|
/**
|
|
51
51
|
* What every preset carries: adaptive quality with a size cap and bandwidth
|
|
52
52
|
* memory, recovery, content steering (inert until a manifest asks for it),
|
|
53
|
-
* alternate audio with codec switching, WebVTT subtitles, CMAF
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* probe (types a SourceBuffer whose playlist
|
|
57
|
-
* otherwise refuses), and CEA-608 captions
|
|
58
|
-
* costs per NAL unit, not per byte, and
|
|
53
|
+
* alternate audio with codec switching, WebVTT subtitles, CMAF timing (reads
|
|
54
|
+
* each segment's decode time so the kernel lands it at its playlist time,
|
|
55
|
+
* whatever clock the packager wrote), program date time from either
|
|
56
|
+
* protocol's anchor, the codec probe (types a SourceBuffer whose playlist
|
|
57
|
+
* declares no codecs, which Chrome otherwise refuses), and CEA-608 captions
|
|
58
|
+
* from fMP4 video. The caption scan costs per NAL unit, not per byte, and
|
|
59
|
+
* only when a segment has H.264 or HEVC.
|
|
59
60
|
*/
|
|
60
61
|
function base() {
|
|
61
62
|
return [
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/protocols/adapter-shared.ts
|
|
2
|
+
function manifestError(reason) {
|
|
3
|
+
return {
|
|
4
|
+
category: "manifest",
|
|
5
|
+
code: "MANIFEST_PARSE_FAILED",
|
|
6
|
+
fatal: true,
|
|
7
|
+
recoverable: false,
|
|
8
|
+
context: { reason }
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The fact for fetched manifest bytes, or null when this adapter does not
|
|
13
|
+
* claim them. Declining emits nothing; the kernel reports bytes nobody claims.
|
|
14
|
+
*/
|
|
15
|
+
function manifestFact(bytes, url, claims, parse) {
|
|
16
|
+
const text = new TextDecoder().decode(bytes);
|
|
17
|
+
if (!claims(text)) return null;
|
|
18
|
+
const result = parse(text, url);
|
|
19
|
+
return result.presentation === null ? {
|
|
20
|
+
type: "MANIFEST_FAILED",
|
|
21
|
+
error: result.error
|
|
22
|
+
} : {
|
|
23
|
+
type: "MANIFEST_LOADED",
|
|
24
|
+
presentation: result.presentation
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { manifestError, manifestFact };
|