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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "
|
|
2
|
-
//#region src/
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
//#region src/containers/webvtt.ts
|
|
3
3
|
/** `HH:MM:SS.mmm` or `MM:SS.mmm` to seconds, or null. */
|
|
4
4
|
function parseTimestamp(text) {
|
|
5
5
|
const match = /^(?:(\d+):)?([0-5]\d):([0-5]\d)\.(\d{3})$/.exec(text.trim());
|
package/dist/es2015/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
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
|
import { exportTrace, replay } from "./kernel/trace.js";
|
|
3
3
|
import { createBus } from "./kernel/bus.js";
|
|
4
4
|
import { createEffectRunner } from "./kernel/effects.js";
|
|
5
5
|
import { normalizeMimeType } from "./kernel/mime.js";
|
|
6
|
-
import {
|
|
6
|
+
import { findTrackSite, isTrick } from "./kernel/presentation.js";
|
|
7
|
+
import { availableGroups, canSwitchTo, createArbiter } from "./kernel/rendition-select.js";
|
|
7
8
|
import { createMseSink } from "./kernel/sinks/mse-sink.js";
|
|
8
9
|
import { createReducer, initialState, resolveConfig } from "./kernel/reducer.js";
|
|
9
10
|
import { createLifecycle } from "./kernel/lifecycle.js";
|
|
10
11
|
import { compose } from "./kernel/loader.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
12
|
+
import { createMseController, decodable } from "./kernel/mse.js";
|
|
13
|
+
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/asyncToGenerator.js";
|
|
14
|
+
import { createSegmentPreparer } from "./kernel/prepare.js";
|
|
13
15
|
import { createTrackRegistry } from "./kernel/track-registry.js";
|
|
14
16
|
import { createTransport } from "./kernel/transport.js";
|
|
15
17
|
//#region src/index.ts
|
|
@@ -22,9 +24,9 @@ import { createTransport } from "./kernel/transport.js";
|
|
|
22
24
|
const registry = /* @__PURE__ */ new WeakMap();
|
|
23
25
|
/** Creates an engine. The element is supplied later via `attach`. */
|
|
24
26
|
function mattebox(options) {
|
|
25
|
-
var _options$stages, _options$
|
|
27
|
+
var _options$stages, _options$transport, _options$transport2, _options$transport$re, _options$transport3, _options$transport$re2, _options$transport4;
|
|
26
28
|
const composition = compose((_options$stages = options.stages) !== null && _options$stages !== void 0 ? _options$stages : []);
|
|
27
|
-
const config = _objectSpread2(
|
|
29
|
+
const config = _objectSpread2({}, options.config);
|
|
28
30
|
const cfg = resolveConfig(config);
|
|
29
31
|
const bus = createBus({
|
|
30
32
|
reducer: createReducer([], config),
|
|
@@ -33,27 +35,26 @@ function mattebox(options) {
|
|
|
33
35
|
});
|
|
34
36
|
const runner = createEffectRunner({ onEvent: (event, payload) => bus.emitEvent(event, payload) });
|
|
35
37
|
bus.setEffectSink((effects) => runner.run(effects));
|
|
36
|
-
const
|
|
37
|
-
const mse = createMseController(_objectSpread2({
|
|
38
|
+
const mse = createMseController({
|
|
38
39
|
absorb: (fact) => bus.absorb(fact),
|
|
39
40
|
backBufferSeconds: cfg.backBufferSeconds,
|
|
40
41
|
inferType: (bytes) => {
|
|
41
42
|
var _hooks$typeProbe, _hooks$typeProbe2;
|
|
42
43
|
return (_hooks$typeProbe = (_hooks$typeProbe2 = hooks.typeProbe) === null || _hooks$typeProbe2 === void 0 ? void 0 : _hooks$typeProbe2.call(hooks, bytes)) !== null && _hooks$typeProbe !== void 0 ? _hooks$typeProbe : null;
|
|
43
44
|
}
|
|
44
|
-
}
|
|
45
|
-
var _ref = _asyncToGenerator(function* (data, meta) {
|
|
46
|
-
let out = data;
|
|
47
|
-
for (const step of bus.transforms()) out = new Uint8Array(yield step.transform(out, meta));
|
|
48
|
-
return out;
|
|
49
|
-
});
|
|
50
|
-
return function appendTransform(_x, _x2) {
|
|
51
|
-
return _ref.apply(this, arguments);
|
|
52
|
-
};
|
|
53
|
-
}() } : {}));
|
|
45
|
+
});
|
|
54
46
|
mse.registerHandlers(runner);
|
|
47
|
+
const prepare = createSegmentPreparer({
|
|
48
|
+
transforms: () => bus.transforms(),
|
|
49
|
+
timeProbe: () => {
|
|
50
|
+
var _hooks$timeProbe;
|
|
51
|
+
return (_hooks$timeProbe = hooks.timeProbe) !== null && _hooks$timeProbe !== void 0 ? _hooks$timeProbe : null;
|
|
52
|
+
},
|
|
53
|
+
inflight: (token) => bus.getState().scheduling.inflight.get(token),
|
|
54
|
+
absorb: (fact) => bus.absorb(fact)
|
|
55
|
+
});
|
|
55
56
|
const transport = createTransport(_objectSpread2(_objectSpread2({
|
|
56
|
-
absorb:
|
|
57
|
+
absorb: prepare,
|
|
57
58
|
inflight: (token) => bus.getState().scheduling.inflight.get(token),
|
|
58
59
|
acceptManifestType: (contentType) => {
|
|
59
60
|
const type = normalizeMimeType(contentType);
|
|
@@ -91,9 +92,8 @@ function mattebox(options) {
|
|
|
91
92
|
return sink;
|
|
92
93
|
}
|
|
93
94
|
function contentTypeOfTrack(trackId) {
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
return null;
|
|
95
|
+
var _findTrackSite$track$, _findTrackSite;
|
|
96
|
+
return (_findTrackSite$track$ = (_findTrackSite = findTrackSite(bus.getState().presentation, trackId)) === null || _findTrackSite === void 0 ? void 0 : _findTrackSite.track.contentType) !== null && _findTrackSite$track$ !== void 0 ? _findTrackSite$track$ : null;
|
|
97
97
|
}
|
|
98
98
|
runner.register("emitCues", (effect) => {
|
|
99
99
|
var _cueSinkFor;
|
|
@@ -138,7 +138,10 @@ function mattebox(options) {
|
|
|
138
138
|
hasSink: (contentType) => bus.sinkFor(contentType) !== void 0
|
|
139
139
|
});
|
|
140
140
|
const arbiter = createArbiter();
|
|
141
|
-
const hooks = {
|
|
141
|
+
const hooks = {
|
|
142
|
+
manifestTypes: composition.manifestTypes,
|
|
143
|
+
decodable
|
|
144
|
+
};
|
|
142
145
|
let lastError = null;
|
|
143
146
|
function accepts(mimeType) {
|
|
144
147
|
return composition.manifestTypes.has(normalizeMimeType(mimeType));
|
|
@@ -148,7 +151,7 @@ function mattebox(options) {
|
|
|
148
151
|
if (state.presentation === null) return [];
|
|
149
152
|
const activeId = state.tracks.active.get("video");
|
|
150
153
|
for (const period of state.presentation.periods) for (const track of period.tracks) {
|
|
151
|
-
if (track.contentType !== "video") continue;
|
|
154
|
+
if (track.contentType !== "video" || isTrick(track)) continue;
|
|
152
155
|
if (activeId === void 0 || track.id === activeId) return track.renditions;
|
|
153
156
|
}
|
|
154
157
|
return [];
|
|
@@ -163,16 +166,7 @@ function mattebox(options) {
|
|
|
163
166
|
current: state.quality.active,
|
|
164
167
|
couplings: (_state$presentation$c = (_state$presentation = state.presentation) === null || _state$presentation === void 0 ? void 0 : _state$presentation.couplings) !== null && _state$presentation$c !== void 0 ? _state$presentation$c : [],
|
|
165
168
|
activeTracks: state.tracks.active,
|
|
166
|
-
availableGroups: (
|
|
167
|
-
var _state$presentation$p, _state$presentation2;
|
|
168
|
-
const groups = /* @__PURE__ */ new Set();
|
|
169
|
-
for (const period of (_state$presentation$p = (_state$presentation2 = state.presentation) === null || _state$presentation2 === void 0 ? void 0 : _state$presentation2.periods) !== null && _state$presentation$p !== void 0 ? _state$presentation$p : []) for (const track of period.tracks) {
|
|
170
|
-
if (track.contentType !== "audio" && track.contentType !== "text") continue;
|
|
171
|
-
const colon = track.id.indexOf(":");
|
|
172
|
-
groups.add(`${track.contentType}:${colon === -1 ? track.id : track.id.slice(0, colon)}`);
|
|
173
|
-
}
|
|
174
|
-
return groups;
|
|
175
|
-
})(),
|
|
169
|
+
availableGroups: availableGroups(state),
|
|
176
170
|
telemetry: {
|
|
177
171
|
throughputEwma: state.stats.throughputEwma,
|
|
178
172
|
throughputFastEwma: state.stats.throughputFastEwma,
|
|
@@ -193,14 +187,17 @@ function mattebox(options) {
|
|
|
193
187
|
var _el$error$code, _el$error, _MEDIA_ERR$code, _el$error$message, _el$error2;
|
|
194
188
|
const code = (_el$error$code = (_el$error = el.error) === null || _el$error === void 0 ? void 0 : _el$error.code) !== null && _el$error$code !== void 0 ? _el$error$code : 0;
|
|
195
189
|
if (code === 1 || lastError !== null) return;
|
|
196
|
-
bus.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
190
|
+
bus.absorb({
|
|
191
|
+
type: "MEDIA_ERROR",
|
|
192
|
+
error: {
|
|
193
|
+
category: "media",
|
|
194
|
+
code: code === 4 ? "MEDIA_CODEC_UNSUPPORTED" : "MEDIA_DECODE_ERROR",
|
|
195
|
+
fatal: true,
|
|
196
|
+
recoverable: false,
|
|
197
|
+
context: {
|
|
198
|
+
mediaError: (_MEDIA_ERR$code = MEDIA_ERR[code]) !== null && _MEDIA_ERR$code !== void 0 ? _MEDIA_ERR$code : String(code),
|
|
199
|
+
message: (_el$error$message = (_el$error2 = el.error) === null || _el$error2 === void 0 ? void 0 : _el$error2.message) !== null && _el$error$message !== void 0 ? _el$error$message : ""
|
|
200
|
+
}
|
|
204
201
|
}
|
|
205
202
|
});
|
|
206
203
|
}
|
|
@@ -328,6 +325,7 @@ function mattebox(options) {
|
|
|
328
325
|
recoverable: (_summary$recoverable = summary.recoverable) !== null && _summary$recoverable !== void 0 ? _summary$recoverable : false,
|
|
329
326
|
trace: bus.trace()
|
|
330
327
|
};
|
|
328
|
+
if (bus.getState().lifecycle.phase === "error") runner.cancelAll();
|
|
331
329
|
}
|
|
332
330
|
});
|
|
333
331
|
Object.defineProperties(facadeTarget, Object.getOwnPropertyDescriptors(base));
|
|
@@ -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
|
//#region src/kernel/append-queue.ts
|
|
3
3
|
function isQuotaError(err) {
|
|
4
4
|
return err instanceof DOMException && err.name === "QuotaExceededError";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/kernel/base64.ts
|
|
2
|
+
/**
|
|
3
|
+
* Base64 (RFC 4648 §4) and base64url (§5) over bytes, for manifest pssh
|
|
4
|
+
* boxes and license bodies. One copy for the manifest parsers and the DRM stages.
|
|
5
|
+
*/
|
|
6
|
+
/** Base64 text into bytes, whitespace ignored; null when it is not base64. */
|
|
7
|
+
function base64ToBytes(text) {
|
|
8
|
+
try {
|
|
9
|
+
const binary = atob(text.replace(/\s+/g, ""));
|
|
10
|
+
const bytes = new Uint8Array(binary.length);
|
|
11
|
+
for (let i = 0; i < binary.length; i += 1) bytes[i] = binary.charCodeAt(i);
|
|
12
|
+
return bytes;
|
|
13
|
+
} catch (_unused) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Bytes into base64, or into unpadded base64url when `url` is set. */
|
|
18
|
+
function bytesToBase64(bytes, url = false) {
|
|
19
|
+
let binary = "";
|
|
20
|
+
for (const b of bytes) binary += String.fromCharCode(b);
|
|
21
|
+
const text = btoa(binary);
|
|
22
|
+
return url ? text.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "") : text;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { base64ToBytes, bytesToBase64 };
|
|
@@ -12,6 +12,7 @@ function createStageContext(deps) {
|
|
|
12
12
|
let registeredChooser = false;
|
|
13
13
|
let registeredPolicy = false;
|
|
14
14
|
let registeredProbe = false;
|
|
15
|
+
let registeredTimeProbe = false;
|
|
15
16
|
return {
|
|
16
17
|
ctx: {
|
|
17
18
|
element: deps.element,
|
|
@@ -58,6 +59,11 @@ function createStageContext(deps) {
|
|
|
58
59
|
deps.hooks.typeProbe = probe;
|
|
59
60
|
registeredProbe = true;
|
|
60
61
|
},
|
|
62
|
+
registerTimeProbe(probe) {
|
|
63
|
+
if (deps.hooks.timeProbe != null) throw new Error("a time probe is already registered");
|
|
64
|
+
deps.hooks.timeProbe = probe;
|
|
65
|
+
registeredTimeProbe = true;
|
|
66
|
+
},
|
|
61
67
|
reduce(slice, reducer) {
|
|
62
68
|
deps.slices.push([slice, reducer]);
|
|
63
69
|
},
|
|
@@ -85,6 +91,7 @@ function createStageContext(deps) {
|
|
|
85
91
|
if (registeredChooser) deps.hooks.abr = null;
|
|
86
92
|
if (registeredPolicy) deps.hooks.switchPolicy = null;
|
|
87
93
|
if (registeredProbe) deps.hooks.typeProbe = null;
|
|
94
|
+
if (registeredTimeProbe) deps.hooks.timeProbe = null;
|
|
88
95
|
}
|
|
89
96
|
};
|
|
90
97
|
}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
//#region src/kernel/effects.ts
|
|
2
|
+
/**
|
|
3
|
+
* A schedule effect: `then` re-enters the bus after `delayMs`, or at once.
|
|
4
|
+
* The token names the timer, so an abort under it cancels the timer; each
|
|
5
|
+
* caller keeps its own token.
|
|
6
|
+
*/
|
|
7
|
+
function scheduled(token, then, delayMs = 0) {
|
|
8
|
+
return {
|
|
9
|
+
kind: "schedule",
|
|
10
|
+
token,
|
|
11
|
+
delayMs,
|
|
12
|
+
then
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** A TICK under `token` after `delayMs`; the slice that owns the token matches it. */
|
|
16
|
+
function tickAfter(token, delayMs) {
|
|
17
|
+
return scheduled(token, {
|
|
18
|
+
type: "TICK",
|
|
19
|
+
token
|
|
20
|
+
}, delayMs);
|
|
21
|
+
}
|
|
2
22
|
function createEffectRunner(options = {}) {
|
|
3
23
|
var _options$onEvent;
|
|
4
24
|
const onEvent = (_options$onEvent = options.onEvent) !== null && _options$onEvent !== void 0 ? _options$onEvent : (() => void 0);
|
|
@@ -59,4 +79,4 @@ function createEffectRunner(options = {}) {
|
|
|
59
79
|
};
|
|
60
80
|
}
|
|
61
81
|
//#endregion
|
|
62
|
-
export { createEffectRunner };
|
|
82
|
+
export { createEffectRunner, scheduled, tickAfter };
|
|
@@ -26,11 +26,12 @@ function capabilityKey(capability) {
|
|
|
26
26
|
/**
|
|
27
27
|
* Capabilities that name a shared trait rather than a singleton service, so
|
|
28
28
|
* more than one stage may provide them without conflict. `media-transform`
|
|
29
|
-
* is the marker
|
|
30
|
-
* carries
|
|
31
|
-
*
|
|
29
|
+
* is the marker a byte-rewriting container (aes-128, ts-transmux,
|
|
30
|
+
* packed-audio) carries; several coexist by design. The kernel routes
|
|
31
|
+
* media bytes through whatever transforms are registered, so the marker
|
|
32
|
+
* documents the composition rather than switching a path.
|
|
32
33
|
*/
|
|
33
|
-
const SHARED_CAPABILITIES = /* @__PURE__ */ new Set(["media-transform"
|
|
34
|
+
const SHARED_CAPABILITIES = /* @__PURE__ */ new Set(["media-transform"]);
|
|
34
35
|
/** Validates and orders a stage set. Throws on any composition error. */
|
|
35
36
|
function compose(stages) {
|
|
36
37
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -12,9 +12,13 @@ function normalizeMimeType(value) {
|
|
|
12
12
|
const semicolon = value.indexOf(";");
|
|
13
13
|
return (semicolon === -1 ? value : value.slice(0, semicolon)).trim().toLowerCase();
|
|
14
14
|
}
|
|
15
|
+
/** The full MSE type for a MIME type and its codecs: `video/mp4; codecs="avc1.42c01e"`, or the bare MIME type. */
|
|
16
|
+
function typeString(mimeType, codecs) {
|
|
17
|
+
return codecs === null ? mimeType : `${mimeType}; codecs="${codecs}"`;
|
|
18
|
+
}
|
|
15
19
|
/** True for a capability string that names a manifest format: a MIME type, the only capability strings containing '/'. */
|
|
16
20
|
function isManifestType(capability) {
|
|
17
21
|
return capability.includes("/");
|
|
18
22
|
}
|
|
19
23
|
//#endregion
|
|
20
|
-
export { isManifestType, normalizeMimeType };
|
|
24
|
+
export { isManifestType, normalizeMimeType, typeString };
|
|
@@ -1,21 +1,18 @@
|
|
|
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
|
import { createAppendQueue } from "./append-queue.js";
|
|
3
3
|
import { createEvictor } from "./evictor.js";
|
|
4
|
-
import _asyncToGenerator from "../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/asyncToGenerator.js";
|
|
5
4
|
//#region src/kernel/mse.ts
|
|
6
5
|
function managedMediaSource() {
|
|
7
6
|
return globalThis.ManagedMediaSource;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isInit: seq < 0
|
|
18
|
-
};
|
|
8
|
+
/**
|
|
9
|
+
* Whether the MediaSource this module opens accepts a full MSE type. Without
|
|
10
|
+
* MSE (a worker, a test) every type counts as decodable: nothing is filtered.
|
|
11
|
+
*/
|
|
12
|
+
function decodable(type) {
|
|
13
|
+
var _managedMediaSource;
|
|
14
|
+
const ctor = (_managedMediaSource = managedMediaSource()) !== null && _managedMediaSource !== void 0 ? _managedMediaSource : globalThis.MediaSource;
|
|
15
|
+
return ctor === void 0 ? true : ctor.isTypeSupported(type);
|
|
19
16
|
}
|
|
20
17
|
/** Whether a SourceBuffer type names its codecs; a bare `video/mp4` does not. */
|
|
21
18
|
function declaresCodecs(type) {
|
|
@@ -34,7 +31,6 @@ function createMseController(options) {
|
|
|
34
31
|
let mediaSource = null;
|
|
35
32
|
let managed = false;
|
|
36
33
|
const buffers = /* @__PURE__ */ new Map();
|
|
37
|
-
const appendChains = /* @__PURE__ */ new Map();
|
|
38
34
|
/** Buffers requested without codecs, waiting for their first bytes to be typed. */
|
|
39
35
|
const deferred = /* @__PURE__ */ new Map();
|
|
40
36
|
/** Appends that arrived while their buffer's create was still pending. */
|
|
@@ -239,7 +235,6 @@ function createMseController(options) {
|
|
|
239
235
|
} catch (_unused5) {}
|
|
240
236
|
}
|
|
241
237
|
buffers.clear();
|
|
242
|
-
appendChains.clear();
|
|
243
238
|
deferred.clear();
|
|
244
239
|
heldAppends.clear();
|
|
245
240
|
pendingCreates.length = 0;
|
|
@@ -377,70 +372,31 @@ function createMseController(options) {
|
|
|
377
372
|
attach(el, held);
|
|
378
373
|
});
|
|
379
374
|
runner.register("append", (effect) => {
|
|
380
|
-
|
|
381
|
-
const { appendTransform } = options;
|
|
382
|
-
if (appendTransform === void 0) {
|
|
383
|
-
enqueueAppend(effect.sbId, effect.data);
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
const next = ((_appendChains$get = appendChains.get(effect.sbId)) !== null && _appendChains$get !== void 0 ? _appendChains$get : Promise.resolve()).then(_asyncToGenerator(function* () {
|
|
387
|
-
var _effect$start, _effect$renditionId, _effect$seq;
|
|
388
|
-
const out = yield appendTransform(new Uint8Array(effect.data), appendMeta(effect.sbId, (_effect$start = effect.start) !== null && _effect$start !== void 0 ? _effect$start : 0, (_effect$renditionId = effect.renditionId) !== null && _effect$renditionId !== void 0 ? _effect$renditionId : "", (_effect$seq = effect.seq) !== null && _effect$seq !== void 0 ? _effect$seq : 0));
|
|
389
|
-
const bytes = out.byteOffset === 0 && out.byteLength === out.buffer.byteLength ? out.buffer : out.slice().buffer;
|
|
390
|
-
enqueueAppend(effect.sbId, bytes);
|
|
391
|
-
})).catch((err) => {
|
|
392
|
-
absorb({
|
|
393
|
-
type: "SOURCEBUFFER_ERROR",
|
|
394
|
-
sbId: effect.sbId,
|
|
395
|
-
error: {
|
|
396
|
-
category: "media",
|
|
397
|
-
code: "MEDIA_CONTAINER_INVALID",
|
|
398
|
-
fatal: false,
|
|
399
|
-
recoverable: false,
|
|
400
|
-
context: { message: String(err) }
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
appendChains.set(effect.sbId, next);
|
|
375
|
+
enqueueAppend(effect.sbId, effect.data);
|
|
405
376
|
});
|
|
406
|
-
function sequenced(sbId, op) {
|
|
407
|
-
var _appendChains$get2;
|
|
408
|
-
if (options.appendTransform === void 0) {
|
|
409
|
-
op();
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
const prior = (_appendChains$get2 = appendChains.get(sbId)) !== null && _appendChains$get2 !== void 0 ? _appendChains$get2 : Promise.resolve();
|
|
413
|
-
appendChains.set(sbId, prior.then(op).catch(() => void 0));
|
|
414
|
-
}
|
|
415
377
|
runner.register("remove", (effect) => {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
end: clamped.end
|
|
425
|
-
});
|
|
378
|
+
const entry = buffers.get(effect.sbId);
|
|
379
|
+
if (entry === void 0) return void 0;
|
|
380
|
+
const clamped = evictor.clamp(entry.sb, effect.start, effect.end, currentTime());
|
|
381
|
+
if (clamped === null) return void 0;
|
|
382
|
+
entry.queue.enqueue({
|
|
383
|
+
op: "remove",
|
|
384
|
+
start: clamped.start,
|
|
385
|
+
end: clamped.end
|
|
426
386
|
});
|
|
427
387
|
});
|
|
428
388
|
runner.register("changeType", (effect) => {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
type: effect.codecs
|
|
434
|
-
});
|
|
389
|
+
var _buffers$get2;
|
|
390
|
+
(_buffers$get2 = buffers.get(effect.sbId)) === null || _buffers$get2 === void 0 || _buffers$get2.queue.enqueue({
|
|
391
|
+
op: "changeType",
|
|
392
|
+
type: effect.codecs
|
|
435
393
|
});
|
|
436
394
|
});
|
|
437
395
|
runner.register("setTimestampOffset", (effect) => {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
offset: effect.offset
|
|
443
|
-
});
|
|
396
|
+
var _buffers$get3;
|
|
397
|
+
(_buffers$get3 = buffers.get(effect.sbId)) === null || _buffers$get3 === void 0 || _buffers$get3.queue.enqueue({
|
|
398
|
+
op: "setTimestampOffset",
|
|
399
|
+
offset: effect.offset
|
|
444
400
|
});
|
|
445
401
|
});
|
|
446
402
|
runner.register("endOfStream", (effect) => {
|
|
@@ -494,4 +450,4 @@ function createMseController(options) {
|
|
|
494
450
|
};
|
|
495
451
|
}
|
|
496
452
|
//#endregion
|
|
497
|
-
export { createMseController };
|
|
453
|
+
export { createMseController, decodable };
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
//#region src/kernel/prepare.ts
|
|
4
|
+
/**
|
|
5
|
+
* The boundary meta a transform and the probe receive. The content type
|
|
6
|
+
* comes from the buffer the request names, so the preparer needs no
|
|
7
|
+
* presentation lookup.
|
|
8
|
+
*/
|
|
9
|
+
function metaFor(request) {
|
|
10
|
+
var _request$renditionId, _request$segmentStart, _request$segmentDurat;
|
|
11
|
+
return {
|
|
12
|
+
trackId: request.trackId,
|
|
13
|
+
renditionId: (_request$renditionId = request.renditionId) !== null && _request$renditionId !== void 0 ? _request$renditionId : "",
|
|
14
|
+
contentType: request.sbId === "sb:audio" ? "audio" : "video",
|
|
15
|
+
seq: request.seq,
|
|
16
|
+
start: (_request$segmentStart = request.segmentStart) !== null && _request$segmentStart !== void 0 ? _request$segmentStart : 0,
|
|
17
|
+
duration: (_request$segmentDurat = request.segmentDuration) !== null && _request$segmentDurat !== void 0 ? _request$segmentDurat : 0,
|
|
18
|
+
isInit: request.seq < 0
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** The bytes as one ArrayBuffer, copied only when the view does not cover its buffer. */
|
|
22
|
+
function toArrayBuffer(data) {
|
|
23
|
+
return data.byteOffset === 0 && data.byteLength === data.buffer.byteLength ? data.buffer : data.slice().buffer;
|
|
24
|
+
}
|
|
25
|
+
/** Wraps `absorb`: the returned function takes the transport's facts and forwards them prepared. */
|
|
26
|
+
function createSegmentPreparer(deps) {
|
|
27
|
+
const chains = /* @__PURE__ */ new Map();
|
|
28
|
+
return (fact) => {
|
|
29
|
+
var _chains$get;
|
|
30
|
+
if (fact.type !== "SEGMENT_LOADED" || fact.token === void 0) {
|
|
31
|
+
deps.absorb(fact);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const request = deps.inflight(fact.token);
|
|
35
|
+
if ((request === null || request === void 0 ? void 0 : request.sbId) === void 0) {
|
|
36
|
+
deps.absorb(fact);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const steps = deps.transforms();
|
|
40
|
+
const probe = deps.timeProbe();
|
|
41
|
+
if (steps.length === 0 && probe === null) {
|
|
42
|
+
deps.absorb(fact);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const meta = metaFor(request);
|
|
46
|
+
const sbId = request.sbId;
|
|
47
|
+
const next = ((_chains$get = chains.get(sbId)) !== null && _chains$get !== void 0 ? _chains$get : Promise.resolve()).then(_asyncToGenerator(function* () {
|
|
48
|
+
let data = new Uint8Array(fact.bytes);
|
|
49
|
+
for (const step of steps) data = new Uint8Array(yield step.transform(data, meta));
|
|
50
|
+
let mediaStart = null;
|
|
51
|
+
if (probe !== null) try {
|
|
52
|
+
mediaStart = probe(data, meta);
|
|
53
|
+
} catch (_unused) {
|
|
54
|
+
mediaStart = null;
|
|
55
|
+
}
|
|
56
|
+
deps.absorb(_objectSpread2(_objectSpread2({}, fact), {}, { bytes: toArrayBuffer(data) }, mediaStart !== null && request.seq >= 0 ? { mediaStart } : {}));
|
|
57
|
+
})).catch((err) => {
|
|
58
|
+
deps.absorb(_objectSpread2(_objectSpread2({
|
|
59
|
+
type: "SEGMENT_FAILED",
|
|
60
|
+
trackId: request.trackId,
|
|
61
|
+
seq: request.seq
|
|
62
|
+
}, request.renditionId !== void 0 ? { renditionId: request.renditionId } : {}), {}, { error: {
|
|
63
|
+
category: "media",
|
|
64
|
+
code: "MEDIA_CONTAINER_INVALID",
|
|
65
|
+
fatal: false,
|
|
66
|
+
recoverable: false,
|
|
67
|
+
context: {
|
|
68
|
+
message: String(err),
|
|
69
|
+
token: fact.token
|
|
70
|
+
}
|
|
71
|
+
} }));
|
|
72
|
+
});
|
|
73
|
+
chains.set(sbId, next);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { createSegmentPreparer };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/kernel/presentation.ts
|
|
2
|
+
/** An I-frame-only video track, kept for trick play and never selected for normal playback. */
|
|
3
|
+
function isTrick(track) {
|
|
4
|
+
return track.role === "trick";
|
|
5
|
+
}
|
|
6
|
+
function findTrackSite(presentation, trackId) {
|
|
7
|
+
var _presentation$periods;
|
|
8
|
+
for (const period of (_presentation$periods = presentation === null || presentation === void 0 ? void 0 : presentation.periods) !== null && _presentation$periods !== void 0 ? _presentation$periods : []) for (const track of period.tracks) if (track.id === trackId) return {
|
|
9
|
+
track,
|
|
10
|
+
period
|
|
11
|
+
};
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
function findRendition(presentation, renditionId) {
|
|
15
|
+
var _presentation$periods2;
|
|
16
|
+
for (const period of (_presentation$periods2 = presentation === null || presentation === void 0 ? void 0 : presentation.periods) !== null && _presentation$periods2 !== void 0 ? _presentation$periods2 : []) for (const track of period.tracks) for (const rendition of track.renditions) if (rendition.id === renditionId) return {
|
|
17
|
+
rendition,
|
|
18
|
+
track,
|
|
19
|
+
period
|
|
20
|
+
};
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { findRendition, findTrackSite, isTrick };
|