@liquid-js/lyr-extras 0.0.0-stage → 22.0.0-alpha.1
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/LICENSE.txt +23 -0
- package/README.md +61 -2
- package/fesm2022/liquid-js-lyr-extras-chart.mjs +871 -0
- package/fesm2022/liquid-js-lyr-extras-chart.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-color-picker.mjs +821 -0
- package/fesm2022/liquid-js-lyr-extras-color-picker.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-editor.mjs +923 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-editor.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-viewer.mjs +369 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-viewer.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-mask.mjs +240 -0
- package/fesm2022/liquid-js-lyr-extras-mask.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-media.mjs +1142 -0
- package/fesm2022/liquid-js-lyr-extras-media.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-phone-input.mjs +864 -0
- package/fesm2022/liquid-js-lyr-extras-phone-input.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-qr-code.mjs +236 -0
- package/fesm2022/liquid-js-lyr-extras-qr-code.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras.mjs +0 -0
- package/package.json +159 -3
- package/types/liquid-js-lyr-extras-chart.d.ts +294 -0
- package/types/liquid-js-lyr-extras-color-picker.d.ts +311 -0
- package/types/liquid-js-lyr-extras-markdown-editor.d.ts +367 -0
- package/types/liquid-js-lyr-extras-markdown-viewer.d.ts +174 -0
- package/types/liquid-js-lyr-extras-mask.d.ts +130 -0
- package/types/liquid-js-lyr-extras-media.d.ts +517 -0
- package/types/liquid-js-lyr-extras-phone-input.d.ts +428 -0
- package/types/liquid-js-lyr-extras-qr-code.d.ts +113 -0
- package/types/liquid-js-lyr-extras.d.ts +1 -0
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { ElementRef, InjectionToken, Provider } from "@angular/core";
|
|
6
|
+
import { NbSliderValue } from "@liquid-js/lyr-core";
|
|
7
|
+
import { AdapterType, CommonMedia, Media, MediaBufferState, MediaControlsState, MediaErrorState, MediaFullscreenState, MediaPictureInPictureState, MediaPlaybackRateState, MediaPlaybackState, MediaQualityState, MediaSourceState, MediaStreamTypeState, MediaTextTrackState, MediaTimeState, MediaVolumeState } from "@videojs/media";
|
|
8
|
+
import { PlayerTarget } from "@videojs/core/dom";
|
|
9
|
+
import { Store } from "@videojs/store";
|
|
10
|
+
/**
|
|
11
|
+
* What a player shows and can do, from Video.js: playback, time, volume and speed for all of them; quality, captions,
|
|
12
|
+
* full screen and picture in picture where the media has them.
|
|
13
|
+
*/
|
|
14
|
+
export type NbMediaState = MediaPlaybackState & MediaTimeState & MediaVolumeState & Omit<MediaPlaybackRateState, 'playbackRates'> & MediaBufferState & MediaSourceState & MediaErrorState & Partial<MediaQualityState & MediaTextTrackState & MediaFullscreenState & MediaPictureInPictureState & MediaControlsState & MediaStreamTypeState>;
|
|
15
|
+
/** A player's Video.js store: its state, with the methods that change it, e.g. `play()` and `seek(time)`. */
|
|
16
|
+
export type NbMediaStore = Store<PlayerTarget, NbMediaState>;
|
|
17
|
+
/** A source with its type, when the URL doesn't tell, and its options for the engine, e.g. `drm`. */
|
|
18
|
+
export interface NbMediaSource {
|
|
19
|
+
src: string;
|
|
20
|
+
/** The MIME type, e.g. `application/x-mpegurl` for a stream whose URL has no `.m3u8`. */
|
|
21
|
+
type?: string;
|
|
22
|
+
[option: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
/** Why a player can't play its source: the media's error, or that no engine plays its kind of source. */
|
|
25
|
+
export interface NbMediaError {
|
|
26
|
+
message: string;
|
|
27
|
+
/** The media's error code, e.g. `4` when the browser can't play the source's format. */
|
|
28
|
+
code?: number;
|
|
29
|
+
}
|
|
30
|
+
/** A text track: captions or subtitles in a WebVTT file. */
|
|
31
|
+
export interface NbMediaTrack {
|
|
32
|
+
src: string;
|
|
33
|
+
/** `subtitles` translate the speech; `captions` also describe the sounds. `subtitles` when not set. */
|
|
34
|
+
kind?: 'subtitles' | 'captions';
|
|
35
|
+
/** The track's language, e.g. `en`. */
|
|
36
|
+
srclang?: string;
|
|
37
|
+
/** The track's name, e.g. `English`. */
|
|
38
|
+
label?: string;
|
|
39
|
+
/** Whether it shows from the start. */
|
|
40
|
+
default?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The kinds of source Video.js tells apart, which pick the engine that plays one: `video` and `audio` files, `hls`
|
|
44
|
+
* and `dash` streams, and embeds such as `youtube` and `vimeo`.
|
|
45
|
+
*/
|
|
46
|
+
export type NbMediaSourceKind = AdapterType;
|
|
47
|
+
/** What every Video.js 10 media adapter has in common, which is all the players use of one. */
|
|
48
|
+
export interface NbMediaAdapter {
|
|
49
|
+
src: string;
|
|
50
|
+
/** The source with its options, e.g. `drm` or the engine's own settings, where the adapter takes them. */
|
|
51
|
+
source?: unknown;
|
|
52
|
+
attach(target: HTMLElement): void;
|
|
53
|
+
detach(): void;
|
|
54
|
+
destroy(): void;
|
|
55
|
+
}
|
|
56
|
+
export type NbMediaAdapterConstructor = new () => NbMediaAdapter;
|
|
57
|
+
/** The element an engine plays in: a `video` or `audio` element, or an `iframe` for an embed. */
|
|
58
|
+
export type NbMediaElementKind = 'video' | 'audio' | 'iframe';
|
|
59
|
+
/** An engine: a Video.js media adapter, or one with the element it plays in when its kind of source doesn't say. */
|
|
60
|
+
export type NbMediaEngine = NbMediaAdapterConstructor | {
|
|
61
|
+
adapter: NbMediaAdapterConstructor;
|
|
62
|
+
element: NbMediaElementKind;
|
|
63
|
+
};
|
|
64
|
+
/** A player as an extension sees it, each time it starts playing a source. */
|
|
65
|
+
export interface NbMediaPlayerContext {
|
|
66
|
+
/** The engine's media, which the store controls and which dispatches the media's events. */
|
|
67
|
+
readonly media: Media;
|
|
68
|
+
/** The element the media plays in: a `video`, `audio` or `iframe` element. */
|
|
69
|
+
readonly element: HTMLElement;
|
|
70
|
+
/** The player's frame, which holds the media and the controls, and goes full screen. */
|
|
71
|
+
readonly container: HTMLElement;
|
|
72
|
+
/** The player's store. */
|
|
73
|
+
readonly store: NbMediaStore;
|
|
74
|
+
/** The source it plays. */
|
|
75
|
+
readonly source: NbMediaSource;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Adds to a player while it plays a source, e.g. analytics that listen to the media's events. It runs each time a
|
|
79
|
+
* player starts playing a source, and what it returns runs when the player stops playing it.
|
|
80
|
+
*/
|
|
81
|
+
export type NbMediaExtension = (player: NbMediaPlayerContext) => void | (() => void);
|
|
82
|
+
/** Video or audio: what a player shows, and the features of its store. */
|
|
83
|
+
type NbMediaKind = 'video' | 'audio';
|
|
84
|
+
/** The engine for a source, and the element it plays in. */
|
|
85
|
+
interface Engine {
|
|
86
|
+
adapter: NbMediaAdapterConstructor;
|
|
87
|
+
element: NbMediaElementKind;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The media logic of one player: Video.js's store, and the engine and extensions that play its source.
|
|
91
|
+
*
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
declare class NbMediaController {
|
|
95
|
+
protected readonly config: import("@liquid-js/lyr-extras/media").NbMediaPlayerConfig;
|
|
96
|
+
protected store?: NbMediaStore;
|
|
97
|
+
protected loading: number;
|
|
98
|
+
protected unload?: () => void;
|
|
99
|
+
/** The store's state, as it changes; empty until the player first plays something. */
|
|
100
|
+
readonly state: import("@angular/core").WritableSignal<Partial<NbMediaState>>;
|
|
101
|
+
/** Why the source can't be played, e.g. no engine is set for its kind, or its engine didn't load. */
|
|
102
|
+
readonly loadError: import("@angular/core").WritableSignal<string | undefined>;
|
|
103
|
+
/** The element the source plays in, once its engine has loaded. */
|
|
104
|
+
readonly element: import("@angular/core").WritableSignal<HTMLElement | undefined>;
|
|
105
|
+
/** The engine's media, which dispatches the media's events, once its engine has loaded. */
|
|
106
|
+
readonly media: import("@angular/core").WritableSignal<CommonMedia<import("@videojs/media").CommonMediaEvents> | undefined>;
|
|
107
|
+
constructor();
|
|
108
|
+
/** The store, once the player has started playing something. */
|
|
109
|
+
get current(): NbMediaStore | undefined;
|
|
110
|
+
/** Stops playing the source, and loading one. */
|
|
111
|
+
stop(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Plays a source in `host`, instead of the one before: the engine for its kind makes the element it plays in, which
|
|
114
|
+
* `prepare` sets up, e.g. with a poster. `container` holds the media and the controls, and goes full screen.
|
|
115
|
+
*/
|
|
116
|
+
load(host: HTMLElement, container: HTMLElement, source: NbMediaSource, media: NbMediaKind, prepare: (element: HTMLElement, kind: NbMediaElementKind) => void): Promise<void>;
|
|
117
|
+
/** The store, created for video or audio the first time. */
|
|
118
|
+
protected init(media: NbMediaKind): NbMediaStore;
|
|
119
|
+
/** The engine for a kind of source: the app's, else the browser's own for files, and for HLS where it plays it. */
|
|
120
|
+
protected engineFor(kind: NbMediaSourceKind, media: NbMediaKind, document: Document): Promise<Engine>;
|
|
121
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbMediaController, never>;
|
|
122
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
123
|
+
}
|
|
124
|
+
/** A position or length in the media as text: `m:ss`, or `h:mm:ss` when `length` is an hour or longer. */
|
|
125
|
+
export declare function nbFormatMediaTime(seconds: number, length?: number): string;
|
|
126
|
+
/** What the video and audio players have in common: their source, how it plays, and the actions of the controls. */
|
|
127
|
+
export declare abstract class NbMediaPlayer {
|
|
128
|
+
protected abstract readonly kind: NbMediaKind;
|
|
129
|
+
protected readonly controller: NbMediaController;
|
|
130
|
+
protected readonly texts: import("@angular/core").Signal<import("@liquid-js/lyr-extras/media").NbMediaPlayerTexts>;
|
|
131
|
+
/** Where to go once the media knows its length. */
|
|
132
|
+
protected pendingSeek?: number;
|
|
133
|
+
/** Prefixes the ids of the player's labels. */
|
|
134
|
+
protected readonly id: string;
|
|
135
|
+
protected readonly rateFormat: Intl.NumberFormat;
|
|
136
|
+
protected readonly percentFormat: Intl.NumberFormat;
|
|
137
|
+
/**
|
|
138
|
+
* What it plays: a URL, or a source with its type and its options for the engine. Video and audio files play in the
|
|
139
|
+
* browser; streams and embeds need an engine, set with `provideNbMediaPlayer`.
|
|
140
|
+
*/
|
|
141
|
+
readonly src: import("@angular/core").InputSignal<string | NbMediaSource>;
|
|
142
|
+
/** Captions or subtitles, in WebVTT files. */
|
|
143
|
+
readonly tracks: import("@angular/core").InputSignal<NbMediaTrack[]>;
|
|
144
|
+
/** Whether it starts playing by itself, which browsers allow when it's muted. */
|
|
145
|
+
readonly autoplay: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
146
|
+
/** Whether it's muted. */
|
|
147
|
+
readonly muted: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
148
|
+
/** Whether it starts again from the beginning when it ends. */
|
|
149
|
+
readonly loop: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
150
|
+
/** How much of it loads before it plays: `none`, `metadata` for its length, or `auto`. */
|
|
151
|
+
readonly preload: import("@angular/core").InputSignal<"metadata" | "none" | "auto">;
|
|
152
|
+
/** Whether a source from another site is loaded with CORS, which captions from there need. */
|
|
153
|
+
readonly crossorigin: import("@angular/core").InputSignal<"anonymous" | "use-credentials" | undefined>;
|
|
154
|
+
/** Where each source starts, in seconds, e.g. where the viewer left off. */
|
|
155
|
+
readonly startTime: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
156
|
+
/** The speeds of the speed menu. */
|
|
157
|
+
readonly playbackRates: import("@angular/core").InputSignal<number[]>;
|
|
158
|
+
/** Names the player for assistive technologies, e.g. after what it plays. */
|
|
159
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
160
|
+
/**
|
|
161
|
+
* Whether it shows its controls. Without them it's just the media, e.g. a silent background video, which `autoplay`,
|
|
162
|
+
* `muted` and `loop` play, or code with `togglePlay()`.
|
|
163
|
+
*/
|
|
164
|
+
readonly controls: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
165
|
+
/** When it starts playing, from the start or after a pause. */
|
|
166
|
+
readonly play: import("@angular/core").OutputEmitterRef<void>;
|
|
167
|
+
/** When it pauses, which it also does when it ends. */
|
|
168
|
+
readonly pause: import("@angular/core").OutputEmitterRef<void>;
|
|
169
|
+
/** When it reaches the end, unless it loops. */
|
|
170
|
+
readonly ended: import("@angular/core").OutputEmitterRef<void>;
|
|
171
|
+
/** The position, in seconds, as it changes while it plays or seeks, a few times a second. */
|
|
172
|
+
readonly timeUpdate: import("@angular/core").OutputEmitterRef<number>;
|
|
173
|
+
/** When it can't play its source. */
|
|
174
|
+
readonly error: import("@angular/core").OutputEmitterRef<NbMediaError>;
|
|
175
|
+
/** What it shows and can do, as it changes: empty until it has loaded its source. */
|
|
176
|
+
readonly state: import("@angular/core").Signal<Partial<import("@liquid-js/lyr-extras/media").NbMediaState>>;
|
|
177
|
+
protected readonly frame: import("@angular/core").Signal<ElementRef<HTMLElement>>;
|
|
178
|
+
protected readonly mediaHost: import("@angular/core").Signal<ElementRef<HTMLElement>>;
|
|
179
|
+
protected readonly paused: import("@angular/core").Signal<boolean>;
|
|
180
|
+
protected readonly currentTime: import("@angular/core").Signal<number>;
|
|
181
|
+
protected readonly duration: import("@angular/core").Signal<number>;
|
|
182
|
+
protected readonly live: import("@angular/core").Signal<boolean>;
|
|
183
|
+
/** Whether it has a length to seek in. */
|
|
184
|
+
protected readonly seekable: import("@angular/core").Signal<boolean>;
|
|
185
|
+
protected readonly waiting: import("@angular/core").Signal<boolean>;
|
|
186
|
+
protected readonly failed: import("@angular/core").Signal<boolean>;
|
|
187
|
+
protected readonly volume: import("@angular/core").Signal<number>;
|
|
188
|
+
protected readonly volumeIcon: import("@angular/core").Signal<"volume-off-outline" | "volume-down-outline" | "volume-up-outline">;
|
|
189
|
+
/** Why it can't play its source, once for each reason. */
|
|
190
|
+
protected readonly mediaError: import("@angular/core").Signal<NbMediaError | undefined>;
|
|
191
|
+
protected readonly elapsed: import("@angular/core").Signal<string>;
|
|
192
|
+
protected readonly length: import("@angular/core").Signal<string>;
|
|
193
|
+
/** The position as assistive technologies read it, with the length. */
|
|
194
|
+
protected readonly formatPosition: (value: number) => string;
|
|
195
|
+
protected readonly formatVolume: (value: number) => string;
|
|
196
|
+
/** A speed, e.g. 1.5×, which reads left to right in every language, also where the select copies its text. */
|
|
197
|
+
protected readonly formatRate: (rate: number) => string;
|
|
198
|
+
constructor();
|
|
199
|
+
/** The player's Video.js store, once it has loaded its source, which plays, seeks and so on. */
|
|
200
|
+
get store(): NbMediaStore | undefined;
|
|
201
|
+
/** Plays, or pauses when it's playing. */
|
|
202
|
+
togglePlay(): void;
|
|
203
|
+
/** Goes to a position, in seconds; before the media has loaded, once it has. */
|
|
204
|
+
seek(time: number): void;
|
|
205
|
+
protected seekTo(time: number): void;
|
|
206
|
+
/** Mutes, or unmutes and brings the volume back when it was all the way down. */
|
|
207
|
+
toggleMuted(): void;
|
|
208
|
+
/** Sets the volume, from 0 to 1, unmuting it when it's above 0. */
|
|
209
|
+
setVolume(volume: number): void;
|
|
210
|
+
protected onPosition(value: NbSliderValue): void;
|
|
211
|
+
protected onVolume(value: NbSliderValue): void;
|
|
212
|
+
protected setRate(rate: number | null): void;
|
|
213
|
+
/** The keyboard: space or `k` plays, the arrows seek and set the volume, Home and End go to the ends, `m` mutes. */
|
|
214
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
215
|
+
protected handleKey(key: string): boolean;
|
|
216
|
+
/** Sets up the element the source plays in, before the engine attaches to it. */
|
|
217
|
+
protected prepare(element: HTMLElement, tracks: NbMediaTrack[]): void;
|
|
218
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbMediaPlayer, never>;
|
|
219
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NbMediaPlayer, never, never, {
|
|
220
|
+
"src": {
|
|
221
|
+
"alias": "src";
|
|
222
|
+
"required": true;
|
|
223
|
+
"isSignal": true;
|
|
224
|
+
};
|
|
225
|
+
"tracks": {
|
|
226
|
+
"alias": "tracks";
|
|
227
|
+
"required": false;
|
|
228
|
+
"isSignal": true;
|
|
229
|
+
};
|
|
230
|
+
"autoplay": {
|
|
231
|
+
"alias": "autoplay";
|
|
232
|
+
"required": false;
|
|
233
|
+
"isSignal": true;
|
|
234
|
+
};
|
|
235
|
+
"muted": {
|
|
236
|
+
"alias": "muted";
|
|
237
|
+
"required": false;
|
|
238
|
+
"isSignal": true;
|
|
239
|
+
};
|
|
240
|
+
"loop": {
|
|
241
|
+
"alias": "loop";
|
|
242
|
+
"required": false;
|
|
243
|
+
"isSignal": true;
|
|
244
|
+
};
|
|
245
|
+
"preload": {
|
|
246
|
+
"alias": "preload";
|
|
247
|
+
"required": false;
|
|
248
|
+
"isSignal": true;
|
|
249
|
+
};
|
|
250
|
+
"crossorigin": {
|
|
251
|
+
"alias": "crossorigin";
|
|
252
|
+
"required": false;
|
|
253
|
+
"isSignal": true;
|
|
254
|
+
};
|
|
255
|
+
"startTime": {
|
|
256
|
+
"alias": "startTime";
|
|
257
|
+
"required": false;
|
|
258
|
+
"isSignal": true;
|
|
259
|
+
};
|
|
260
|
+
"playbackRates": {
|
|
261
|
+
"alias": "playbackRates";
|
|
262
|
+
"required": false;
|
|
263
|
+
"isSignal": true;
|
|
264
|
+
};
|
|
265
|
+
"ariaLabel": {
|
|
266
|
+
"alias": "aria-label";
|
|
267
|
+
"required": false;
|
|
268
|
+
"isSignal": true;
|
|
269
|
+
};
|
|
270
|
+
"controls": {
|
|
271
|
+
"alias": "controls";
|
|
272
|
+
"required": false;
|
|
273
|
+
"isSignal": true;
|
|
274
|
+
};
|
|
275
|
+
}, {
|
|
276
|
+
"play": "play";
|
|
277
|
+
"pause": "pause";
|
|
278
|
+
"ended": "ended";
|
|
279
|
+
"timeUpdate": "timeUpdate";
|
|
280
|
+
"error": "error";
|
|
281
|
+
}, never, never, true, never>;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Plays audio in a compact bar with Lyra's controls: play, the position, volume and speed.
|
|
285
|
+
*
|
|
286
|
+
* ```html
|
|
287
|
+
* <nb-audio src="episode.mp3" aria-label="Episode 12" />
|
|
288
|
+
* ```
|
|
289
|
+
*
|
|
290
|
+
* @stacked-example(Showcase, media/audio-showcase.component)
|
|
291
|
+
*
|
|
292
|
+
* Audio files play in the browser. Streams play with an engine from Video.js 10, which `provideNbMediaPlayer` sets for
|
|
293
|
+
* their kind of source and loads when a player first needs it.
|
|
294
|
+
*
|
|
295
|
+
* It tells when it plays, pauses and ends, its position as it plays, and when it can't play its source, with the
|
|
296
|
+
* `play`, `pause`, `ended`, `timeUpdate` and `error` events. Without `controls`, it plays unseen, e.g. a sound that
|
|
297
|
+
* `togglePlay()` plays.
|
|
298
|
+
*
|
|
299
|
+
* With the focus on it, the keyboard controls it: space or `k` plays and pauses, the left and right arrows seek, Home
|
|
300
|
+
* and End go to the start and the end, up and down set the volume and `m` mutes.
|
|
301
|
+
*
|
|
302
|
+
* ### Installation
|
|
303
|
+
*
|
|
304
|
+
* The player needs `@videojs/core`, `@videojs/media` and `@videojs/store`, under the Apache 2.0 licence, which an app
|
|
305
|
+
* installs only when it uses it; import `NbAudioComponent` from `@liquid-js/lyr-extras/media`:
|
|
306
|
+
*
|
|
307
|
+
* ```bash
|
|
308
|
+
* npm install @videojs/core @videojs/media @videojs/store
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
export declare class NbAudioComponent extends NbMediaPlayer {
|
|
312
|
+
protected readonly kind = "audio";
|
|
313
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbAudioComponent, never>;
|
|
314
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NbAudioComponent, "nb-audio", never, {}, {}, never, never, true, never>;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Loads an engine when a player first needs one, so its code is only downloaded then, e.g.
|
|
318
|
+
* `() => import('@videojs/hlsjs-video').then((m) => m.HlsJsAdapter)`.
|
|
319
|
+
*/
|
|
320
|
+
export type NbMediaEngineLoader = () => NbMediaEngine | Promise<NbMediaEngine>;
|
|
321
|
+
/** Loads an extension when a player first needs one, so its code is only downloaded then. */
|
|
322
|
+
export type NbMediaExtensionLoader = () => NbMediaExtension | Promise<NbMediaExtension>;
|
|
323
|
+
/** The engines and extensions the players use. */
|
|
324
|
+
export interface NbMediaPlayerConfig {
|
|
325
|
+
/** An engine for each kind of source; video and audio files play in the browser without one. */
|
|
326
|
+
engines: Partial<Record<NbMediaSourceKind, NbMediaEngineLoader>>;
|
|
327
|
+
/** The extensions each player has. */
|
|
328
|
+
extensions: NbMediaExtensionLoader[];
|
|
329
|
+
}
|
|
330
|
+
/** The engines and extensions `provideNbMediaPlayer` sets. */
|
|
331
|
+
export declare const NB_MEDIA_PLAYER_CONFIG: InjectionToken<NbMediaPlayerConfig>;
|
|
332
|
+
/** A part of the players' setup, for `provideNbMediaPlayer`. */
|
|
333
|
+
export interface NbMediaPlayerFeature {
|
|
334
|
+
engines?: NbMediaPlayerConfig['engines'];
|
|
335
|
+
extensions?: NbMediaExtensionLoader[];
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Engines for kinds of source, each loaded when a player first plays one:
|
|
339
|
+
*
|
|
340
|
+
* ```ts
|
|
341
|
+
* withMediaEngines({
|
|
342
|
+
* hls: () => import('@videojs/hlsjs-video').then((m) => m.HlsJsAdapter),
|
|
343
|
+
* dash: () => import('@videojs/dash-video').then((m) => m.DashAdapter),
|
|
344
|
+
* youtube: () => import('@videojs/youtube-video').then((m) => m.YouTubeAdapter),
|
|
345
|
+
* })
|
|
346
|
+
* ```
|
|
347
|
+
*
|
|
348
|
+
* An engine that needs another element than its kind of source suggests says so:
|
|
349
|
+
* `() => import(...).then((m) => ({ adapter: m.SomeAdapter, element: 'iframe' }))`.
|
|
350
|
+
*/
|
|
351
|
+
export declare function withMediaEngines(engines: NbMediaPlayerConfig['engines']): NbMediaPlayerFeature;
|
|
352
|
+
/**
|
|
353
|
+
* Extensions every player has, each loaded when a player first plays a source, e.g. analytics:
|
|
354
|
+
*
|
|
355
|
+
* ```ts
|
|
356
|
+
* withMediaExtensions(() => import('./player-analytics').then((m) => m.playerAnalytics))
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
export declare function withMediaExtensions(...extensions: NbMediaExtensionLoader[]): NbMediaPlayerFeature;
|
|
360
|
+
/**
|
|
361
|
+
* Sets the engines and extensions of the video and audio players. Video and audio files play in the browser without
|
|
362
|
+
* any; streams and embeds need an engine for their kind of source, from Video.js 10's packages:
|
|
363
|
+
*
|
|
364
|
+
* ```ts
|
|
365
|
+
* bootstrapApplication(AppComponent, {
|
|
366
|
+
* providers: [
|
|
367
|
+
* provideNbMediaPlayer(
|
|
368
|
+
* withMediaEngines({ hls: () => import('@videojs/hlsjs-video').then((m) => m.HlsJsAdapter) }),
|
|
369
|
+
* ),
|
|
370
|
+
* ],
|
|
371
|
+
* });
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
* It sets them for the app, or for a route's or a component's players, on top of what's set above them.
|
|
375
|
+
*/
|
|
376
|
+
export declare function provideNbMediaPlayer(...features: NbMediaPlayerFeature[]): Provider;
|
|
377
|
+
/**
|
|
378
|
+
* The texts of the video and audio players. `provideNbTexts({ mediaPlayer: { ... } })` changes them, and they're
|
|
379
|
+
* translated with Angular's i18n, as `$localize` messages with ids like `@@nb.mediaPlayer.play`.
|
|
380
|
+
*/
|
|
381
|
+
interface NbMediaPlayerTexts {
|
|
382
|
+
/** Label of the button that plays. */
|
|
383
|
+
play: string;
|
|
384
|
+
/** Label of the button that pauses. */
|
|
385
|
+
pause: string;
|
|
386
|
+
/** Label of the button that mutes. */
|
|
387
|
+
mute: string;
|
|
388
|
+
/** Label of the button that unmutes. */
|
|
389
|
+
unmute: string;
|
|
390
|
+
/** Names the volume slider. */
|
|
391
|
+
volume: string;
|
|
392
|
+
/** Names the slider of the position in the media. */
|
|
393
|
+
position: string;
|
|
394
|
+
/** The position and the length, for assistive technologies, given both as text. */
|
|
395
|
+
time: (current: string, duration: string) => string;
|
|
396
|
+
/** Names the playback speed menu. */
|
|
397
|
+
speed: string;
|
|
398
|
+
/** Names the quality menu. */
|
|
399
|
+
quality: string;
|
|
400
|
+
/** The quality the player picks by itself. */
|
|
401
|
+
qualityAuto: string;
|
|
402
|
+
/** A quality by the video's height in pixels, e.g. "720p". */
|
|
403
|
+
qualityHeight: (height: string) => string;
|
|
404
|
+
/** A quality by its bitrate in kilobits a second, for audio or a stream without a height, e.g. "128 kbps". */
|
|
405
|
+
qualityBitrate: (kbps: string) => string;
|
|
406
|
+
/** Label of the button that shows captions. */
|
|
407
|
+
captions: string;
|
|
408
|
+
/** Label of the button that hides captions. */
|
|
409
|
+
captionsOff: string;
|
|
410
|
+
/** Label of the button that shows the video in a floating window. */
|
|
411
|
+
pictureInPicture: string;
|
|
412
|
+
/** Label of the button that brings the video back from its floating window. */
|
|
413
|
+
exitPictureInPicture: string;
|
|
414
|
+
/** Label of the button that shows the video on the whole screen. */
|
|
415
|
+
fullscreen: string;
|
|
416
|
+
/** Label of the button that leaves the whole screen. */
|
|
417
|
+
exitFullscreen: string;
|
|
418
|
+
/** Marks a live stream. */
|
|
419
|
+
live: string;
|
|
420
|
+
/** Shown when the media can't be played. */
|
|
421
|
+
error: string;
|
|
422
|
+
}
|
|
423
|
+
declare module '@liquid-js/lyr-core' {
|
|
424
|
+
interface NbTexts {
|
|
425
|
+
mediaPlayer: NbMediaPlayerTexts;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/** A quality of the video, as the quality menu lists it. */
|
|
429
|
+
interface Quality {
|
|
430
|
+
id: string;
|
|
431
|
+
label: string;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Plays a video with Lyra's controls: play, the position, volume, speed, quality, captions, picture in picture and full
|
|
435
|
+
* screen, as far as the video and the browser have them.
|
|
436
|
+
*
|
|
437
|
+
* ```html
|
|
438
|
+
* <nb-video src="lesson.mp4" poster="lesson.jpg"
|
|
439
|
+
* [tracks]="[{ src: 'lesson.en.vtt', srclang: 'en', label: 'English' }]" />
|
|
440
|
+
* ```
|
|
441
|
+
*
|
|
442
|
+
* @stacked-example(Showcase, media/video-showcase.component)
|
|
443
|
+
*
|
|
444
|
+
* Video files play in the browser. Streams and embeds play with an engine from Video.js 10, which
|
|
445
|
+
* `provideNbMediaPlayer` sets for their kind of source and loads when a player first needs it:
|
|
446
|
+
*
|
|
447
|
+
* ```ts
|
|
448
|
+
* provideNbMediaPlayer(withMediaEngines({ hls: () => import('@videojs/hlsjs-video').then((m) => m.HlsJsAdapter) }))
|
|
449
|
+
* ```
|
|
450
|
+
* @stacked-example(A stream in several qualities, media/video-stream.component)
|
|
451
|
+
*
|
|
452
|
+
* It tells when it plays, pauses and ends, its position as it plays, and when it can't play its source:
|
|
453
|
+
*
|
|
454
|
+
* ```html
|
|
455
|
+
* <nb-video src="lesson.mp4" (ended)="next()" (timeUpdate)="progress.set($event)" (error)="report($event)" />
|
|
456
|
+
* ```
|
|
457
|
+
*
|
|
458
|
+
* `startTime` starts each source further in, e.g. where the viewer left off, and `seek(time)` goes to a position, also
|
|
459
|
+
* before the video has loaded.
|
|
460
|
+
*
|
|
461
|
+
* Without `controls`, it's just the video, e.g. one playing silently in the background:
|
|
462
|
+
*
|
|
463
|
+
* ```html
|
|
464
|
+
* <nb-video src="clouds.mp4" [controls]="false" autoplay muted loop />
|
|
465
|
+
* ```
|
|
466
|
+
*
|
|
467
|
+
* It's 16:9 until its `aspect-ratio` says otherwise. With the focus on it, the keyboard controls it: space or `k`
|
|
468
|
+
* plays and pauses, the left and right arrows seek, Home and End go to the start and the end, up and down set the
|
|
469
|
+
* volume, `m` mutes, `c` shows captions and `f` goes full screen.
|
|
470
|
+
*
|
|
471
|
+
* ### Installation
|
|
472
|
+
*
|
|
473
|
+
* The player needs `@videojs/core`, `@videojs/media` and `@videojs/store`, under the Apache 2.0 licence, which an app
|
|
474
|
+
* installs only when it uses it; import `NbVideoComponent` from `@liquid-js/lyr-extras/media`:
|
|
475
|
+
*
|
|
476
|
+
* ```bash
|
|
477
|
+
* npm install @videojs/core @videojs/media @videojs/store
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
export declare class NbVideoComponent extends NbMediaPlayer {
|
|
481
|
+
protected readonly kind = "video";
|
|
482
|
+
/** The picture it shows before it plays. */
|
|
483
|
+
readonly poster: import("@angular/core").InputSignal<string | undefined>;
|
|
484
|
+
/** The captions showing now, which the player draws itself, above its controls. */
|
|
485
|
+
protected readonly cue: import("@angular/core").WritableSignal<string>;
|
|
486
|
+
/** Shows the paused frame in Safari's full screen, in the video's place. */
|
|
487
|
+
protected readonly still: import("@angular/core").Signal<ElementRef<HTMLCanvasElement>>;
|
|
488
|
+
/** The qualities to pick from: each size once, the largest first. */
|
|
489
|
+
protected readonly qualities: import("@angular/core").Signal<Quality[]>;
|
|
490
|
+
/** The quality picked, or `auto` when the player picks it by itself. */
|
|
491
|
+
protected readonly quality: import("@angular/core").Signal<string>;
|
|
492
|
+
protected readonly hasCaptions: import("@angular/core").Signal<boolean>;
|
|
493
|
+
constructor();
|
|
494
|
+
/** Shows the captions, or hides them. */
|
|
495
|
+
toggleCaptions(): void;
|
|
496
|
+
/** Shows the video on the whole screen, with its controls, or leaves it. */
|
|
497
|
+
toggleFullscreen(): void;
|
|
498
|
+
/** Shows the video in a floating window, or brings it back. */
|
|
499
|
+
togglePictureInPicture(): void;
|
|
500
|
+
/**
|
|
501
|
+
* Follows the captions or subtitles showing, which the browser would draw at the bottom of the video, under the
|
|
502
|
+
* controls; the template draws them instead. Returns what stops it.
|
|
503
|
+
*/
|
|
504
|
+
protected followCues(video: HTMLVideoElement): () => void;
|
|
505
|
+
protected setQuality(id: string | null): void;
|
|
506
|
+
protected handleKey(key: string): boolean;
|
|
507
|
+
protected prepare(element: HTMLElement, tracks: NbMediaTrack[]): void;
|
|
508
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NbVideoComponent, never>;
|
|
509
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NbVideoComponent, "nb-video", never, {
|
|
510
|
+
"poster": {
|
|
511
|
+
"alias": "poster";
|
|
512
|
+
"required": false;
|
|
513
|
+
"isSignal": true;
|
|
514
|
+
};
|
|
515
|
+
}, {}, never, never, true, never>;
|
|
516
|
+
}
|
|
517
|
+
export type { NbMediaPlayerTexts };
|