@amazon/vinyl 2.0.0 → 3.0.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/index.cjs +603 -317
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +622 -329
- package/dist/index.js.map +4 -4
- package/dist/test/benchmark.es5.js +8 -5
- package/dist/test/benchmark.js +228 -0
- package/dist/test/benchmark.js.map +4 -4
- package/dist/test/integ.es5.js +182 -156
- package/dist/test/integ.js +1853 -796
- package/dist/test/integ.js.map +4 -4
- package/dist/types/current/index.d.ts +4 -0
- package/dist/types/current/index.d.ts.map +1 -1
- package/dist/types/current/index.js +4 -0
- package/dist/types/current/streaming/AudioOptions.d.ts +39 -0
- package/dist/types/current/streaming/AudioOptions.d.ts.map +1 -0
- package/dist/types/current/streaming/AudioOptions.js +15 -0
- package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.d.ts +2 -2
- package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.d.ts.map +1 -1
- package/dist/types/current/streaming/createDefaultMediaTimelineTransformer.js +5 -5
- package/dist/types/current/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/current/text/HtmlTextTrackRenderer.d.ts.map +1 -0
- package/dist/types/current/text/HtmlTextTrackRenderer.js +231 -0
- package/dist/types/current/text/SidecarTextTrackController.d.ts +65 -53
- package/dist/types/current/text/SidecarTextTrackController.d.ts.map +1 -1
- package/dist/types/current/text/SidecarTextTrackController.js +167 -154
- package/dist/types/current/text/SidecarTextTrackLoader.d.ts +5 -0
- package/dist/types/current/text/SidecarTextTrackLoader.d.ts.map +1 -1
- package/dist/types/current/text/SidecarTextTrackLoader.js +13 -7
- package/dist/types/current/text/TextTrack.d.ts +74 -20
- package/dist/types/current/text/TextTrack.d.ts.map +1 -1
- package/dist/types/current/text/TextTrack.js +20 -0
- package/dist/types/current/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/current/text/TextTrackRenderer.d.ts.map +1 -0
- package/dist/types/current/text/TextTrackRenderer.js +5 -0
- package/dist/types/current/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/current/text/mediaTextTrackProvider.d.ts.map +1 -0
- package/dist/types/current/text/mediaTextTrackProvider.js +42 -0
- package/dist/types/current/text/parseWebVtt.d.ts +16 -2
- package/dist/types/current/text/parseWebVtt.d.ts.map +1 -1
- package/dist/types/current/text/parseWebVtt.js +176 -48
- package/dist/types/current/text/pickPreferredTextTrack.d.ts +2 -1
- package/dist/types/current/text/pickPreferredTextTrack.d.ts.map +1 -1
- package/dist/types/current/text/pickPreferredTextTrack.js +6 -3
- package/dist/types/current/track/Track.d.ts +1 -1
- package/dist/types/current/track/dash/createDashFactories.d.ts +21 -10
- package/dist/types/current/track/dash/createDashFactories.d.ts.map +1 -1
- package/dist/types/current/track/dash/createDashFactories.js +9 -21
- package/dist/types/current/track/hls/createHlsFactories.d.ts +21 -10
- package/dist/types/current/track/hls/createHlsFactories.d.ts.map +1 -1
- package/dist/types/current/track/hls/createHlsFactories.js +9 -21
- package/dist/types/current/track/mse/MseTrack.d.ts +1 -2
- package/dist/types/current/track/mse/MseTrack.d.ts.map +1 -1
- package/dist/types/current/track/mse/MseTrack.js +3 -7
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/current/vinyl/VinylOptions.d.ts +18 -40
- package/dist/types/current/vinyl/VinylOptions.d.ts.map +1 -1
- package/dist/types/current/vinyl/VinylOptions.js +12 -11
- package/dist/types/current/vinyl/VinylPlayer.d.ts +0 -6
- package/dist/types/current/vinyl/VinylPlayer.d.ts.map +1 -1
- package/dist/types/current/vinyl/VinylPlayer.js +2 -23
- package/dist/types/current/vinyl/createVinylFactories.d.ts +32 -18
- package/dist/types/current/vinyl/createVinylFactories.d.ts.map +1 -1
- package/dist/types/current/vinyl/createVinylFactories.js +6 -0
- package/dist/types/ts3.7/index.d.ts +4 -0
- package/dist/types/ts3.7/streaming/AudioOptions.d.ts +39 -0
- package/dist/types/ts3.7/streaming/createDefaultMediaTimelineTransformer.d.ts +2 -2
- package/dist/types/ts3.7/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/ts3.7/text/SidecarTextTrackController.d.ts +65 -53
- package/dist/types/ts3.7/text/SidecarTextTrackLoader.d.ts +5 -0
- package/dist/types/ts3.7/text/TextTrack.d.ts +74 -20
- package/dist/types/ts3.7/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/ts3.7/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/ts3.7/text/parseWebVtt.d.ts +16 -2
- package/dist/types/ts3.7/text/pickPreferredTextTrack.d.ts +2 -1
- package/dist/types/ts3.7/track/Track.d.ts +1 -1
- package/dist/types/ts3.7/track/dash/createDashFactories.d.ts +21 -10
- package/dist/types/ts3.7/track/hls/createHlsFactories.d.ts +21 -10
- package/dist/types/ts3.7/track/mse/MseTrack.d.ts +1 -2
- package/dist/types/ts3.7/vinyl/VinylOptions.d.ts +18 -40
- package/dist/types/ts3.7/vinyl/VinylPlayer.d.ts +0 -6
- package/dist/types/ts3.7/vinyl/createVinylFactories.d.ts +32 -18
- package/dist/types/ts4.1/index.d.ts +4 -0
- package/dist/types/ts4.1/streaming/AudioOptions.d.ts +39 -0
- package/dist/types/ts4.1/streaming/createDefaultMediaTimelineTransformer.d.ts +2 -2
- package/dist/types/ts4.1/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/ts4.1/text/SidecarTextTrackController.d.ts +65 -53
- package/dist/types/ts4.1/text/SidecarTextTrackLoader.d.ts +5 -0
- package/dist/types/ts4.1/text/TextTrack.d.ts +74 -20
- package/dist/types/ts4.1/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/ts4.1/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/ts4.1/text/parseWebVtt.d.ts +16 -2
- package/dist/types/ts4.1/text/pickPreferredTextTrack.d.ts +2 -1
- package/dist/types/ts4.1/track/Track.d.ts +1 -1
- package/dist/types/ts4.1/track/dash/createDashFactories.d.ts +21 -10
- package/dist/types/ts4.1/track/hls/createHlsFactories.d.ts +21 -10
- package/dist/types/ts4.1/track/mse/MseTrack.d.ts +1 -2
- package/dist/types/ts4.1/vinyl/VinylOptions.d.ts +18 -40
- package/dist/types/ts4.1/vinyl/VinylPlayer.d.ts +0 -6
- package/dist/types/ts4.1/vinyl/createVinylFactories.d.ts +32 -18
- package/dist/types/ts4.7/index.d.ts +4 -0
- package/dist/types/ts4.7/streaming/AudioOptions.d.ts +39 -0
- package/dist/types/ts4.7/streaming/createDefaultMediaTimelineTransformer.d.ts +2 -2
- package/dist/types/ts4.7/text/HtmlTextTrackRenderer.d.ts +60 -0
- package/dist/types/ts4.7/text/SidecarTextTrackController.d.ts +65 -53
- package/dist/types/ts4.7/text/SidecarTextTrackLoader.d.ts +5 -0
- package/dist/types/ts4.7/text/TextTrack.d.ts +74 -20
- package/dist/types/ts4.7/text/TextTrackRenderer.d.ts +24 -0
- package/dist/types/ts4.7/text/mediaTextTrackProvider.d.ts +34 -0
- package/dist/types/ts4.7/text/parseWebVtt.d.ts +16 -2
- package/dist/types/ts4.7/text/pickPreferredTextTrack.d.ts +2 -1
- package/dist/types/ts4.7/track/Track.d.ts +1 -1
- package/dist/types/ts4.7/track/dash/createDashFactories.d.ts +21 -10
- package/dist/types/ts4.7/track/hls/createHlsFactories.d.ts +21 -10
- package/dist/types/ts4.7/track/mse/MseTrack.d.ts +1 -2
- package/dist/types/ts4.7/vinyl/VinylOptions.d.ts +18 -40
- package/dist/types/ts4.7/vinyl/VinylPlayer.d.ts +0 -6
- package/dist/types/ts4.7/vinyl/createVinylFactories.d.ts +32 -18
- package/dist/unit/types/current/index.d.ts +2 -0
- package/dist/unit/types/current/index.d.ts.map +1 -1
- package/dist/unit/types/current/index.js +2 -0
- package/dist/unit/types/current/streaming/MseTrack.test.js +13 -7
- package/dist/unit/types/current/streaming/createDefaultMediaTimelineTransformer.test.js +8 -4
- package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts +2 -0
- package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/HtmlTextTrackRenderer.test.js +231 -0
- package/dist/unit/types/current/text/SidecarTextTrackController.test.js +432 -333
- package/dist/unit/types/current/text/SidecarTextTrackLoader.test.js +29 -0
- package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts +2 -0
- package/dist/unit/types/current/text/mediaTextTrackProvider.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/mediaTextTrackProvider.test.js +86 -0
- package/dist/unit/types/current/text/parseWebVtt.test.js +187 -6
- package/dist/unit/types/current/text/pickPreferredTextTrack.test.js +12 -1
- package/dist/unit/types/current/track/dash/createDashFactories.test.js +1 -2
- package/dist/unit/types/current/track/hls/buildHlsMediaTimeline.test.js +1 -2
- package/dist/unit/types/current/track/hls/createHlsFactories.test.js +1 -2
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/unit/types/current/vinyl/VinylPlayerTextTracks.test.js +102 -177
- package/dist/unit/types/current/vinyl/createVinylFactories.test.js +2 -0
- package/dist/vinylTestUtil/index.js +14 -8
- package/dist/vinylTestUtil/index.js.map +2 -2
- package/dist/vinylTestUtil/types/current/mock/player/MockVinylPlayerDependencies.d.ts +3 -2
- package/dist/vinylTestUtil/types/current/mock/player/MockVinylPlayerDependencies.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/player/MockVinylPlayerDependencies.js +5 -2
- package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts +3 -3
- package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/text/MockTextTrackController.js +3 -3
- package/dist/vinylTestUtil/types/current/mock/track/dash/createMockDashDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/current/mock/track/dash/createMockDashDependencies.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/track/dash/createMockDashDependencies.js +3 -2
- package/dist/vinylTestUtil/types/current/mock/track/hls/createMockHlsDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/current/mock/track/hls/createMockHlsDependencies.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/mock/track/hls/createMockHlsDependencies.js +3 -2
- package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/vinylTestUtil/types/ts3.7/mock/player/MockVinylPlayerDependencies.d.ts +3 -2
- package/dist/vinylTestUtil/types/ts3.7/mock/text/MockTextTrackController.d.ts +3 -3
- package/dist/vinylTestUtil/types/ts3.7/mock/track/dash/createMockDashDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts3.7/mock/track/hls/createMockHlsDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts4.1/mock/player/MockVinylPlayerDependencies.d.ts +3 -2
- package/dist/vinylTestUtil/types/ts4.1/mock/text/MockTextTrackController.d.ts +3 -3
- package/dist/vinylTestUtil/types/ts4.1/mock/track/dash/createMockDashDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts4.1/mock/track/hls/createMockHlsDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts4.7/mock/player/MockVinylPlayerDependencies.d.ts +3 -2
- package/dist/vinylTestUtil/types/ts4.7/mock/text/MockTextTrackController.d.ts +3 -3
- package/dist/vinylTestUtil/types/ts4.7/mock/track/dash/createMockDashDependencies.d.ts +1 -2
- package/dist/vinylTestUtil/types/ts4.7/mock/track/hls/createMockHlsDependencies.d.ts +1 -2
- package/docs/USAGE.md +82 -31
- package/package.json +12 -12
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a text track's cues. Injected into the player so an application can
|
|
3
|
+
* paint captions itself (as HTML) instead of relying on the browser's native
|
|
4
|
+
* `TextTrack` rendering — giving full control over styling and placement.
|
|
5
|
+
*
|
|
6
|
+
* The controller hands the renderer the DOM `TextTrack` (set to `'hidden'`, so
|
|
7
|
+
* the browser tracks cue timing but does not paint); the renderer listens for
|
|
8
|
+
* the track's active cues and draws them. See {@link HtmlTextTrackRenderer} for
|
|
9
|
+
* the built-in HTML implementation.
|
|
10
|
+
*/
|
|
11
|
+
export interface TextTrackRenderer {
|
|
12
|
+
/**
|
|
13
|
+
* Renders the active cues of `track`, listening for cue changes. Passing
|
|
14
|
+
* `null` clears anything rendered and detaches from the previous track.
|
|
15
|
+
*/
|
|
16
|
+
setTextTrack(track: TextTrack | null): void;
|
|
17
|
+
/**
|
|
18
|
+
* Supplies the CSS bodies of the track's WebVTT `STYLE` blocks (which carry
|
|
19
|
+
* `::cue` rules), so the renderer can style cue classes. Optional — a
|
|
20
|
+
* renderer may ignore authored styles.
|
|
21
|
+
*/
|
|
22
|
+
setStyles?(styles: readonly string[]): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=TextTrackRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextTrackRenderer.d.ts","sourceRoot":"","sources":["../../../../src/text/TextTrackRenderer.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAA;IAE3C;;;;OAIG;IACH,SAAS,CAAC,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;CAC9C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TextTrackKind } from './TextTrack';
|
|
2
|
+
/**
|
|
3
|
+
* A handle to a DOM {@link TextTrack} created on the media element, plus a way
|
|
4
|
+
* to clear its cues.
|
|
5
|
+
*/
|
|
6
|
+
export interface TextTrackRef {
|
|
7
|
+
readonly track: TextTrack;
|
|
8
|
+
/**
|
|
9
|
+
* Removes all cues from the track. Must be called while the track is not
|
|
10
|
+
* `disabled` — `TextTrack.cues` reads null in the disabled state, so
|
|
11
|
+
* clearing a disabled track silently leaves its cues attached.
|
|
12
|
+
*/
|
|
13
|
+
clear(): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates and hands out DOM text tracks for a media element, memoized per
|
|
17
|
+
* `(kind, label, language)`.
|
|
18
|
+
*
|
|
19
|
+
* `HTMLMediaElement.addTextTrack` tracks can never be removed, so creating a
|
|
20
|
+
* fresh one per activation would accumulate tracks — and any left in `showing`
|
|
21
|
+
* mode renders alongside the active one (captions "bleed through"). Reusing one
|
|
22
|
+
* track per key keeps exactly one track per distinct rendition.
|
|
23
|
+
*/
|
|
24
|
+
export interface MediaTextTrackProvider {
|
|
25
|
+
getOrCreate(kind: TextTrackKind, label?: string, language?: string): TextTrackRef;
|
|
26
|
+
}
|
|
27
|
+
export declare function createMediaTextTrackProvider(deps: {
|
|
28
|
+
/**
|
|
29
|
+
* The HTML media element on which to attach the in-band TextTrack
|
|
30
|
+
* representation.
|
|
31
|
+
*/
|
|
32
|
+
readonly media: HTMLMediaElement;
|
|
33
|
+
}): MediaTextTrackProvider;
|
|
34
|
+
//# sourceMappingURL=mediaTextTrackProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaTextTrackProvider.d.ts","sourceRoot":"","sources":["../../../../src/text/mediaTextTrackProvider.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IAEzB;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAAA;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACnC,WAAW,CACP,IAAI,EAAE,aAAa,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAClB,YAAY,CAAA;CAClB;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IAC/C;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;CACnC,GAAG,sBAAsB,CAwCzB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
export function createMediaTextTrackProvider(deps) {
|
|
6
|
+
const { media } = deps;
|
|
7
|
+
const cache = new Map();
|
|
8
|
+
const isAttached = (track) => {
|
|
9
|
+
for (let i = 0; i < media.textTracks.length; i++) {
|
|
10
|
+
if (media.textTracks[i] === track)
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
const create = (kind, label, language) => {
|
|
16
|
+
const track = media.addTextTrack(kind, label, language);
|
|
17
|
+
return {
|
|
18
|
+
track,
|
|
19
|
+
clear() {
|
|
20
|
+
if (!track.cues)
|
|
21
|
+
return;
|
|
22
|
+
// Snapshot first — removeCue mutates the live list.
|
|
23
|
+
const all = Array.from(track.cues);
|
|
24
|
+
for (const cue of all)
|
|
25
|
+
track.removeCue(cue);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
getOrCreate(kind, label, language) {
|
|
31
|
+
const key = `${kind}-${label}-${language}`;
|
|
32
|
+
const cached = cache.get(key);
|
|
33
|
+
// Resetting the media source (MSE `src = null; load()`) drops added
|
|
34
|
+
// tracks, so a cached track can become detached; recreate when so.
|
|
35
|
+
if (cached && isAttached(cached.track))
|
|
36
|
+
return cached;
|
|
37
|
+
const ref = create(kind, label, language);
|
|
38
|
+
cache.set(key, ref);
|
|
39
|
+
return ref;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { VttCueStyle } from './VttCueStyle';
|
|
1
2
|
/**
|
|
2
3
|
* A single WebVTT cue.
|
|
3
4
|
*
|
|
@@ -20,6 +21,12 @@ export interface WebVttCue {
|
|
|
20
21
|
* The cue text payload, with line breaks preserved as `\n`.
|
|
21
22
|
*/
|
|
22
23
|
readonly text: string;
|
|
24
|
+
/**
|
|
25
|
+
* The authored cue settings from the timing line (position/line/size/
|
|
26
|
+
* align/vertical), when any were present. Preserved so a renderer can
|
|
27
|
+
* position the cue faithfully. Absent when the cue declared no settings.
|
|
28
|
+
*/
|
|
29
|
+
readonly settings?: VttCueStyle;
|
|
23
30
|
}
|
|
24
31
|
/**
|
|
25
32
|
* The result of parsing a WebVTT document.
|
|
@@ -29,18 +36,25 @@ export interface WebVttDocument {
|
|
|
29
36
|
* Parsed cues in document order.
|
|
30
37
|
*/
|
|
31
38
|
readonly cues: readonly WebVttCue[];
|
|
39
|
+
/**
|
|
40
|
+
* The raw CSS body of each `STYLE` block, in document order. These carry
|
|
41
|
+
* `::cue` rules (e.g. `::cue(.loud) { font-weight: bold }`) an HTML renderer
|
|
42
|
+
* can apply. Empty when the document declared no styles.
|
|
43
|
+
*/
|
|
44
|
+
readonly styles: readonly string[];
|
|
32
45
|
}
|
|
33
46
|
/**
|
|
34
47
|
* Parses a WebVTT document into a list of cues.
|
|
35
48
|
*
|
|
36
49
|
* Implements a forgiving subset of the WebVTT 1.0 specification: header
|
|
37
50
|
* detection, comment blocks (lines starting with `NOTE`), styling/region
|
|
38
|
-
* blocks (skipped), cue identifiers, and
|
|
39
|
-
*
|
|
51
|
+
* blocks (STYLE bodies are captured, REGION skipped), cue identifiers, and
|
|
52
|
+
* HH:MM:SS.mmm or MM:SS.mmm timestamps with optional cue settings.
|
|
40
53
|
*
|
|
41
54
|
* @param input The raw WebVTT document text. Both LF and CRLF line endings
|
|
42
55
|
* are supported, and a leading BOM is stripped if present.
|
|
43
56
|
* @throws ValidationError if the input is missing the WEBVTT header.
|
|
57
|
+
* @see https://www.w3.org/TR/webvtt1/#webvtt-timestamp
|
|
44
58
|
*/
|
|
45
59
|
export declare function parseWebVtt(input: string): WebVttDocument;
|
|
46
60
|
//# sourceMappingURL=parseWebVtt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseWebVtt.d.ts","sourceRoot":"","sources":["../../../../src/text/parseWebVtt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseWebVtt.d.ts","sourceRoot":"","sources":["../../../../src/text/parseWebVtt.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAA;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CACrC;AAeD;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAoGzD"}
|
|
@@ -4,103 +4,153 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ErrorOrigin, ValidationError } from '@amazon/vinyl-util';
|
|
6
6
|
const WEBVTT_HEADER = 'WEBVTT';
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
|
|
7
|
+
// A single WebVTT timestamp anchored at the start: `[ hours ":" ] minutes ":"
|
|
8
|
+
// seconds "." ms`, with hours two-or-more digits (optional), minutes/seconds
|
|
9
|
+
// two digits in 0-59, and milliseconds three digits (per the spec's "collect a
|
|
10
|
+
// WebVTT timestamp"). Timestamp collection stops after the milliseconds — it is
|
|
11
|
+
// NOT anchored at the end — so the start match must be checked to consume its
|
|
12
|
+
// whole (pre-`-->`) token, while for the end match any remainder is cue
|
|
13
|
+
// settings. The only unbounded quantifier is `\d+`, followed by a literal `:`
|
|
14
|
+
// (no nested/overlapping quantifiers), so it matches in linear time, and it
|
|
15
|
+
// only ever runs against a single short token — backtracking is a non-issue.
|
|
16
|
+
const TIMESTAMP_RE = /^(?:(\d+):)?([0-5]\d):([0-5]\d)\.(\d{3})/;
|
|
13
17
|
/**
|
|
14
18
|
* Parses a WebVTT document into a list of cues.
|
|
15
19
|
*
|
|
16
20
|
* Implements a forgiving subset of the WebVTT 1.0 specification: header
|
|
17
21
|
* detection, comment blocks (lines starting with `NOTE`), styling/region
|
|
18
|
-
* blocks (skipped), cue identifiers, and
|
|
19
|
-
*
|
|
22
|
+
* blocks (STYLE bodies are captured, REGION skipped), cue identifiers, and
|
|
23
|
+
* HH:MM:SS.mmm or MM:SS.mmm timestamps with optional cue settings.
|
|
20
24
|
*
|
|
21
25
|
* @param input The raw WebVTT document text. Both LF and CRLF line endings
|
|
22
26
|
* are supported, and a leading BOM is stripped if present.
|
|
23
27
|
* @throws ValidationError if the input is missing the WEBVTT header.
|
|
28
|
+
* @see https://www.w3.org/TR/webvtt1/#webvtt-timestamp
|
|
24
29
|
*/
|
|
25
30
|
export function parseWebVtt(input) {
|
|
26
31
|
if (typeof input !== 'string') {
|
|
27
32
|
throw new ValidationError('WebVTT input must be a string', ErrorOrigin.MEDIA);
|
|
28
33
|
}
|
|
29
34
|
let text = input;
|
|
30
|
-
// Strip BOM
|
|
35
|
+
// Strip a leading BOM, then normalize line endings.
|
|
31
36
|
if (text.charCodeAt(0) === 0xfeff)
|
|
32
37
|
text = text.slice(1);
|
|
33
|
-
// Normalize line endings
|
|
34
38
|
const lines = text.split(/\r\n|\r|\n/);
|
|
35
39
|
if (lines.length === 0 || !isWebVttHeader(lines[0])) {
|
|
36
40
|
throw new ValidationError('WebVTT must begin with a WEBVTT header', ErrorOrigin.MEDIA);
|
|
37
41
|
}
|
|
38
42
|
const cues = [];
|
|
43
|
+
const styles = [];
|
|
39
44
|
// Per the WebVTT spec, everything from the `WEBVTT` signature up to (and
|
|
40
|
-
// including) the first blank line is the file header —
|
|
41
|
-
//
|
|
42
|
-
//
|
|
45
|
+
// including) the first blank line is the file header — metadata lines (e.g.
|
|
46
|
+
// HLS's `X-TIMESTAMP-MAP=...`) belong in that block and MUST NOT be
|
|
47
|
+
// interpreted as cue content.
|
|
43
48
|
let i = 1;
|
|
44
49
|
while (i < lines.length && lines[i] !== '')
|
|
45
50
|
i++;
|
|
46
51
|
while (i < lines.length) {
|
|
47
|
-
// Skip
|
|
52
|
+
// Skip blank lines between blocks.
|
|
48
53
|
if (lines[i] === '') {
|
|
49
54
|
i++;
|
|
50
55
|
continue;
|
|
51
56
|
}
|
|
52
|
-
// NOTE comment
|
|
53
|
-
|
|
57
|
+
// NOTE comment / REGION blocks: skip until the blank line. A NOTE line
|
|
58
|
+
// is `NOTE` alone or `NOTE` followed by whitespace (space or tab).
|
|
59
|
+
if (lines[i] === 'NOTE' ||
|
|
60
|
+
lines[i].startsWith('NOTE ') ||
|
|
61
|
+
lines[i].startsWith('NOTE\t') ||
|
|
62
|
+
lines[i] === 'REGION') {
|
|
54
63
|
i++;
|
|
55
64
|
while (i < lines.length && lines[i] !== '')
|
|
56
65
|
i++;
|
|
57
66
|
continue;
|
|
58
67
|
}
|
|
59
|
-
// STYLE
|
|
60
|
-
if (lines[i] === 'STYLE'
|
|
68
|
+
// STYLE block: capture its CSS body (up to the blank line).
|
|
69
|
+
if (lines[i] === 'STYLE') {
|
|
61
70
|
i++;
|
|
71
|
+
const start = i;
|
|
62
72
|
while (i < lines.length && lines[i] !== '')
|
|
63
73
|
i++;
|
|
74
|
+
const css = lines.slice(start, i).join('\n').trim();
|
|
75
|
+
if (css)
|
|
76
|
+
styles.push(css);
|
|
64
77
|
continue;
|
|
65
78
|
}
|
|
66
|
-
// Cue: optional identifier, then a timing line, then payload.
|
|
79
|
+
// Cue: an optional identifier line, then a timing line, then payload.
|
|
80
|
+
// A cue identifier never contains `-->`, so a line without it is the
|
|
81
|
+
// identifier and the timing line follows (spec: "collect a WebVTT
|
|
82
|
+
// block").
|
|
67
83
|
let id = null;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (TIME_RE.test(firstLine)) {
|
|
71
|
-
timingLine = firstLine;
|
|
72
|
-
i++;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
id = firstLine;
|
|
84
|
+
if (!lines[i].includes('-->')) {
|
|
85
|
+
id = lines[i];
|
|
76
86
|
i++;
|
|
77
87
|
if (i >= lines.length)
|
|
78
|
-
break;
|
|
79
|
-
timingLine = lines[i];
|
|
80
|
-
i++;
|
|
88
|
+
break; // identifier with no timing line
|
|
81
89
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
const timing = parseTiming(lines[i]);
|
|
91
|
+
i++;
|
|
92
|
+
if (!timing) {
|
|
93
|
+
// Malformed timing line: drain to the next blank line.
|
|
85
94
|
while (i < lines.length && lines[i] !== '')
|
|
86
95
|
i++;
|
|
87
96
|
continue;
|
|
88
97
|
}
|
|
89
|
-
const startTime = toSeconds(match[1], match[2], match[3], match[4]);
|
|
90
|
-
const endTime = toSeconds(match[5], match[6], match[7], match[8]);
|
|
91
98
|
const payloadLines = [];
|
|
92
99
|
while (i < lines.length && lines[i] !== '') {
|
|
93
100
|
payloadLines.push(lines[i]);
|
|
94
101
|
i++;
|
|
95
102
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
const text = payloadLines.join('\n');
|
|
104
|
+
// Omit the optional `settings` key entirely when there are none.
|
|
105
|
+
cues.push(timing.settings === undefined
|
|
106
|
+
? {
|
|
107
|
+
id,
|
|
108
|
+
startTime: timing.startTime,
|
|
109
|
+
endTime: timing.endTime,
|
|
110
|
+
text,
|
|
111
|
+
}
|
|
112
|
+
: {
|
|
113
|
+
id,
|
|
114
|
+
startTime: timing.startTime,
|
|
115
|
+
endTime: timing.endTime,
|
|
116
|
+
text,
|
|
117
|
+
settings: timing.settings,
|
|
118
|
+
});
|
|
102
119
|
}
|
|
103
|
-
return { cues };
|
|
120
|
+
return { cues, styles };
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Parses a WebVTT timing line ("start --> end settings"), returning the two
|
|
124
|
+
* times (in seconds) and any parsed cue settings, or null if it is not a valid
|
|
125
|
+
* timing line. Splitting on the literal `-->` (and on the whitespace before the
|
|
126
|
+
* settings) keeps each timestamp match a fixed, anchored token.
|
|
127
|
+
*/
|
|
128
|
+
function parseTiming(line) {
|
|
129
|
+
const arrow = line.indexOf('-->');
|
|
130
|
+
if (arrow < 0)
|
|
131
|
+
return null;
|
|
132
|
+
// Before the arrow: only the start timestamp (whitespace-trimmed), so the
|
|
133
|
+
// match must consume the whole token.
|
|
134
|
+
const before = line.slice(0, arrow).trim();
|
|
135
|
+
const start = TIMESTAMP_RE.exec(before);
|
|
136
|
+
if (!start || start[0].length !== before.length)
|
|
137
|
+
return null;
|
|
138
|
+
// After the arrow: the end timestamp, then whatever follows is cue settings.
|
|
139
|
+
const rest = line.slice(arrow + 3).trim();
|
|
140
|
+
const end = TIMESTAMP_RE.exec(rest);
|
|
141
|
+
if (!end)
|
|
142
|
+
return null;
|
|
143
|
+
return {
|
|
144
|
+
startTime: toSeconds(start[1], start[2], start[3], start[4]),
|
|
145
|
+
endTime: toSeconds(end[1], end[2], end[3], end[4]),
|
|
146
|
+
settings: parseCueSettings(rest.slice(end[0].length)),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function toSeconds(hours, minutes, seconds, millis) {
|
|
150
|
+
return ((hours ? Number(hours) * 3600 : 0) +
|
|
151
|
+
Number(minutes) * 60 +
|
|
152
|
+
Number(seconds) +
|
|
153
|
+
Number(millis) / 1000);
|
|
104
154
|
}
|
|
105
155
|
function isWebVttHeader(line) {
|
|
106
156
|
if (!line.startsWith(WEBVTT_HEADER))
|
|
@@ -111,10 +161,88 @@ function isWebVttHeader(line) {
|
|
|
111
161
|
// Header may be followed by space, tab, or any text after a separator.
|
|
112
162
|
return next === 0x20 || next === 0x09;
|
|
113
163
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
164
|
+
const ALIGN = new Set(['start', 'center', 'end', 'left', 'right']);
|
|
165
|
+
const LINE_ALIGN = new Set(['start', 'center', 'end']);
|
|
166
|
+
const POSITION_ALIGN = new Set(['line-left', 'center', 'line-right', 'auto']);
|
|
167
|
+
const VERTICAL = new Set(['rl', 'lr']);
|
|
168
|
+
/**
|
|
169
|
+
* Parses the cue-settings tail of a timing line (e.g.
|
|
170
|
+
* `align:center line:80% position:50%,center size:90% vertical:rl`) into a
|
|
171
|
+
* {@link VttCueStyle}. Unknown keys and malformed values are skipped; returns
|
|
172
|
+
* undefined when nothing valid was found.
|
|
173
|
+
*/
|
|
174
|
+
function parseCueSettings(text) {
|
|
175
|
+
if (!text)
|
|
176
|
+
return undefined;
|
|
177
|
+
const settings = {};
|
|
178
|
+
for (const token of text.trim().split(/\s+/)) {
|
|
179
|
+
const colon = token.indexOf(':');
|
|
180
|
+
if (colon <= 0)
|
|
181
|
+
continue;
|
|
182
|
+
const key = token.slice(0, colon);
|
|
183
|
+
const value = token.slice(colon + 1);
|
|
184
|
+
switch (key) {
|
|
185
|
+
case 'align': {
|
|
186
|
+
// 'middle' is the legacy spelling of 'center'.
|
|
187
|
+
const align = value === 'middle' ? 'center' : value;
|
|
188
|
+
if (ALIGN.has(align))
|
|
189
|
+
settings.align = align;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
case 'vertical':
|
|
193
|
+
if (VERTICAL.has(value))
|
|
194
|
+
settings.vertical = value;
|
|
195
|
+
break;
|
|
196
|
+
case 'size': {
|
|
197
|
+
const size = parsePercent(value);
|
|
198
|
+
if (size != null)
|
|
199
|
+
settings.size = size;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
case 'line':
|
|
203
|
+
parseLine(value, settings);
|
|
204
|
+
break;
|
|
205
|
+
case 'position':
|
|
206
|
+
parsePosition(value, settings);
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return Object.keys(settings).length > 0 ? settings : undefined;
|
|
211
|
+
}
|
|
212
|
+
function parseLine(value, settings) {
|
|
213
|
+
const [pos, align] = value.split(',');
|
|
214
|
+
if (pos.endsWith('%')) {
|
|
215
|
+
const percent = parsePercent(pos);
|
|
216
|
+
if (percent == null)
|
|
217
|
+
return;
|
|
218
|
+
settings.line = percent;
|
|
219
|
+
settings.snapToLines = false;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
const n = Number(pos);
|
|
223
|
+
if (!Number.isInteger(n))
|
|
224
|
+
return;
|
|
225
|
+
settings.line = n;
|
|
226
|
+
settings.snapToLines = true;
|
|
227
|
+
}
|
|
228
|
+
const lineAlign = align === 'middle' ? 'center' : align;
|
|
229
|
+
if (lineAlign && LINE_ALIGN.has(lineAlign))
|
|
230
|
+
settings.lineAlign = lineAlign;
|
|
231
|
+
}
|
|
232
|
+
function parsePosition(value, settings) {
|
|
233
|
+
const [pos, align] = value.split(',');
|
|
234
|
+
const percent = parsePercent(pos);
|
|
235
|
+
if (percent == null)
|
|
236
|
+
return;
|
|
237
|
+
settings.position = percent;
|
|
238
|
+
const positionAlign = align === 'middle' ? 'center' : align;
|
|
239
|
+
if (positionAlign && POSITION_ALIGN.has(positionAlign))
|
|
240
|
+
settings.positionAlign = positionAlign;
|
|
241
|
+
}
|
|
242
|
+
/** Parses an `N%` token to its numeric percentage, or null when malformed. */
|
|
243
|
+
function parsePercent(value) {
|
|
244
|
+
if (!value.endsWith('%'))
|
|
245
|
+
return null;
|
|
246
|
+
const n = Number(value.slice(0, -1));
|
|
247
|
+
return Number.isFinite(n) ? n : null;
|
|
120
248
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TextTrackInfo } from './TextTrack';
|
|
2
|
+
import type { Maybe } from '@amazon/vinyl-util';
|
|
2
3
|
/**
|
|
3
4
|
* Chooses the text track that best matches the preferred language(s), or null
|
|
4
5
|
* when none relate (or there is no preference / no tracks).
|
|
@@ -10,5 +11,5 @@ import type { TextTrackInfo } from './TextTrack';
|
|
|
10
11
|
* forced foreign-dialogue cues), and a manifest-default track breaks any
|
|
11
12
|
* remaining tie.
|
|
12
13
|
*/
|
|
13
|
-
export declare function pickPreferredTextTrack(tracks: readonly TextTrackInfo[], preferred: string | readonly string[]
|
|
14
|
+
export declare function pickPreferredTextTrack(tracks: readonly TextTrackInfo[], preferred: Maybe<string | readonly string[]>): TextTrackInfo | null;
|
|
14
15
|
//# sourceMappingURL=pickPreferredTextTrack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickPreferredTextTrack.d.ts","sourceRoot":"","sources":["../../../../src/text/pickPreferredTextTrack.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"pickPreferredTextTrack.d.ts","sourceRoot":"","sources":["../../../../src/text/pickPreferredTextTrack.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAkB/C;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,GAC7C,aAAa,GAAG,IAAI,CActB"}
|
|
@@ -5,15 +5,18 @@
|
|
|
5
5
|
import { languageRelatedness } from '../track/filters/languageFilter';
|
|
6
6
|
/**
|
|
7
7
|
* Resolves the preferred-text-language option to an ordered list of BCP 47
|
|
8
|
-
* tags, most-preferred first.
|
|
9
|
-
*
|
|
10
|
-
* `navigator.languages
|
|
8
|
+
* tags, most-preferred first. A string becomes a single-element list; an array
|
|
9
|
+
* is used as-is; unset (null/undefined) falls back to the platform's
|
|
10
|
+
* `navigator.languages`. Returns an empty list only when there is no preference
|
|
11
|
+
* and no `navigator.languages` — in which case nothing is selected.
|
|
11
12
|
*/
|
|
12
13
|
function resolvePreferredTextLanguages(preferred) {
|
|
13
14
|
if (typeof preferred === 'string')
|
|
14
15
|
return [preferred];
|
|
15
16
|
if (preferred)
|
|
16
17
|
return preferred;
|
|
18
|
+
if (typeof navigator !== 'undefined')
|
|
19
|
+
return [...navigator.languages];
|
|
17
20
|
return [];
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
@@ -133,7 +133,7 @@ export interface ReadonlyTrack extends ReadonlyEventHost<TrackEventMap>, Readonl
|
|
|
133
133
|
*/
|
|
134
134
|
readonly error: Error | null;
|
|
135
135
|
/**
|
|
136
|
-
* Controller for
|
|
136
|
+
* Controller for text tracks discovered for this track, or null
|
|
137
137
|
* if the track type does not surface text tracks.
|
|
138
138
|
*/
|
|
139
139
|
readonly textTrackController: ReadonlyTextTrackController | null;
|
|
@@ -20,13 +20,15 @@ import { type BuildDashMediaTimelineDeps } from './buildDashMediaTimeline';
|
|
|
20
20
|
import { createDefaultMediaTimelineTransformer } from '../../streaming/createDefaultMediaTimelineTransformer';
|
|
21
21
|
import type { DashManifestData } from './DashManifestProvider';
|
|
22
22
|
import { SidecarTextTrackController } from '../../text/SidecarTextTrackController';
|
|
23
|
+
import type { MediaTextTrackProvider } from '../../text/mediaTextTrackProvider';
|
|
24
|
+
import type { TextTrackRenderer } from '../../text/TextTrackRenderer';
|
|
23
25
|
import type { AdController } from '../../ad/AdController';
|
|
24
26
|
import { ManifestControllerImpl, type ManifestControllerImplDeps } from '../../streaming/ManifestControllerImpl';
|
|
25
27
|
/**
|
|
26
28
|
* Player-level dependencies needed for the Dash-specific factories.
|
|
27
29
|
*/
|
|
28
30
|
export interface DashFactoryDeps {
|
|
29
|
-
readonly options: ObservableValue<Pick<VinylOptions, 'abr' | '
|
|
31
|
+
readonly options: ObservableValue<Pick<VinylOptions, 'abr' | 'audio' | 'allowedContentTypes' | 'text'>>;
|
|
30
32
|
readonly playbackController: PlaybackController;
|
|
31
33
|
readonly playbackSource: PlaybackSource;
|
|
32
34
|
readonly drmKeySystemResolver: DrmKeySystemResolver;
|
|
@@ -38,6 +40,14 @@ export interface DashFactoryDeps {
|
|
|
38
40
|
* `media.addTextTrack`.
|
|
39
41
|
*/
|
|
40
42
|
readonly media: HTMLMediaElement;
|
|
43
|
+
/**
|
|
44
|
+
* Creates and reuses the DOM text tracks for sidecar captions.
|
|
45
|
+
*/
|
|
46
|
+
readonly textTrackProvider: MediaTextTrackProvider;
|
|
47
|
+
/**
|
|
48
|
+
* Optional HTML cue renderer; null for native rendering.
|
|
49
|
+
*/
|
|
50
|
+
readonly textTrackRenderer: TextTrackRenderer | null;
|
|
41
51
|
/**
|
|
42
52
|
* The player-level ad controller. MseTrack sets discovered ad breaks on it
|
|
43
53
|
* when the media timeline resolves.
|
|
@@ -76,15 +86,12 @@ export declare function createDashFactories(options: Maybe<DashInitOptions>): (d
|
|
|
76
86
|
qualitySelector: (deps: {
|
|
77
87
|
options: ObservableValue<Pick<VinylOptions, "abr">>;
|
|
78
88
|
}) => QualitySelectorImpl;
|
|
79
|
-
|
|
80
|
-
options: ObservableValue<Pick<VinylOptions, "
|
|
81
|
-
}) => ObservableValue<
|
|
89
|
+
audio: (deps: {
|
|
90
|
+
options: ObservableValue<Pick<VinylOptions, "audio">>;
|
|
91
|
+
}) => ObservableValue<import("../..").AudioOptions>;
|
|
82
92
|
allowedContentTypes: (deps: {
|
|
83
93
|
options: ObservableValue<Pick<VinylOptions, "allowedContentTypes">>;
|
|
84
94
|
}) => ObservableValue<readonly import("../..").RestrictableContentType[] | null>;
|
|
85
|
-
preferDescriptiveAudio: (deps: {
|
|
86
|
-
options: ObservableValue<Pick<VinylOptions, "preferDescriptiveAudio">>;
|
|
87
|
-
}) => ObservableValue<boolean>;
|
|
88
95
|
abr: (deps: {
|
|
89
96
|
options: ObservableValue<Pick<VinylOptions, "abr">>;
|
|
90
97
|
}) => ObservableValue<import("../..").QualitySelectorImplOptions>;
|
|
@@ -94,11 +101,13 @@ export declare function createDashFactories(options: Maybe<DashInitOptions>): (d
|
|
|
94
101
|
}) => ObservableValue<Promise<import("../..").MediaTimeline>>;
|
|
95
102
|
mediaTimelineTransformed: typeof createDefaultMediaTimelineTransformer;
|
|
96
103
|
textTrackController: (deps: {
|
|
97
|
-
readonly
|
|
104
|
+
readonly textTrackProvider: MediaTextTrackProvider;
|
|
105
|
+
readonly textTrackRenderer: TextTrackRenderer | null;
|
|
106
|
+
readonly playbackController: PlaybackController;
|
|
98
107
|
readonly manifestTransformed: ObservableValue<Promise<DashManifestData>>;
|
|
99
|
-
readonly options: ObservableValue<Pick<VinylOptions, "
|
|
108
|
+
readonly options: ObservableValue<Pick<VinylOptions, "text">>;
|
|
100
109
|
}) => SidecarTextTrackController;
|
|
101
|
-
options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "
|
|
110
|
+
options: import("@amazon/vinyl-di").Factory<ObservableValue<Pick<VinylOptions, "audio" | "text" | "abr" | "allowedContentTypes">>>;
|
|
102
111
|
playbackController: import("@amazon/vinyl-di").Factory<PlaybackController>;
|
|
103
112
|
playbackSource: import("@amazon/vinyl-di").Factory<PlaybackSource>;
|
|
104
113
|
drmKeySystemResolver: import("@amazon/vinyl-di").Factory<DrmKeySystemResolver>;
|
|
@@ -106,6 +115,8 @@ export declare function createDashFactories(options: Maybe<DashInitOptions>): (d
|
|
|
106
115
|
drmController: import("@amazon/vinyl-di").Factory<DrmController>;
|
|
107
116
|
capabilities: import("@amazon/vinyl-di").Factory<Capabilities>;
|
|
108
117
|
media: import("@amazon/vinyl-di").Factory<HTMLMediaElement>;
|
|
118
|
+
textTrackProvider: import("@amazon/vinyl-di").Factory<MediaTextTrackProvider>;
|
|
119
|
+
textTrackRenderer: import("@amazon/vinyl-di").Factory<TextTrackRenderer | null>;
|
|
109
120
|
adController: import("@amazon/vinyl-di").Factory<AdController>;
|
|
110
121
|
}>;
|
|
111
122
|
//# sourceMappingURL=createDashFactories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDashFactories.d.ts","sourceRoot":"","sources":["../../../../../src/track/dash/createDashFactories.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiB,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACtE,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAExE,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAA;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAEH,KAAK,oCAAoC,EAC5C,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACH,yBAAyB,EACzB,KAAK,6BAA6B,EACrC,MAAM,iDAAiD,CAAA;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAOnE,OAAO,EA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