@amazon/vinyl 2.0.4 → 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 +9 -9
|
@@ -58,6 +58,7 @@ export * from './playback/PlaybackSourceImpl';
|
|
|
58
58
|
export * from './playback/ReadonlyPlaybackController';
|
|
59
59
|
export * from './streaming/abr/QualitySelector';
|
|
60
60
|
export * from './streaming/abr/QualitySelectorImpl';
|
|
61
|
+
export * from './streaming/AudioOptions';
|
|
61
62
|
export * from './streaming/buffering/BufferingController';
|
|
62
63
|
export * from './streaming/buffering/codecDenylist';
|
|
63
64
|
export * from './streaming/buffering/error/SourceBufferError';
|
|
@@ -87,11 +88,14 @@ export * from './streaming/StreamingEventMap';
|
|
|
87
88
|
export * from './streaming/util/segment';
|
|
88
89
|
export * from './text/discoverDashTextTracks';
|
|
89
90
|
export * from './text/discoverHlsTextTracks';
|
|
91
|
+
export * from './text/HtmlTextTrackRenderer';
|
|
92
|
+
export * from './text/mediaTextTrackProvider';
|
|
90
93
|
export * from './text/parseWebVtt';
|
|
91
94
|
export * from './text/pickPreferredTextTrack';
|
|
92
95
|
export * from './text/SidecarTextTrackController';
|
|
93
96
|
export * from './text/SidecarTextTrackLoader';
|
|
94
97
|
export * from './text/TextTrack';
|
|
98
|
+
export * from './text/TextTrackRenderer';
|
|
95
99
|
export * from './text/VttCueStyle';
|
|
96
100
|
export * from './track/AutoResetController';
|
|
97
101
|
export * from './track/createSegmentDataProvider';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ObjectSchema } from '@amazon/vinyl-validation';
|
|
2
|
+
/**
|
|
3
|
+
* Criteria used to pick which audio rendition to play.
|
|
4
|
+
*/
|
|
5
|
+
export interface AudioSelection {
|
|
6
|
+
/**
|
|
7
|
+
* Preferred language(s) for audio content, as RFC 5646 codes (e.g. `'en'`,
|
|
8
|
+
* `'ja'`, `'fr-CA'`). May be a single tag or an ordered list of tags —
|
|
9
|
+
* earlier entries are preferred, with the best relatedness match kept for
|
|
10
|
+
* each period (audio without a language tag is always kept). `null` (the
|
|
11
|
+
* default) is NOT "no preference": it orders by the platform's
|
|
12
|
+
* `navigator.languages`. To keep every language, this option is not the
|
|
13
|
+
* mechanism — omit language content or pass a tag matching all.
|
|
14
|
+
*/
|
|
15
|
+
readonly language?: string | readonly string[] | null;
|
|
16
|
+
/**
|
|
17
|
+
* Opt in to audio-description (a.k.a. described-video / DVS) audio: audio
|
|
18
|
+
* renditions carrying an accessibility "describes video" characteristic that
|
|
19
|
+
* narrate on-screen action. `false` (the default) keeps them out of the
|
|
20
|
+
* automatic default-audio selection — they are chosen only when this is set.
|
|
21
|
+
* When `true`, a description rendition is preferred where one exists for the
|
|
22
|
+
* selected language. Changing this reselects audio immediately.
|
|
23
|
+
*/
|
|
24
|
+
readonly descriptive?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Declarative audio configuration. Mirrors `VinylOptions.text`: the audio
|
|
28
|
+
* rendition is chosen from {@link selection}; changing it reselects audio
|
|
29
|
+
* immediately.
|
|
30
|
+
*/
|
|
31
|
+
export interface AudioOptions {
|
|
32
|
+
/**
|
|
33
|
+
* The audio selection criteria (language / descriptive).
|
|
34
|
+
*/
|
|
35
|
+
readonly selection?: AudioSelection;
|
|
36
|
+
}
|
|
37
|
+
export declare const defaultAudioOptions: AudioOptions;
|
|
38
|
+
export declare const audioOptionsValidator: ObjectSchema<AudioOptions>;
|
|
39
|
+
//# sourceMappingURL=AudioOptions.d.ts.map
|
|
@@ -3,13 +3,13 @@ import type { Capabilities } from '../client/Capabilities';
|
|
|
3
3
|
import type { DrmController } from '../drm/DrmController';
|
|
4
4
|
import type { MediaTimeline } from './MediaTimeline';
|
|
5
5
|
import type { CodecOverrides } from '../util/media/codecOverrides';
|
|
6
|
+
import type { AudioOptions } from './AudioOptions';
|
|
6
7
|
export interface DefaultMediaTimelineTransformerDeps {
|
|
7
8
|
readonly capabilities: Capabilities;
|
|
8
9
|
readonly drmController: DrmController;
|
|
9
10
|
readonly mediaTimeline: ObservableValue<Promise<MediaTimeline>>;
|
|
10
11
|
readonly options: ObservableValue<{
|
|
11
|
-
readonly
|
|
12
|
-
readonly preferDescriptiveAudio?: boolean;
|
|
12
|
+
readonly audio: AudioOptions;
|
|
13
13
|
readonly codecOverrides?: CodecOverrides;
|
|
14
14
|
}>;
|
|
15
15
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Disposable } from '@amazon/vinyl-util';
|
|
2
|
+
import type { TextTrackRenderer } from './TextTrackRenderer';
|
|
3
|
+
/**
|
|
4
|
+
* The subset of a `VTTCue`'s positioning properties {@link computeCueLayout}
|
|
5
|
+
* reads. A native `VTTCue` satisfies this; a plain `TextTrackCue` (platforms
|
|
6
|
+
* without `VTTCue`) leaves them undefined and falls back to defaults.
|
|
7
|
+
*/
|
|
8
|
+
export interface CueGeometry {
|
|
9
|
+
readonly align?: string | null;
|
|
10
|
+
readonly line?: number | AutoKeyword;
|
|
11
|
+
readonly lineAlign?: LineAlignSetting;
|
|
12
|
+
readonly position?: number | AutoKeyword;
|
|
13
|
+
readonly positionAlign?: PositionAlignSetting;
|
|
14
|
+
readonly size?: number;
|
|
15
|
+
readonly snapToLines?: boolean;
|
|
16
|
+
readonly vertical?: DirectionSetting;
|
|
17
|
+
}
|
|
18
|
+
/** Inline styles (camelCase CSS properties) to apply to a rendered cue box. */
|
|
19
|
+
export type CueLayout = Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Maps a cue's WebVTT positioning settings to inline CSS. Pure and DOM-free so
|
|
22
|
+
* the (branchy) placement logic is unit-testable in isolation.
|
|
23
|
+
*
|
|
24
|
+
* A cue with neither `line` nor `position` set flows in the renderer's
|
|
25
|
+
* bottom-anchored, centered container (the common subtitle case). Otherwise it
|
|
26
|
+
* is absolutely positioned: `size` → width, `position`/`positionAlign` →
|
|
27
|
+
* horizontal, `line`/`lineAlign`/`snapToLines` → vertical (percentage lines, or
|
|
28
|
+
* whole rows counted from the bottom for negative integers), `align` → text
|
|
29
|
+
* alignment, `vertical` → writing mode.
|
|
30
|
+
*/
|
|
31
|
+
export declare function computeCueLayout(cue: CueGeometry): CueLayout;
|
|
32
|
+
/**
|
|
33
|
+
* Renders a cue's text payload as safe HTML. Text is escaped (so it can't
|
|
34
|
+
* inject nodes); newlines become `<br>`; and WebVTT cue tags are converted:
|
|
35
|
+
* `<c.foo>`→`<span class="foo">`, `<i>/<b>/<u>/<ruby>/<rt>` pass through,
|
|
36
|
+
* `<v Name>`→`<span title>`, `<lang xx>`→`<span lang>`, timestamp tags are
|
|
37
|
+
* dropped. Class-based styling requires matching app CSS (STYLE blocks in the
|
|
38
|
+
* VTT are not applied).
|
|
39
|
+
*/
|
|
40
|
+
export declare function renderCueText(text: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* A {@link TextTrackRenderer} that paints cues as HTML into {@link element}.
|
|
43
|
+
* Mount `element` over the video; it stacks cues at the bottom, centered, and
|
|
44
|
+
* positions any cue that carries explicit WebVTT settings. The DOM track is
|
|
45
|
+
* expected to be `'hidden'` so only this renderer paints.
|
|
46
|
+
*/
|
|
47
|
+
export declare class HtmlTextTrackRenderer implements TextTrackRenderer, Disposable {
|
|
48
|
+
/** The overlay container to mount over the video. */
|
|
49
|
+
readonly element: HTMLElement;
|
|
50
|
+
private track;
|
|
51
|
+
private readonly styleElement;
|
|
52
|
+
private readonly onCueChange;
|
|
53
|
+
constructor();
|
|
54
|
+
setTextTrack(track: TextTrack | null): void;
|
|
55
|
+
setStyles(styles: readonly string[]): void;
|
|
56
|
+
dispose(): void;
|
|
57
|
+
private renderActiveCues;
|
|
58
|
+
private createCueBox;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=HtmlTextTrackRenderer.d.ts.map
|
|
@@ -1,91 +1,103 @@
|
|
|
1
1
|
import { EventHostImpl, type Maybe, type RequestInitOptions } from '@amazon/vinyl-util';
|
|
2
|
-
import type { TextTrackController, TextTrackEventMap, TextTrackInfo } from './TextTrack';
|
|
2
|
+
import type { TextTrackController, TextTrackControllerOptions, TextTrackEventMap, TextTrackInfo } from './TextTrack';
|
|
3
3
|
import type { ObservableValue } from '@amazon/vinyl-observable';
|
|
4
|
-
import {
|
|
4
|
+
import type { MediaTextTrackProvider } from './mediaTextTrackProvider';
|
|
5
|
+
import type { ReadonlyPlaybackController } from '../playback/ReadonlyPlaybackController';
|
|
6
|
+
import type { TextTrackRenderer } from './TextTrackRenderer';
|
|
5
7
|
export interface SidecarTextTrackControllerDeps {
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* integration; cues are still loaded and surfaced via events.
|
|
9
|
+
* Hands out (memoized) DOM text tracks. Text tracks can only be created on a
|
|
10
|
+
* media element and never removed, so the provider reuses one track per
|
|
11
|
+
* rendition rather than accumulating them.
|
|
11
12
|
*/
|
|
12
|
-
readonly
|
|
13
|
+
readonly textTrackProvider: MediaTextTrackProvider;
|
|
13
14
|
/**
|
|
14
15
|
* Optional request init options forwarded with each VTT fetch (e.g. CORS).
|
|
15
16
|
*/
|
|
16
17
|
readonly requestInit?: Maybe<RequestInitOptions>;
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
-
* preference auto-selects the best-matching track, re-applied as the track
|
|
20
|
-
* list changes. Changing the preference to null clears the selection
|
|
21
|
-
* (captions off). An initial null (or an absent observable) is "no
|
|
22
|
-
* preference": forced tracks still auto-select until the app makes an
|
|
23
|
-
* explicit choice — it does not force captions off.
|
|
19
|
+
* The discovered text tracks, re-emitted whenever the manifest changes.
|
|
24
20
|
*/
|
|
25
|
-
readonly
|
|
21
|
+
readonly textTracks: ObservableValue<Promise<readonly TextTrackInfo[]>>;
|
|
26
22
|
/**
|
|
27
|
-
*
|
|
28
|
-
* {@link VttCueStyle}). Read per cue as it is appended, so a change affects
|
|
29
|
-
* subsequently-rendered cues. Absent means no styling (browser defaults).
|
|
23
|
+
* Declarative selection / rendering configuration. Re-applied on change.
|
|
30
24
|
*/
|
|
31
|
-
readonly
|
|
25
|
+
readonly options: ObservableValue<TextTrackControllerOptions>;
|
|
26
|
+
/**
|
|
27
|
+
* Supplies the current playhead used to fetch caption segments in a window
|
|
28
|
+
* around it.
|
|
29
|
+
*/
|
|
30
|
+
readonly playbackController: ReadonlyPlaybackController;
|
|
31
|
+
/**
|
|
32
|
+
* Optional renderer that paints cues itself (HTML overlay). When provided,
|
|
33
|
+
* the DOM text track is kept `'hidden'` (timing only) and the renderer is
|
|
34
|
+
* handed the active track; without one, the track renders natively
|
|
35
|
+
* (`'showing'`).
|
|
36
|
+
*/
|
|
37
|
+
readonly textTrackRenderer?: Maybe<TextTrackRenderer>;
|
|
32
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Selects the text track that matches the given options, or null for none.
|
|
41
|
+
*
|
|
42
|
+
* The `enabled` mode gates everything: `'off'` renders nothing (default is
|
|
43
|
+
* `'forced'`). Otherwise an explicit {@link TextTrackSelection.id} wins; else
|
|
44
|
+
* the best language match is chosen among tracks filtered by kind and
|
|
45
|
+
* forced-ness. Forced-ness comes from {@link TextTrackSelection.forced} when
|
|
46
|
+
* set, otherwise from the mode (`'forced'` keeps only forced tracks, `'on'`
|
|
47
|
+
* only full tracks).
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveSelectedTrack(tracks: readonly TextTrackInfo[], options: TextTrackControllerOptions): TextTrackInfo | null;
|
|
33
52
|
/**
|
|
34
53
|
* Manages a sidecar WebVTT-based text track lifecycle:
|
|
35
54
|
*
|
|
36
|
-
* -
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
55
|
+
* - tracks the discovered {@link TextTrackInfo} list (from the `textTracks`
|
|
56
|
+
* observable) and the current selection (from the `options` observable)
|
|
57
|
+
* - on selection, fetches the chosen track's WebVTT and pushes cues to a DOM
|
|
58
|
+
* `TextTrack` obtained from the {@link MediaTextTrackProvider}
|
|
59
|
+
* - clears cues and hides the DOM track when the selection changes or clears
|
|
40
60
|
*
|
|
41
|
-
* The controller is
|
|
42
|
-
*
|
|
43
|
-
* decides to surface.
|
|
61
|
+
* The controller is agnostic of HLS/DASH discovery details; its inputs are the
|
|
62
|
+
* observables supplied by the manifest layer.
|
|
44
63
|
*/
|
|
45
64
|
export declare class SidecarTextTrackController extends EventHostImpl<TextTrackEventMap> implements TextTrackController {
|
|
46
65
|
private readonly deps;
|
|
47
66
|
get [Symbol.toStringTag](): string;
|
|
48
|
-
private _tracks;
|
|
49
67
|
private _active;
|
|
50
|
-
private
|
|
51
|
-
private
|
|
52
|
-
private
|
|
53
|
-
private readonly
|
|
68
|
+
private _tracks;
|
|
69
|
+
private _activeTextTrack;
|
|
70
|
+
private _ref;
|
|
71
|
+
private readonly loadAbort;
|
|
72
|
+
private readonly disposer;
|
|
54
73
|
constructor(deps: SidecarTextTrackControllerDeps);
|
|
55
74
|
get textTracks(): readonly TextTrackInfo[];
|
|
56
75
|
get activeTextTrack(): TextTrackInfo | null;
|
|
76
|
+
get active(): boolean;
|
|
77
|
+
get disposed(): boolean;
|
|
57
78
|
/**
|
|
58
|
-
* Replaces the discovered
|
|
59
|
-
* the
|
|
60
|
-
* selection and emits `activeTextTrackChange`.
|
|
61
|
-
*/
|
|
62
|
-
setTextTracks(tracks: readonly TextTrackInfo[]): void;
|
|
63
|
-
setActiveTextTrack(id: string | null): void;
|
|
64
|
-
/**
|
|
65
|
-
* Selects the track best matching the preferred language(s), or clears the
|
|
66
|
-
* selection when the preference is null or nothing matches.
|
|
79
|
+
* Replaces the discovered track list, emits `textTracksChange`, then
|
|
80
|
+
* re-applies the current selection against the new list.
|
|
67
81
|
*/
|
|
68
|
-
private
|
|
82
|
+
private setTracks;
|
|
69
83
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
84
|
+
* Recomputes the selection from the current options and track list,
|
|
85
|
+
* emitting `activeTextTrackChange` on change and (re)rendering when active.
|
|
72
86
|
*/
|
|
73
|
-
private
|
|
87
|
+
private refreshSelection;
|
|
88
|
+
deactivate(): void;
|
|
89
|
+
activate(): void;
|
|
90
|
+
private startLoad;
|
|
91
|
+
private appendCues;
|
|
74
92
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
93
|
+
* Clears cues from the current DOM track and hides it, keeping the track for
|
|
94
|
+
* later reuse via the provider.
|
|
77
95
|
*/
|
|
78
|
-
private
|
|
79
|
-
suspend(): void;
|
|
80
|
-
resume(): void;
|
|
96
|
+
private hideCurrent;
|
|
81
97
|
/**
|
|
82
|
-
* Cancels any in-flight load,
|
|
98
|
+
* Cancels any in-flight load, hides the DOM text track, and resets state.
|
|
83
99
|
* Called by the host when the underlying media is unloaded.
|
|
84
100
|
*/
|
|
85
101
|
dispose(): void;
|
|
86
|
-
private startLoad;
|
|
87
|
-
private ensureDomTrack;
|
|
88
|
-
private appendCues;
|
|
89
|
-
private clearDomTrack;
|
|
90
102
|
}
|
|
91
103
|
//# sourceMappingURL=SidecarTextTrackController.d.ts.map
|
|
@@ -24,6 +24,11 @@ export interface LoadWebVttCuesOptions {
|
|
|
24
24
|
* per HLS segment, or once for a direct `.vtt` document.
|
|
25
25
|
*/
|
|
26
26
|
readonly onCues: (cues: readonly WebVttCue[]) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Invoked with the CSS body of any `STYLE` blocks parsed from a document.
|
|
29
|
+
* Only called when a document actually declares styles.
|
|
30
|
+
*/
|
|
31
|
+
readonly onStyles?: Maybe<(styles: readonly string[]) => void>;
|
|
27
32
|
/**
|
|
28
33
|
* Returns the current playback time (seconds on the presentation
|
|
29
34
|
* timeline). Used to fetch caption segments in a window around the
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChangeEvent } from '../event/ChangeEvent';
|
|
2
2
|
import type { ReadonlyEventHost } from '@amazon/vinyl-util';
|
|
3
|
+
import type { ObjectSchema } from '@amazon/vinyl-validation';
|
|
3
4
|
/**
|
|
4
5
|
* Categorizes the role of a text track. Mirrors HTMLMediaElement.TextTrackKind.
|
|
5
6
|
*/
|
|
@@ -79,6 +80,64 @@ export interface TextTrackErrorEvent {
|
|
|
79
80
|
readonly track: TextTrackInfo;
|
|
80
81
|
readonly error: Error;
|
|
81
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Which captions render:
|
|
85
|
+
* - `'off'` — nothing renders (not even forced narrative captions).
|
|
86
|
+
* - `'forced'` — only forced (narrative) tracks, so nothing shows unless the
|
|
87
|
+
* content carries a forced track for the preferred language.
|
|
88
|
+
* - `'on'` — the full (non-forced) subtitle track for the preferred language.
|
|
89
|
+
*/
|
|
90
|
+
export type CaptionMode = 'on' | 'off' | 'forced';
|
|
91
|
+
/**
|
|
92
|
+
* Criteria used to pick which text track to render. Applied in priority order:
|
|
93
|
+
* an explicit {@link id} wins; otherwise the best {@link language} match is
|
|
94
|
+
* chosen among tracks filtered by {@link kind} and by forced-ness (from
|
|
95
|
+
* {@link forced} when set, else from the controller's
|
|
96
|
+
* {@link TextTrackControllerOptions.enabled} mode).
|
|
97
|
+
*/
|
|
98
|
+
export interface TextTrackSelection {
|
|
99
|
+
/**
|
|
100
|
+
* Selects the text track with this exact identifier, ignoring the other
|
|
101
|
+
* criteria (but still gated by the `'off'` mode). If no track has this id,
|
|
102
|
+
* nothing is selected.
|
|
103
|
+
*/
|
|
104
|
+
readonly id?: string | null;
|
|
105
|
+
/**
|
|
106
|
+
* Restricts selection to tracks of this kind (e.g. `'captions'`). Unset
|
|
107
|
+
* considers all kinds.
|
|
108
|
+
*/
|
|
109
|
+
readonly kind?: TextTrackKind | null;
|
|
110
|
+
/**
|
|
111
|
+
* Preferred caption language(s), most-preferred first, as RFC 5646 tags.
|
|
112
|
+
* When unset (or empty) selection falls back to the platform's
|
|
113
|
+
* `navigator.languages`.
|
|
114
|
+
*/
|
|
115
|
+
readonly language?: string | readonly string[] | null;
|
|
116
|
+
/**
|
|
117
|
+
* Explicit forced-ness filter. When set, only tracks whose `forced` flag
|
|
118
|
+
* equals this value are considered, overriding the forced/full split
|
|
119
|
+
* implied by the `enabled` mode. Unset means the mode decides.
|
|
120
|
+
*/
|
|
121
|
+
readonly forced?: boolean | null;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Declarative configuration for a {@link TextTrackController}. Rendering is
|
|
125
|
+
* driven entirely by this value (via `VinylOptions.text`); there is no
|
|
126
|
+
* imperative track-select call.
|
|
127
|
+
*/
|
|
128
|
+
export interface TextTrackControllerOptions {
|
|
129
|
+
/**
|
|
130
|
+
* Which captions render (see {@link CaptionMode}). Unset defaults to
|
|
131
|
+
* `'forced'`.
|
|
132
|
+
*/
|
|
133
|
+
readonly enabled?: CaptionMode | null;
|
|
134
|
+
/**
|
|
135
|
+
* The selection criteria (language / id / kind). When unset, the preferred
|
|
136
|
+
* languages fall back to the platform's `navigator.languages`.
|
|
137
|
+
*/
|
|
138
|
+
readonly selection?: TextTrackSelection | null;
|
|
139
|
+
}
|
|
140
|
+
export declare const textTrackControllerOptionsValidator: ObjectSchema<TextTrackControllerOptions>;
|
|
82
141
|
export declare const ALL_TEXT_TRACK_EVENTS: readonly [
|
|
83
142
|
"textTracksChange",
|
|
84
143
|
"activeTextTrackChange",
|
|
@@ -96,34 +155,29 @@ export interface ReadonlyTextTrackController extends ReadonlyEventHost<TextTrack
|
|
|
96
155
|
* The currently active text track, or null if none is active.
|
|
97
156
|
*/
|
|
98
157
|
readonly activeTextTrack: TextTrackInfo | null;
|
|
158
|
+
/**
|
|
159
|
+
* Returns true if this text track controller is active.
|
|
160
|
+
*/
|
|
161
|
+
get active(): boolean;
|
|
99
162
|
}
|
|
100
163
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* Selection is persisted across track changes only when applications choose
|
|
105
|
-
* to call {@link setActiveTextTrack} again on the new track. This matches
|
|
106
|
-
* how audio tracks are typically driven.
|
|
164
|
+
* Full controller for the current media's text tracks. Selection is driven
|
|
165
|
+
* declaratively through the controller's options (`VinylOptions.text`); this
|
|
166
|
+
* interface only adds the render lifecycle used by the owning media track.
|
|
107
167
|
*/
|
|
108
168
|
export interface TextTrackController extends ReadonlyTextTrackController {
|
|
109
|
-
/**
|
|
110
|
-
* Selects the text track with the given id, or clears the active text
|
|
111
|
-
* track when called with null. No-op if the id does not match a known
|
|
112
|
-
* text track.
|
|
113
|
-
*/
|
|
114
|
-
setActiveTextTrack(id: string | null): void;
|
|
115
169
|
/**
|
|
116
170
|
* Suspends cue rendering without changing the active selection: cancels any
|
|
117
|
-
* in-flight load and
|
|
118
|
-
*
|
|
119
|
-
*
|
|
171
|
+
* in-flight load and hides the DOM text track (so its cues stop showing).
|
|
172
|
+
* Called when the owning media track is deactivated — e.g. while an ad
|
|
173
|
+
* plays over the suspended content. {@link activate} rebuilds it.
|
|
120
174
|
*/
|
|
121
|
-
|
|
175
|
+
deactivate(): void;
|
|
122
176
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
177
|
+
* Resumes rendering the active selection after a {@link deactivate},
|
|
178
|
+
* reloading its cues. No-op when nothing is selected or already rendering.
|
|
179
|
+
* Called when the owning media track is reactivated.
|
|
126
180
|
*/
|
|
127
|
-
|
|
181
|
+
activate(): void;
|
|
128
182
|
}
|
|
129
183
|
//# sourceMappingURL=TextTrack.d.ts.map
|
|
@@ -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,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
|
|
@@ -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,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
|
|
@@ -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
|