mattebox 0.8.2 → 0.10.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 +2 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/objectWithoutProperties.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/containers/id3.js +1 -1
- package/dist/es2015/containers/ts-transmux/h264.js +1 -1
- package/dist/es2015/containers/ts-transmux/index.js +1 -1
- package/dist/es2015/containers/webvtt.js +1 -1
- package/dist/es2015/index.js +6 -4
- package/dist/es2015/kernel/append-queue.js +1 -1
- package/dist/es2015/kernel/characteristics.js +27 -0
- package/dist/es2015/kernel/context.js +3 -0
- package/dist/es2015/kernel/mse.js +1 -1
- package/dist/es2015/kernel/prepare.js +2 -2
- package/dist/es2015/kernel/reducer.js +46 -8
- package/dist/es2015/kernel/refresh.js +1 -1
- package/dist/es2015/kernel/rendition-select.js +1 -1
- package/dist/es2015/kernel/scheduler.js +1 -1
- package/dist/es2015/kernel/trace.js +1 -1
- package/dist/es2015/kernel/track-registry.js +18 -1
- package/dist/es2015/kernel/transport.js +2 -2
- package/dist/es2015/presets/define.js +2 -2
- package/dist/es2015/presets/tiers.js +2 -0
- package/dist/es2015/protocols/dash-cmaf/index.js +1 -1
- package/dist/es2015/protocols/dash-cmaf/parse.js +98 -26
- package/dist/es2015/protocols/dash-live/index.js +1 -1
- package/dist/es2015/protocols/hls-cmaf/index.js +1 -1
- package/dist/es2015/protocols/hls-cmaf/parse.js +35 -3
- package/dist/es2015/protocols/hls-cmaf/unavailable.js +1 -1
- package/dist/es2015/protocols/hls-live/index.js +1 -1
- package/dist/es2015/stages/abr/index.js +1 -1
- 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 +31 -11
- package/dist/es2015/stages/chapters/index.js +2 -2
- package/dist/es2015/stages/chapters/parse.js +2 -2
- package/dist/es2015/stages/content-steering/index.js +1 -1
- package/dist/es2015/stages/eme-core/index.js +78 -9
- package/dist/es2015/stages/eme-fairplay/index.js +1 -1
- package/dist/es2015/stages/forced-subtitles/index.js +82 -0
- package/dist/es2015/stages/recovery/index.js +1 -1
- package/dist/es2015/stages/text-cea608/decode.js +1 -1
- package/dist/es2015/stages/text-cea608/index.js +84 -15
- package/dist/es2015/stages/text-webvtt/index.js +8 -4
- package/dist/es2015/stages/thumbnails/index.js +1 -1
- package/dist/es2015/stages/trick-play/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/kernel/characteristics.d.ts +20 -0
- package/dist/kernel/characteristics.d.ts.map +1 -0
- package/dist/kernel/characteristics.js +25 -0
- package/dist/kernel/characteristics.js.map +1 -0
- package/dist/kernel/context.d.ts.map +1 -1
- package/dist/kernel/context.js +3 -0
- package/dist/kernel/context.js.map +1 -1
- package/dist/kernel/reducer.d.ts +3 -0
- package/dist/kernel/reducer.d.ts.map +1 -1
- package/dist/kernel/reducer.js +40 -4
- package/dist/kernel/reducer.js.map +1 -1
- package/dist/kernel/track-registry.d.ts +8 -8
- package/dist/kernel/track-registry.d.ts.map +1 -1
- package/dist/kernel/track-registry.js +27 -4
- package/dist/kernel/track-registry.js.map +1 -1
- package/dist/presets/tiers.d.ts.map +1 -1
- package/dist/presets/tiers.js +2 -0
- package/dist/presets/tiers.js.map +1 -1
- package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/parse.js +90 -4
- package/dist/protocols/dash-cmaf/parse.js.map +1 -1
- package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/parse.js +41 -0
- package/dist/protocols/hls-cmaf/parse.js.map +1 -1
- package/dist/stages/alt-audio/index.d.ts +5 -2
- package/dist/stages/alt-audio/index.d.ts.map +1 -1
- package/dist/stages/alt-audio/index.js +31 -11
- package/dist/stages/alt-audio/index.js.map +1 -1
- package/dist/stages/eme-core/index.d.ts.map +1 -1
- package/dist/stages/eme-core/index.js +82 -8
- package/dist/stages/eme-core/index.js.map +1 -1
- package/dist/stages/forced-subtitles/index.d.ts +40 -0
- package/dist/stages/forced-subtitles/index.d.ts.map +1 -0
- package/dist/stages/forced-subtitles/index.js +80 -0
- package/dist/stages/forced-subtitles/index.js.map +1 -0
- package/dist/stages/text-cea608/index.d.ts +9 -2
- package/dist/stages/text-cea608/index.d.ts.map +1 -1
- package/dist/stages/text-cea608/index.js +90 -16
- package/dist/stages/text-cea608/index.js.map +1 -1
- package/dist/stages/text-webvtt/index.d.ts +3 -0
- package/dist/stages/text-webvtt/index.d.ts.map +1 -1
- package/dist/stages/text-webvtt/index.js +9 -4
- package/dist/stages/text-webvtt/index.js.map +1 -1
- package/dist/types/facade.d.ts +6 -0
- package/dist/types/facade.d.ts.map +1 -1
- package/dist/types/ir.d.ts +20 -0
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/kernel.d.ts +3 -1
- package/dist/types/kernel.d.ts.map +1 -1
- package/dist/types/kernel.js.map +1 -1
- package/dist/types/messages.d.ts +11 -1
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/stage.d.ts +2 -0
- package/dist/types/stage.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import toPropertyKey from "./toPropertyKey.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/defineProperty.js
|
|
3
3
|
function _defineProperty(e, r, t) {
|
|
4
4
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
5
|
value: t,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "./defineProperty.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/objectSpread2.js
|
|
3
3
|
function ownKeys(e, r) {
|
|
4
4
|
var t = Object.keys(e);
|
|
5
5
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "./objectWithoutPropertiesLoose.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/objectWithoutProperties.js
|
|
3
3
|
function _objectWithoutProperties(e, t) {
|
|
4
4
|
if (null == e) return {};
|
|
5
5
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _typeof from "./typeof.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/toPrimitive.js
|
|
3
3
|
function toPrimitive(t, r) {
|
|
4
4
|
if ("object" != _typeof(t) || !t) return t;
|
|
5
5
|
var e = t[Symbol.toPrimitive];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _typeof from "./typeof.js";
|
|
2
2
|
import toPrimitive from "./toPrimitive.js";
|
|
3
|
-
//#region \0@oxc-project+runtime@0.
|
|
3
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/toPropertyKey.js
|
|
4
4
|
function toPropertyKey(t) {
|
|
5
5
|
var i = toPrimitive(t, "string");
|
|
6
6
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/typeof.js
|
|
2
2
|
function _typeof(o) {
|
|
3
3
|
"@babel/helpers - typeof";
|
|
4
4
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { fourcc } from "./mp4-box/index.js";
|
|
3
3
|
//#region src/containers/id3.ts
|
|
4
4
|
const HEADER_SIZE = 10;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/defineProperty.js";
|
|
2
2
|
import { toRbsp } from "../sei.js";
|
|
3
3
|
//#region src/containers/ts-transmux/h264.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/asyncToGenerator.js";
|
|
2
2
|
import { looksLikeTransportStream } from "./demux.js";
|
|
3
3
|
import { captionsWanted, deliverCaptions } from "../captions.js";
|
|
4
4
|
import { createTransmuxRunner } from "./runner.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
|
|
2
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) {
|
package/dist/es2015/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.151.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";
|
|
@@ -10,10 +10,11 @@ import { createReducer, initialState, resolveConfig } from "./kernel/reducer.js"
|
|
|
10
10
|
import { createLifecycle } from "./kernel/lifecycle.js";
|
|
11
11
|
import { compose } from "./kernel/loader.js";
|
|
12
12
|
import { createMseController, decodable } from "./kernel/mse.js";
|
|
13
|
-
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.
|
|
13
|
+
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/asyncToGenerator.js";
|
|
14
14
|
import { createSegmentPreparer } from "./kernel/prepare.js";
|
|
15
15
|
import { createTrackRegistry } from "./kernel/track-registry.js";
|
|
16
16
|
import { createTransport } from "./kernel/transport.js";
|
|
17
|
+
import { isAudioDescription, isEnhancedSpeech, isOriginal, isSdh } from "./kernel/characteristics.js";
|
|
17
18
|
//#region src/index.ts
|
|
18
19
|
/**
|
|
19
20
|
* Mattebox: a modular adaptive-streaming engine for HLS and DASH.
|
|
@@ -135,7 +136,8 @@ function mattebox(options) {
|
|
|
135
136
|
getState: () => bus.getState(),
|
|
136
137
|
dispatch: (cmd) => bus.dispatch(cmd),
|
|
137
138
|
emitEvent: (event, payload) => bus.emitEvent(event, payload),
|
|
138
|
-
hasSink: (contentType) => bus.sinkFor(contentType) !== void 0
|
|
139
|
+
hasSink: (contentType) => bus.sinkFor(contentType) !== void 0,
|
|
140
|
+
plays: (contentType, mimeType) => bus.capabilities().some((c) => typeof c !== "string" && c.contentType === contentType && c.mimeType === mimeType)
|
|
139
141
|
});
|
|
140
142
|
const arbiter = createArbiter();
|
|
141
143
|
const hooks = {
|
|
@@ -359,4 +361,4 @@ mattebox.from = (el) => {
|
|
|
359
361
|
return (_registry$get = registry.get(el)) !== null && _registry$get !== void 0 ? _registry$get : null;
|
|
360
362
|
};
|
|
361
363
|
//#endregion
|
|
362
|
-
export { canSwitchTo, createReducer, exportTrace, initialState, mattebox, replay, resolveConfig };
|
|
364
|
+
export { canSwitchTo, createReducer, exportTrace, initialState, isAudioDescription, isEnhancedSpeech, isOriginal, isSdh, mattebox, replay, resolveConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.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,27 @@
|
|
|
1
|
+
//#region src/kernel/characteristics.ts
|
|
2
|
+
function has(track, tag) {
|
|
3
|
+
var _track$characteristic;
|
|
4
|
+
return ((_track$characteristic = track.characteristics) === null || _track$characteristic === void 0 ? void 0 : _track$characteristic.includes(tag)) === true;
|
|
5
|
+
}
|
|
6
|
+
/** Audio that describes the picture. */
|
|
7
|
+
function isAudioDescription(track) {
|
|
8
|
+
return has(track, "public.accessibility.describes-video");
|
|
9
|
+
}
|
|
10
|
+
/** Audio processed so speech is easier to follow. */
|
|
11
|
+
function isEnhancedSpeech(track) {
|
|
12
|
+
return has(track, "public.accessibility.enhances-speech-intelligibility");
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Subtitles for the deaf and hard of hearing: tagged for both dialogue and
|
|
16
|
+
* sounds, as Apple's authoring rules require, or carrying the role caption.
|
|
17
|
+
*/
|
|
18
|
+
function isSdh(track) {
|
|
19
|
+
var _track$roles;
|
|
20
|
+
return has(track, "public.accessibility.transcribes-spoken-dialog") && has(track, "public.accessibility.describes-music-and-sound") || ((_track$roles = track.roles) === null || _track$roles === void 0 ? void 0 : _track$roles.includes("caption")) === true;
|
|
21
|
+
}
|
|
22
|
+
/** The language the content was made in, not a translation. */
|
|
23
|
+
function isOriginal(track) {
|
|
24
|
+
return has(track, "public.original-content");
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { isAudioDescription, isEnhancedSpeech, isOriginal, isSdh };
|
|
@@ -20,6 +20,9 @@ function createStageContext(deps) {
|
|
|
20
20
|
deps.bus.registerSink(contentType, factory);
|
|
21
21
|
sinkTypes.push(contentType);
|
|
22
22
|
},
|
|
23
|
+
capabilities() {
|
|
24
|
+
return deps.bus.capabilities();
|
|
25
|
+
},
|
|
23
26
|
registerParser(mimeType, parse) {
|
|
24
27
|
deps.bus.registerParser(mimeType, parse);
|
|
25
28
|
parserTypes.push(mimeType);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { createAppendQueue } from "./append-queue.js";
|
|
3
3
|
import { createEvictor } from "./evictor.js";
|
|
4
4
|
//#region src/kernel/mse.ts
|
|
@@ -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.151.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _asyncToGenerator from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/asyncToGenerator.js";
|
|
3
3
|
//#region src/kernel/prepare.ts
|
|
4
4
|
/**
|
|
5
5
|
* The boundary meta a transform and the probe receive. The content type
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { tickAfter } from "./effects.js";
|
|
3
3
|
import { normalizeMimeType, typeString } from "./mime.js";
|
|
4
4
|
import { findRendition, findTrackSite, isTrick } from "./presentation.js";
|
|
@@ -7,7 +7,7 @@ import { reconciledOffset, segmentAtTime } from "./timeline.js";
|
|
|
7
7
|
import { bufferedEndFrom, reachesEnd, schedule } from "./scheduler.js";
|
|
8
8
|
import { availableGroups, canSwitchTo, codecFamily, createArbiter, planPinApply, withDeadGroups } from "./rendition-select.js";
|
|
9
9
|
import { sbIdFor } from "./sinks/mse-sink.js";
|
|
10
|
-
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.
|
|
10
|
+
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectWithoutProperties.js";
|
|
11
11
|
//#region src/kernel/reducer.ts
|
|
12
12
|
const _excluded = ["pendingInit"];
|
|
13
13
|
const _excluded2 = ["repeat"];
|
|
@@ -353,11 +353,10 @@ function reduceCommand(state, msg, cfg, hooks) {
|
|
|
353
353
|
}]];
|
|
354
354
|
}
|
|
355
355
|
case "SELECT_TRACK": {
|
|
356
|
-
var
|
|
356
|
+
var _segmentedAt, _previousTrack$rendit;
|
|
357
357
|
const track = findTrack(state.presentation, msg.trackId);
|
|
358
358
|
if (track === null) return reject(state, msg.type, `unknown track: ${msg.trackId}`);
|
|
359
|
-
|
|
360
|
-
if (track.renditions.length > 0 && track.renditions.every((r) => undecodableIds.includes(r.id))) return reject(state, msg.type, `undecodable track: ${msg.trackId}`);
|
|
359
|
+
if (isUndecodable(state, track)) return reject(state, msg.type, `undecodable track: ${msg.trackId}`);
|
|
361
360
|
const previous = state.tracks.active.get(track.contentType);
|
|
362
361
|
const active = new Map(state.tracks.active);
|
|
363
362
|
active.set(track.contentType, track.id);
|
|
@@ -521,10 +520,47 @@ function reduceCommand(state, msg, cfg, hooks) {
|
|
|
521
520
|
}), []];
|
|
522
521
|
}
|
|
523
522
|
case "ABORT_INFLIGHT": return abortInflight(state, msg.trackId);
|
|
523
|
+
case "ADD_TRACK": {
|
|
524
|
+
var _state$tracks$added;
|
|
525
|
+
if (state.presentation === null) return reject(state, msg.type, "no source");
|
|
526
|
+
if (findTrack(state.presentation, msg.track.id) !== null) return reject(state, msg.type, `track exists: ${msg.track.id}`);
|
|
527
|
+
const added = [...(_state$tracks$added = state.tracks.added) !== null && _state$tracks$added !== void 0 ? _state$tracks$added : [], msg.track];
|
|
528
|
+
const presentation = withAdded(state.presentation, added);
|
|
529
|
+
const available = presentation.periods.flatMap((period) => period.tracks.map((t) => t.id));
|
|
530
|
+
return [_objectSpread2(_objectSpread2({}, state), {}, {
|
|
531
|
+
presentation,
|
|
532
|
+
tracks: _objectSpread2(_objectSpread2({}, state.tracks), {}, {
|
|
533
|
+
added,
|
|
534
|
+
available
|
|
535
|
+
})
|
|
536
|
+
}), [{
|
|
537
|
+
kind: "emit",
|
|
538
|
+
event: "tracks:changed",
|
|
539
|
+
payload: { available }
|
|
540
|
+
}]];
|
|
541
|
+
}
|
|
524
542
|
}
|
|
525
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* Joins the tracks ADD_TRACK added to every period that lacks them. A
|
|
546
|
+
* playlist merge hands the reducer the adapter's presentation, which knows
|
|
547
|
+
* nothing of them.
|
|
548
|
+
*/
|
|
549
|
+
function withAdded(presentation, added) {
|
|
550
|
+
if (added === void 0 || added.length === 0) return presentation;
|
|
551
|
+
return _objectSpread2(_objectSpread2({}, presentation), {}, { periods: presentation.periods.map((period) => {
|
|
552
|
+
const missing = added.filter((track) => !period.tracks.some((t) => t.id === track.id));
|
|
553
|
+
return missing.length === 0 ? period : _objectSpread2(_objectSpread2({}, period), {}, { tracks: [...period.tracks, ...missing] });
|
|
554
|
+
}) });
|
|
555
|
+
}
|
|
526
556
|
/** The constraint source for renditions this browser cannot decode. */
|
|
527
557
|
const CODECS = "codecs";
|
|
558
|
+
/** Whether the browser decodes none of a track's renditions, from the codec filter. */
|
|
559
|
+
function isUndecodable(state, track) {
|
|
560
|
+
var _state$quality$constr, _state$quality$constr2;
|
|
561
|
+
const excluded = (_state$quality$constr = (_state$quality$constr2 = state.quality.constraints.get(CODECS)) === null || _state$quality$constr2 === void 0 ? void 0 : _state$quality$constr2.excludeIds) !== null && _state$quality$constr !== void 0 ? _state$quality$constr : [];
|
|
562
|
+
return track.renditions.length > 0 && track.renditions.every((r) => excluded.includes(r.id));
|
|
563
|
+
}
|
|
528
564
|
/**
|
|
529
565
|
* The renditions this browser cannot play: a declared codec it does not
|
|
530
566
|
* decode, and a video variant whose audio group it cannot decode at all.
|
|
@@ -544,7 +580,8 @@ function undecodable(presentation, decodable) {
|
|
|
544
580
|
* A presentation replaces the one held: a manifest landed, or a playlist
|
|
545
581
|
* merged into it. Activates default tracks and reports what changed.
|
|
546
582
|
*/
|
|
547
|
-
function loadPresentation(state,
|
|
583
|
+
function loadPresentation(state, merged, undecodableIds = /* @__PURE__ */ new Set()) {
|
|
584
|
+
const presentation = withAdded(merged, state.tracks.added);
|
|
548
585
|
const available = [];
|
|
549
586
|
for (const period of presentation.periods) for (const track of period.tracks) available.push(track.id);
|
|
550
587
|
const inflight = new Map(state.scheduling.inflight);
|
|
@@ -1205,7 +1242,8 @@ const COMMAND_TYPES = {
|
|
|
1205
1242
|
RELEASE_CONSTRAINT: true,
|
|
1206
1243
|
SET_BUFFER_GOAL: true,
|
|
1207
1244
|
RESOLVE_RENDITION: true,
|
|
1208
|
-
ABORT_INFLIGHT: true
|
|
1245
|
+
ABORT_INFLIGHT: true,
|
|
1246
|
+
ADD_TRACK: true
|
|
1209
1247
|
};
|
|
1210
1248
|
function isCommand(msg) {
|
|
1211
1249
|
return msg.type in COMMAND_TYPES;
|
|
@@ -1276,4 +1314,4 @@ function createReducer(slices, config, hooks = {}) {
|
|
|
1276
1314
|
};
|
|
1277
1315
|
}
|
|
1278
1316
|
//#endregion
|
|
1279
|
-
export { DEFAULT_KERNEL_CONFIG, createReducer, initialState, isCommand, resolveConfig };
|
|
1317
|
+
export { DEFAULT_KERNEL_CONFIG, createReducer, initialState, isCommand, isUndecodable, resolveConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
//#region src/kernel/refresh.ts
|
|
3
3
|
/** The presentation with the refresh merged, or null when it names no rendition the presentation holds. */
|
|
4
4
|
function applyRefresh(presentation, refresh) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { findRendition } from "./presentation.js";
|
|
3
3
|
import { segmentAtTime } from "./timeline.js";
|
|
4
4
|
import { bufferedEndFrom } from "./scheduler.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { buildEpochs, epochForSeq, epochKey, segmentAtTime, timestampOffsetFor } from "./timeline.js";
|
|
3
3
|
//#region src/kernel/scheduler.ts
|
|
4
4
|
const DEFAULT_GAP_TOLERANCE = .25;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
function isBytes(value) {
|
|
3
3
|
return value instanceof ArrayBuffer || ArrayBuffer.isView(value);
|
|
4
4
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { findTrackSite, isTrick } from "./presentation.js";
|
|
2
|
+
import { isUndecodable } from "./reducer.js";
|
|
2
3
|
//#region src/kernel/track-registry.ts
|
|
4
|
+
/**
|
|
5
|
+
* Cue tracks need a stage for their format, not only a sink: one text sink
|
|
6
|
+
* serves every subtitle format, and a WebVTT stage cannot read TTML. Media
|
|
7
|
+
* formats are the browser's to decode, which the codec filter answers.
|
|
8
|
+
*/
|
|
9
|
+
function formatPlays(deps, track) {
|
|
10
|
+
if (track.contentType !== "text" && track.contentType !== "metadata") return true;
|
|
11
|
+
return deps.plays(track.contentType, track.mimeType);
|
|
12
|
+
}
|
|
3
13
|
function allTracks(state) {
|
|
4
14
|
if (state.presentation === null) return [];
|
|
5
15
|
return state.presentation.periods.flatMap((period) => period.tracks);
|
|
@@ -20,7 +30,7 @@ function createTrackRegistry(deps) {
|
|
|
20
30
|
},
|
|
21
31
|
selectable(trackId) {
|
|
22
32
|
const track = find(trackId);
|
|
23
|
-
return track !== null && deps.hasSink(track.contentType);
|
|
33
|
+
return track !== null && !isTrick(track) && deps.hasSink(track.contentType) && formatPlays(deps, track) && !isUndecodable(deps.getState(), track);
|
|
24
34
|
},
|
|
25
35
|
select(trackId) {
|
|
26
36
|
const track = find(trackId);
|
|
@@ -38,6 +48,13 @@ function createTrackRegistry(deps) {
|
|
|
38
48
|
});
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
51
|
+
if (track !== null && !formatPlays(deps, track)) {
|
|
52
|
+
deps.emitEvent("command:rejected", {
|
|
53
|
+
command: "SELECT_TRACK",
|
|
54
|
+
reason: `no stage plays '${track.mimeType}'`
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
41
58
|
deps.dispatch({
|
|
42
59
|
type: "SELECT_TRACK",
|
|
43
60
|
trackId
|
|
@@ -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.151.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _asyncToGenerator from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/asyncToGenerator.js";
|
|
3
3
|
//#region src/kernel/transport.ts
|
|
4
4
|
const DEFAULT_RETRY_POLICY = {
|
|
5
5
|
maxAttempts: 3,
|
|
@@ -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.151.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.151.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"];
|
|
@@ -6,6 +6,7 @@ import pdt from "../stages/pdt/index.js";
|
|
|
6
6
|
import nalScan from "../stages/nal-scan/index.js";
|
|
7
7
|
import mp4Box from "../stages/mp4-box/index.js";
|
|
8
8
|
import metaId3 from "../stages/meta-id3/index.js";
|
|
9
|
+
import forcedSubtitles from "../stages/forced-subtitles/index.js";
|
|
9
10
|
import emeFairplay from "../stages/eme-fairplay/index.js";
|
|
10
11
|
import emeCore from "../stages/eme-core/index.js";
|
|
11
12
|
import emeCenc from "../stages/eme-cenc/index.js";
|
|
@@ -69,6 +70,7 @@ function base() {
|
|
|
69
70
|
altAudio(),
|
|
70
71
|
textWebvtt(),
|
|
71
72
|
textWebvttSegmented(),
|
|
73
|
+
forcedSubtitles(),
|
|
72
74
|
cmafTiming(),
|
|
73
75
|
pdt(),
|
|
74
76
|
mp4Box(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { scheduled } from "../../kernel/effects.js";
|
|
3
3
|
import { normalizeMimeType } from "../../kernel/mime.js";
|
|
4
4
|
import { findRendition } from "../../kernel/presentation.js";
|