@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,1142 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, Directive, Injectable, InjectionToken, LOCALE_ID, ViewEncapsulation, afterRenderEffect, booleanAttribute, computed, inject, input, numberAttribute, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { NbButtonComponent, NbIconComponent, NbOptionComponent, NbOverlayHostDirective, NbSelectComponent, NbSliderComponent, NbSpinnerComponent, injectNbTexts } from "@liquid-js/lyr-core";
|
|
4
|
+
import { audioFeatures, videoFeatures } from "@videojs/core/dom";
|
|
5
|
+
import { resolveAdapterType } from "@videojs/media";
|
|
6
|
+
import { HTMLMediaAdapter, HTMLVideoAdapter } from "@videojs/media/dom";
|
|
7
|
+
import { combine, createStore } from "@videojs/store";
|
|
8
|
+
const NB_MEDIA_PLAYER_CONFIG = new InjectionToken("NB_MEDIA_PLAYER_CONFIG", { factory: () => ({
|
|
9
|
+
engines: {},
|
|
10
|
+
extensions: []
|
|
11
|
+
}) });
|
|
12
|
+
function withMediaEngines(engines) {
|
|
13
|
+
return { engines };
|
|
14
|
+
}
|
|
15
|
+
function withMediaExtensions(...extensions) {
|
|
16
|
+
return { extensions };
|
|
17
|
+
}
|
|
18
|
+
function provideNbMediaPlayer(...features) {
|
|
19
|
+
return {
|
|
20
|
+
provide: NB_MEDIA_PLAYER_CONFIG,
|
|
21
|
+
useFactory: () => {
|
|
22
|
+
const parent = inject(NB_MEDIA_PLAYER_CONFIG, {
|
|
23
|
+
skipSelf: true,
|
|
24
|
+
optional: true
|
|
25
|
+
});
|
|
26
|
+
const config = {
|
|
27
|
+
engines: { ...parent?.engines },
|
|
28
|
+
extensions: [...parent?.extensions ?? []]
|
|
29
|
+
};
|
|
30
|
+
for (const feature of features) {
|
|
31
|
+
Object.assign(config.engines, feature.engines);
|
|
32
|
+
config.extensions.push(...feature.extensions ?? []);
|
|
33
|
+
}
|
|
34
|
+
return config;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const EMBEDS = /* @__PURE__ */ new Set([
|
|
39
|
+
"youtube",
|
|
40
|
+
"vimeo",
|
|
41
|
+
"wistia",
|
|
42
|
+
"spotify",
|
|
43
|
+
"soundcloud",
|
|
44
|
+
"mixcloud",
|
|
45
|
+
"tiktok",
|
|
46
|
+
"twitch",
|
|
47
|
+
"dailymotion"
|
|
48
|
+
]);
|
|
49
|
+
const loads = /* @__PURE__ */ new WeakMap();
|
|
50
|
+
function loadOnce(loader) {
|
|
51
|
+
let load = loads.get(loader);
|
|
52
|
+
if (!load) {
|
|
53
|
+
load = Promise.resolve().then(loader);
|
|
54
|
+
loads.set(loader, load);
|
|
55
|
+
load.catch(() => loads.delete(loader));
|
|
56
|
+
}
|
|
57
|
+
return load;
|
|
58
|
+
}
|
|
59
|
+
var NbMediaController = class NbMediaController {
|
|
60
|
+
constructor() {
|
|
61
|
+
this.config = inject(NB_MEDIA_PLAYER_CONFIG);
|
|
62
|
+
this.loading = 0;
|
|
63
|
+
this.state = signal({}, {
|
|
64
|
+
...ngDevMode ? { debugName: "state" } : /* istanbul ignore next */ {},
|
|
65
|
+
equal: () => false
|
|
66
|
+
});
|
|
67
|
+
this.loadError = signal(void 0, ...ngDevMode ? [{ debugName: "loadError" }] : /* istanbul ignore next */ []);
|
|
68
|
+
this.element = signal(void 0, ...ngDevMode ? [{ debugName: "element" }] : /* istanbul ignore next */ []);
|
|
69
|
+
this.media = signal(void 0, ...ngDevMode ? [{ debugName: "media" }] : /* istanbul ignore next */ []);
|
|
70
|
+
inject(DestroyRef).onDestroy(() => {
|
|
71
|
+
this.stop();
|
|
72
|
+
this.store?.destroy();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
get current() {
|
|
76
|
+
return this.store;
|
|
77
|
+
}
|
|
78
|
+
stop() {
|
|
79
|
+
this.loading++;
|
|
80
|
+
this.unload?.();
|
|
81
|
+
this.unload = void 0;
|
|
82
|
+
this.element.set(void 0);
|
|
83
|
+
this.media.set(void 0);
|
|
84
|
+
this.loadError.set(void 0);
|
|
85
|
+
}
|
|
86
|
+
async load(host, container, source, media, prepare) {
|
|
87
|
+
this.stop();
|
|
88
|
+
const load = this.loading;
|
|
89
|
+
const { src, type, ...options } = source;
|
|
90
|
+
const kind = resolveAdapterType(src, type) ?? media;
|
|
91
|
+
let engine;
|
|
92
|
+
let extensions;
|
|
93
|
+
try {
|
|
94
|
+
[engine, extensions] = await Promise.all([this.engineFor(kind, media, host.ownerDocument), Promise.all(this.config.extensions.map((loader) => loadOnce(loader)))]);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (load === this.loading) this.loadError.set(error instanceof Error ? error.message : String(error));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (load !== this.loading) return;
|
|
100
|
+
const store = this.init(media);
|
|
101
|
+
const element = host.ownerDocument.createElement(engine.element);
|
|
102
|
+
prepare(element, engine.element);
|
|
103
|
+
host.append(element);
|
|
104
|
+
const adapter = new engine.adapter();
|
|
105
|
+
adapter.attach(element);
|
|
106
|
+
if (Object.keys(options).length && "source" in adapter) adapter.source = source;
|
|
107
|
+
else adapter.src = src;
|
|
108
|
+
const target = {
|
|
109
|
+
media: adapter,
|
|
110
|
+
container
|
|
111
|
+
};
|
|
112
|
+
const detach = store.attach(target);
|
|
113
|
+
const player = {
|
|
114
|
+
media: target.media,
|
|
115
|
+
element,
|
|
116
|
+
container,
|
|
117
|
+
store,
|
|
118
|
+
source
|
|
119
|
+
};
|
|
120
|
+
const cleanups = extensions.map((extension) => extension(player));
|
|
121
|
+
this.element.set(element);
|
|
122
|
+
this.media.set(adapter);
|
|
123
|
+
this.unload = () => {
|
|
124
|
+
for (const cleanup of cleanups) cleanup?.();
|
|
125
|
+
detach();
|
|
126
|
+
adapter.detach();
|
|
127
|
+
adapter.destroy();
|
|
128
|
+
element.remove();
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
init(media) {
|
|
132
|
+
if (!this.store) {
|
|
133
|
+
const store = createStore()(combine(...media === "video" ? videoFeatures : audioFeatures));
|
|
134
|
+
this.store = store;
|
|
135
|
+
this.state.set(store.state);
|
|
136
|
+
store.subscribe(() => this.state.set(store.state));
|
|
137
|
+
}
|
|
138
|
+
return this.store;
|
|
139
|
+
}
|
|
140
|
+
async engineFor(kind, media, document) {
|
|
141
|
+
const loader = this.config.engines[kind];
|
|
142
|
+
if (loader) {
|
|
143
|
+
const engine = await loadOnce(loader);
|
|
144
|
+
return typeof engine === "function" ? {
|
|
145
|
+
adapter: engine,
|
|
146
|
+
element: EMBEDS.has(kind) ? "iframe" : kind === "audio" ? "audio" : media
|
|
147
|
+
} : engine;
|
|
148
|
+
}
|
|
149
|
+
const native = {
|
|
150
|
+
adapter: media === "audio" ? HTMLMediaAdapter : HTMLVideoAdapter,
|
|
151
|
+
element: media
|
|
152
|
+
};
|
|
153
|
+
if (kind === "video" || kind === "audio") return native;
|
|
154
|
+
if (kind === "hls" && document.createElement("video").canPlayType("application/vnd.apple.mpegurl")) return native;
|
|
155
|
+
throw new Error(`No engine plays ${kind} sources; set one with withMediaEngines({ ${kind}: ... }).`);
|
|
156
|
+
}
|
|
157
|
+
static {
|
|
158
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
159
|
+
minVersion: "12.0.0",
|
|
160
|
+
version: "22.3.0",
|
|
161
|
+
ngImport: i0,
|
|
162
|
+
type: NbMediaController,
|
|
163
|
+
deps: [],
|
|
164
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
static {
|
|
168
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
169
|
+
minVersion: "12.0.0",
|
|
170
|
+
version: "22.3.0",
|
|
171
|
+
ngImport: i0,
|
|
172
|
+
type: NbMediaController
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
177
|
+
minVersion: "12.0.0",
|
|
178
|
+
version: "22.3.0",
|
|
179
|
+
ngImport: i0,
|
|
180
|
+
type: NbMediaController,
|
|
181
|
+
decorators: [{ type: Injectable }],
|
|
182
|
+
ctorParameters: () => []
|
|
183
|
+
});
|
|
184
|
+
function nbMediaPlayerTexts() {
|
|
185
|
+
return {
|
|
186
|
+
play: $localize`:@@nb.mediaPlayer.play:Play`,
|
|
187
|
+
pause: $localize`:@@nb.mediaPlayer.pause:Pause`,
|
|
188
|
+
mute: $localize`:@@nb.mediaPlayer.mute:Mute`,
|
|
189
|
+
unmute: $localize`:@@nb.mediaPlayer.unmute:Unmute`,
|
|
190
|
+
volume: $localize`:@@nb.mediaPlayer.volume:Volume`,
|
|
191
|
+
position: $localize`:@@nb.mediaPlayer.position:Position`,
|
|
192
|
+
time: (current, duration) => $localize`:@@nb.mediaPlayer.time:${current}:current: of ${duration}:duration:`,
|
|
193
|
+
speed: $localize`:@@nb.mediaPlayer.speed:Playback speed`,
|
|
194
|
+
quality: $localize`:@@nb.mediaPlayer.quality:Quality`,
|
|
195
|
+
qualityAuto: $localize`:@@nb.mediaPlayer.qualityAuto:Auto`,
|
|
196
|
+
qualityHeight: (height) => $localize`:@@nb.mediaPlayer.qualityHeight:${height}:height:p`,
|
|
197
|
+
qualityBitrate: (kbps) => $localize`:@@nb.mediaPlayer.qualityBitrate:${kbps}:kbps: kbps`,
|
|
198
|
+
captions: $localize`:@@nb.mediaPlayer.captions:Show captions`,
|
|
199
|
+
captionsOff: $localize`:@@nb.mediaPlayer.captionsOff:Hide captions`,
|
|
200
|
+
pictureInPicture: $localize`:@@nb.mediaPlayer.pictureInPicture:Picture in picture`,
|
|
201
|
+
exitPictureInPicture: $localize`:@@nb.mediaPlayer.exitPictureInPicture:Leave picture in picture`,
|
|
202
|
+
fullscreen: $localize`:@@nb.mediaPlayer.fullscreen:Full screen`,
|
|
203
|
+
exitFullscreen: $localize`:@@nb.mediaPlayer.exitFullscreen:Leave full screen`,
|
|
204
|
+
live: $localize`:@@nb.mediaPlayer.live:Live`,
|
|
205
|
+
error: $localize`:@@nb.mediaPlayer.error:This media can't be played.`
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function injectNbMediaPlayerTexts() {
|
|
209
|
+
return injectNbTexts("mediaPlayer", nbMediaPlayerTexts);
|
|
210
|
+
}
|
|
211
|
+
function nbFormatMediaTime(seconds, length = seconds) {
|
|
212
|
+
const total = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0;
|
|
213
|
+
const hours = Math.floor(total / 3600);
|
|
214
|
+
const minutes = Math.floor(total % 3600 / 60);
|
|
215
|
+
const rest = String(total % 60).padStart(2, "0");
|
|
216
|
+
return Number.isFinite(length) && length >= 3600 ? `${hours}:${String(minutes).padStart(2, "0")}:${rest}` : `${minutes}:${rest}`;
|
|
217
|
+
}
|
|
218
|
+
let nextId = 0;
|
|
219
|
+
var NbMediaPlayer = class NbMediaPlayer {
|
|
220
|
+
constructor() {
|
|
221
|
+
this.controller = inject(NbMediaController);
|
|
222
|
+
this.texts = injectNbMediaPlayerTexts();
|
|
223
|
+
this.id = `nb-media-${nextId++}`;
|
|
224
|
+
this.rateFormat = new Intl.NumberFormat(inject(LOCALE_ID), { maximumFractionDigits: 2 });
|
|
225
|
+
this.percentFormat = new Intl.NumberFormat(inject(LOCALE_ID), { style: "percent" });
|
|
226
|
+
this.src = input.required(...ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []);
|
|
227
|
+
this.tracks = input([], ...ngDevMode ? [{ debugName: "tracks" }] : /* istanbul ignore next */ []);
|
|
228
|
+
this.autoplay = input(false, {
|
|
229
|
+
...ngDevMode ? { debugName: "autoplay" } : /* istanbul ignore next */ {},
|
|
230
|
+
transform: booleanAttribute
|
|
231
|
+
});
|
|
232
|
+
this.muted = input(false, {
|
|
233
|
+
...ngDevMode ? { debugName: "muted" } : /* istanbul ignore next */ {},
|
|
234
|
+
transform: booleanAttribute
|
|
235
|
+
});
|
|
236
|
+
this.loop = input(false, {
|
|
237
|
+
...ngDevMode ? { debugName: "loop" } : /* istanbul ignore next */ {},
|
|
238
|
+
transform: booleanAttribute
|
|
239
|
+
});
|
|
240
|
+
this.preload = input("metadata", ...ngDevMode ? [{ debugName: "preload" }] : /* istanbul ignore next */ []);
|
|
241
|
+
this.crossorigin = input(void 0, ...ngDevMode ? [{ debugName: "crossorigin" }] : /* istanbul ignore next */ []);
|
|
242
|
+
this.startTime = input(0, {
|
|
243
|
+
...ngDevMode ? { debugName: "startTime" } : /* istanbul ignore next */ {},
|
|
244
|
+
transform: numberAttribute
|
|
245
|
+
});
|
|
246
|
+
this.playbackRates = input([
|
|
247
|
+
.5,
|
|
248
|
+
.75,
|
|
249
|
+
1,
|
|
250
|
+
1.25,
|
|
251
|
+
1.5,
|
|
252
|
+
2
|
|
253
|
+
], ...ngDevMode ? [{ debugName: "playbackRates" }] : /* istanbul ignore next */ []);
|
|
254
|
+
this.ariaLabel = input(void 0, {
|
|
255
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
256
|
+
alias: "aria-label"
|
|
257
|
+
});
|
|
258
|
+
this.controls = input(true, {
|
|
259
|
+
...ngDevMode ? { debugName: "controls" } : /* istanbul ignore next */ {},
|
|
260
|
+
transform: booleanAttribute
|
|
261
|
+
});
|
|
262
|
+
this.play = output();
|
|
263
|
+
this.pause = output();
|
|
264
|
+
this.ended = output();
|
|
265
|
+
this.timeUpdate = output();
|
|
266
|
+
this.error = output();
|
|
267
|
+
this.state = this.controller.state.asReadonly();
|
|
268
|
+
this.frame = viewChild.required("frame", ...ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []);
|
|
269
|
+
this.mediaHost = viewChild.required("media", ...ngDevMode ? [{ debugName: "mediaHost" }] : /* istanbul ignore next */ []);
|
|
270
|
+
this.paused = computed(() => this.state().paused ?? true, ...ngDevMode ? [{ debugName: "paused" }] : /* istanbul ignore next */ []);
|
|
271
|
+
this.currentTime = computed(() => this.state().currentTime ?? 0, ...ngDevMode ? [{ debugName: "currentTime" }] : /* istanbul ignore next */ []);
|
|
272
|
+
this.duration = computed(() => this.state().duration ?? 0, ...ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []);
|
|
273
|
+
this.live = computed(() => this.state().streamType === "live" || this.duration() === 1e400, ...ngDevMode ? [{ debugName: "live" }] : /* istanbul ignore next */ []);
|
|
274
|
+
this.seekable = computed(() => Number.isFinite(this.duration()) && this.duration() > 0, ...ngDevMode ? [{ debugName: "seekable" }] : /* istanbul ignore next */ []);
|
|
275
|
+
this.waiting = computed(() => !!this.state().waiting && !this.paused(), ...ngDevMode ? [{ debugName: "waiting" }] : /* istanbul ignore next */ []);
|
|
276
|
+
this.failed = computed(() => !!this.state().error || !!this.controller.loadError(), ...ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []);
|
|
277
|
+
this.volume = computed(() => this.state().muted ? 0 : this.state().volume ?? 1, ...ngDevMode ? [{ debugName: "volume" }] : /* istanbul ignore next */ []);
|
|
278
|
+
this.volumeIcon = computed(() => {
|
|
279
|
+
const volume = this.volume();
|
|
280
|
+
return volume === 0 ? "volume-off-outline" : volume < .5 ? "volume-down-outline" : "volume-up-outline";
|
|
281
|
+
}, ...ngDevMode ? [{ debugName: "volumeIcon" }] : /* istanbul ignore next */ []);
|
|
282
|
+
this.mediaError = computed(() => {
|
|
283
|
+
const loadError = this.controller.loadError();
|
|
284
|
+
const error = this.state().error;
|
|
285
|
+
return loadError ? { message: loadError } : error ? {
|
|
286
|
+
message: error.message,
|
|
287
|
+
code: error.code
|
|
288
|
+
} : void 0;
|
|
289
|
+
}, {
|
|
290
|
+
...ngDevMode ? { debugName: "mediaError" } : /* istanbul ignore next */ {},
|
|
291
|
+
equal: (a, b) => a?.message === b?.message && a?.code === b?.code
|
|
292
|
+
});
|
|
293
|
+
this.elapsed = computed(() => nbFormatMediaTime(this.currentTime(), this.duration()), ...ngDevMode ? [{ debugName: "elapsed" }] : /* istanbul ignore next */ []);
|
|
294
|
+
this.length = computed(() => nbFormatMediaTime(this.duration()), ...ngDevMode ? [{ debugName: "length" }] : /* istanbul ignore next */ []);
|
|
295
|
+
this.formatPosition = (value) => this.texts().time(nbFormatMediaTime(value, this.duration()), this.length());
|
|
296
|
+
this.formatVolume = (value) => this.percentFormat.format(value);
|
|
297
|
+
this.formatRate = (rate) => `\u2066${this.rateFormat.format(rate)}×\u2069`;
|
|
298
|
+
afterRenderEffect(() => {
|
|
299
|
+
const src = this.src();
|
|
300
|
+
const source = typeof src === "string" ? { src } : src;
|
|
301
|
+
const tracks = this.tracks();
|
|
302
|
+
untracked(() => {
|
|
303
|
+
const start = this.startTime();
|
|
304
|
+
this.pendingSeek = start > 0 ? start : void 0;
|
|
305
|
+
this.controller.load(this.mediaHost().nativeElement, this.frame().nativeElement, source, this.kind, (element) => this.prepare(element, tracks));
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
afterRenderEffect(() => {
|
|
309
|
+
const muted = this.muted();
|
|
310
|
+
untracked(() => this.controller.current?.setMuted(muted));
|
|
311
|
+
});
|
|
312
|
+
afterRenderEffect((onCleanup) => {
|
|
313
|
+
const media = this.controller.media();
|
|
314
|
+
if (!media) return;
|
|
315
|
+
const events = new AbortController();
|
|
316
|
+
const options = { signal: events.signal };
|
|
317
|
+
media.addEventListener("play", () => this.play.emit(), options);
|
|
318
|
+
media.addEventListener("pause", () => this.pause.emit(), options);
|
|
319
|
+
media.addEventListener("ended", () => this.ended.emit(), options);
|
|
320
|
+
media.addEventListener("timeupdate", () => this.timeUpdate.emit(media.currentTime), options);
|
|
321
|
+
const seekPending = () => {
|
|
322
|
+
const time = this.pendingSeek;
|
|
323
|
+
this.pendingSeek = void 0;
|
|
324
|
+
if (time !== void 0) this.seekTo(time);
|
|
325
|
+
};
|
|
326
|
+
media.addEventListener("loadedmetadata", seekPending, options);
|
|
327
|
+
if (media.readyState >= HTMLMediaElement.HAVE_METADATA) untracked(seekPending);
|
|
328
|
+
onCleanup(() => events.abort());
|
|
329
|
+
});
|
|
330
|
+
afterRenderEffect(() => {
|
|
331
|
+
const error = this.mediaError();
|
|
332
|
+
if (error) untracked(() => this.error.emit(error));
|
|
333
|
+
});
|
|
334
|
+
afterRenderEffect(() => {
|
|
335
|
+
const element = this.controller.element();
|
|
336
|
+
const loop = this.loop();
|
|
337
|
+
if (element instanceof HTMLMediaElement) element.loop = loop;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
get store() {
|
|
341
|
+
return this.controller.current;
|
|
342
|
+
}
|
|
343
|
+
togglePlay() {
|
|
344
|
+
const store = this.controller.current;
|
|
345
|
+
if (!store) return;
|
|
346
|
+
if (store.paused || store.ended) store.play().catch(() => {});
|
|
347
|
+
else store.pause();
|
|
348
|
+
}
|
|
349
|
+
seek(time) {
|
|
350
|
+
const media = this.controller.media();
|
|
351
|
+
if (!media || media.readyState < HTMLMediaElement.HAVE_METADATA) {
|
|
352
|
+
this.pendingSeek = Math.max(0, time);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
this.seekTo(time);
|
|
356
|
+
}
|
|
357
|
+
seekTo(time) {
|
|
358
|
+
const duration = this.duration();
|
|
359
|
+
const end = Number.isFinite(duration) && duration > 0 ? duration : 1e400;
|
|
360
|
+
this.controller.current?.seek(Math.max(0, Math.min(time, end))).catch(() => {});
|
|
361
|
+
}
|
|
362
|
+
toggleMuted() {
|
|
363
|
+
const store = this.controller.current;
|
|
364
|
+
if (!store) return;
|
|
365
|
+
if (this.volume() === 0) {
|
|
366
|
+
store.setMuted(false);
|
|
367
|
+
if (store.volume === 0) store.setVolume(.5);
|
|
368
|
+
} else store.setMuted(true);
|
|
369
|
+
}
|
|
370
|
+
setVolume(volume) {
|
|
371
|
+
const store = this.controller.current;
|
|
372
|
+
store?.setVolume(volume);
|
|
373
|
+
store?.setMuted(volume === 0);
|
|
374
|
+
}
|
|
375
|
+
onPosition(value) {
|
|
376
|
+
if (typeof value === "number" && Math.abs(value - this.currentTime()) > .05) this.seek(value);
|
|
377
|
+
}
|
|
378
|
+
onVolume(value) {
|
|
379
|
+
if (typeof value === "number" && value !== this.volume()) this.setVolume(value);
|
|
380
|
+
}
|
|
381
|
+
setRate(rate) {
|
|
382
|
+
if (rate !== null) this.controller.current?.setPlaybackRate(rate);
|
|
383
|
+
}
|
|
384
|
+
onKeydown(event) {
|
|
385
|
+
if (!this.controls() || event.target !== event.currentTarget || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
386
|
+
if (this.handleKey(event.key)) event.preventDefault();
|
|
387
|
+
}
|
|
388
|
+
handleKey(key) {
|
|
389
|
+
switch (key) {
|
|
390
|
+
case " ":
|
|
391
|
+
case "k":
|
|
392
|
+
this.togglePlay();
|
|
393
|
+
return true;
|
|
394
|
+
case "ArrowLeft":
|
|
395
|
+
case "ArrowRight":
|
|
396
|
+
this.seek(this.currentTime() + (key === "ArrowRight" ? 5 : -5));
|
|
397
|
+
return true;
|
|
398
|
+
case "Home":
|
|
399
|
+
case "End":
|
|
400
|
+
this.seek(key === "Home" ? 0 : this.duration());
|
|
401
|
+
return true;
|
|
402
|
+
case "ArrowUp":
|
|
403
|
+
case "ArrowDown":
|
|
404
|
+
this.setVolume(Math.max(0, Math.min(1, this.volume() + (key === "ArrowUp" ? .1 : -.1))));
|
|
405
|
+
return true;
|
|
406
|
+
case "m":
|
|
407
|
+
this.toggleMuted();
|
|
408
|
+
return true;
|
|
409
|
+
default: return false;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
prepare(element, tracks) {
|
|
413
|
+
if (element instanceof HTMLMediaElement) {
|
|
414
|
+
element.preload = this.preload();
|
|
415
|
+
element.autoplay = this.autoplay();
|
|
416
|
+
element.loop = this.loop();
|
|
417
|
+
element.muted = this.muted();
|
|
418
|
+
element.defaultMuted = this.muted();
|
|
419
|
+
const crossorigin = this.crossorigin();
|
|
420
|
+
if (crossorigin) element.crossOrigin = crossorigin;
|
|
421
|
+
for (const track of tracks) {
|
|
422
|
+
const child = element.ownerDocument.createElement("track");
|
|
423
|
+
child.src = track.src;
|
|
424
|
+
child.kind = track.kind ?? "subtitles";
|
|
425
|
+
child.srclang = track.srclang ?? "";
|
|
426
|
+
child.label = track.label ?? "";
|
|
427
|
+
child.default = !!track.default;
|
|
428
|
+
element.append(child);
|
|
429
|
+
}
|
|
430
|
+
} else if (element instanceof HTMLIFrameElement) {
|
|
431
|
+
element.allow = "autoplay; fullscreen; picture-in-picture; encrypted-media";
|
|
432
|
+
element.title = this.ariaLabel() ?? "";
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
static {
|
|
436
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
437
|
+
minVersion: "12.0.0",
|
|
438
|
+
version: "22.3.0",
|
|
439
|
+
ngImport: i0,
|
|
440
|
+
type: NbMediaPlayer,
|
|
441
|
+
deps: [],
|
|
442
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
static {
|
|
446
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
447
|
+
minVersion: "17.2.0",
|
|
448
|
+
version: "22.3.0",
|
|
449
|
+
type: NbMediaPlayer,
|
|
450
|
+
isStandalone: true,
|
|
451
|
+
inputs: {
|
|
452
|
+
src: {
|
|
453
|
+
classPropertyName: "src",
|
|
454
|
+
publicName: "src",
|
|
455
|
+
isSignal: true,
|
|
456
|
+
isRequired: true,
|
|
457
|
+
transformFunction: null
|
|
458
|
+
},
|
|
459
|
+
tracks: {
|
|
460
|
+
classPropertyName: "tracks",
|
|
461
|
+
publicName: "tracks",
|
|
462
|
+
isSignal: true,
|
|
463
|
+
isRequired: false,
|
|
464
|
+
transformFunction: null
|
|
465
|
+
},
|
|
466
|
+
autoplay: {
|
|
467
|
+
classPropertyName: "autoplay",
|
|
468
|
+
publicName: "autoplay",
|
|
469
|
+
isSignal: true,
|
|
470
|
+
isRequired: false,
|
|
471
|
+
transformFunction: null
|
|
472
|
+
},
|
|
473
|
+
muted: {
|
|
474
|
+
classPropertyName: "muted",
|
|
475
|
+
publicName: "muted",
|
|
476
|
+
isSignal: true,
|
|
477
|
+
isRequired: false,
|
|
478
|
+
transformFunction: null
|
|
479
|
+
},
|
|
480
|
+
loop: {
|
|
481
|
+
classPropertyName: "loop",
|
|
482
|
+
publicName: "loop",
|
|
483
|
+
isSignal: true,
|
|
484
|
+
isRequired: false,
|
|
485
|
+
transformFunction: null
|
|
486
|
+
},
|
|
487
|
+
preload: {
|
|
488
|
+
classPropertyName: "preload",
|
|
489
|
+
publicName: "preload",
|
|
490
|
+
isSignal: true,
|
|
491
|
+
isRequired: false,
|
|
492
|
+
transformFunction: null
|
|
493
|
+
},
|
|
494
|
+
crossorigin: {
|
|
495
|
+
classPropertyName: "crossorigin",
|
|
496
|
+
publicName: "crossorigin",
|
|
497
|
+
isSignal: true,
|
|
498
|
+
isRequired: false,
|
|
499
|
+
transformFunction: null
|
|
500
|
+
},
|
|
501
|
+
startTime: {
|
|
502
|
+
classPropertyName: "startTime",
|
|
503
|
+
publicName: "startTime",
|
|
504
|
+
isSignal: true,
|
|
505
|
+
isRequired: false,
|
|
506
|
+
transformFunction: null
|
|
507
|
+
},
|
|
508
|
+
playbackRates: {
|
|
509
|
+
classPropertyName: "playbackRates",
|
|
510
|
+
publicName: "playbackRates",
|
|
511
|
+
isSignal: true,
|
|
512
|
+
isRequired: false,
|
|
513
|
+
transformFunction: null
|
|
514
|
+
},
|
|
515
|
+
ariaLabel: {
|
|
516
|
+
classPropertyName: "ariaLabel",
|
|
517
|
+
publicName: "aria-label",
|
|
518
|
+
isSignal: true,
|
|
519
|
+
isRequired: false,
|
|
520
|
+
transformFunction: null
|
|
521
|
+
},
|
|
522
|
+
controls: {
|
|
523
|
+
classPropertyName: "controls",
|
|
524
|
+
publicName: "controls",
|
|
525
|
+
isSignal: true,
|
|
526
|
+
isRequired: false,
|
|
527
|
+
transformFunction: null
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
outputs: {
|
|
531
|
+
play: "play",
|
|
532
|
+
pause: "pause",
|
|
533
|
+
ended: "ended",
|
|
534
|
+
timeUpdate: "timeUpdate",
|
|
535
|
+
error: "error"
|
|
536
|
+
},
|
|
537
|
+
viewQueries: [{
|
|
538
|
+
propertyName: "frame",
|
|
539
|
+
first: true,
|
|
540
|
+
predicate: ["frame"],
|
|
541
|
+
descendants: true,
|
|
542
|
+
isSignal: true
|
|
543
|
+
}, {
|
|
544
|
+
propertyName: "mediaHost",
|
|
545
|
+
first: true,
|
|
546
|
+
predicate: ["media"],
|
|
547
|
+
descendants: true,
|
|
548
|
+
isSignal: true
|
|
549
|
+
}],
|
|
550
|
+
ngImport: i0
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
555
|
+
minVersion: "12.0.0",
|
|
556
|
+
version: "22.3.0",
|
|
557
|
+
ngImport: i0,
|
|
558
|
+
type: NbMediaPlayer,
|
|
559
|
+
decorators: [{ type: Directive }],
|
|
560
|
+
ctorParameters: () => [],
|
|
561
|
+
propDecorators: {
|
|
562
|
+
src: [{
|
|
563
|
+
type: i0.Input,
|
|
564
|
+
args: [{
|
|
565
|
+
isSignal: true,
|
|
566
|
+
alias: "src",
|
|
567
|
+
required: true
|
|
568
|
+
}]
|
|
569
|
+
}],
|
|
570
|
+
tracks: [{
|
|
571
|
+
type: i0.Input,
|
|
572
|
+
args: [{
|
|
573
|
+
isSignal: true,
|
|
574
|
+
alias: "tracks",
|
|
575
|
+
required: false
|
|
576
|
+
}]
|
|
577
|
+
}],
|
|
578
|
+
autoplay: [{
|
|
579
|
+
type: i0.Input,
|
|
580
|
+
args: [{
|
|
581
|
+
isSignal: true,
|
|
582
|
+
alias: "autoplay",
|
|
583
|
+
required: false
|
|
584
|
+
}]
|
|
585
|
+
}],
|
|
586
|
+
muted: [{
|
|
587
|
+
type: i0.Input,
|
|
588
|
+
args: [{
|
|
589
|
+
isSignal: true,
|
|
590
|
+
alias: "muted",
|
|
591
|
+
required: false
|
|
592
|
+
}]
|
|
593
|
+
}],
|
|
594
|
+
loop: [{
|
|
595
|
+
type: i0.Input,
|
|
596
|
+
args: [{
|
|
597
|
+
isSignal: true,
|
|
598
|
+
alias: "loop",
|
|
599
|
+
required: false
|
|
600
|
+
}]
|
|
601
|
+
}],
|
|
602
|
+
preload: [{
|
|
603
|
+
type: i0.Input,
|
|
604
|
+
args: [{
|
|
605
|
+
isSignal: true,
|
|
606
|
+
alias: "preload",
|
|
607
|
+
required: false
|
|
608
|
+
}]
|
|
609
|
+
}],
|
|
610
|
+
crossorigin: [{
|
|
611
|
+
type: i0.Input,
|
|
612
|
+
args: [{
|
|
613
|
+
isSignal: true,
|
|
614
|
+
alias: "crossorigin",
|
|
615
|
+
required: false
|
|
616
|
+
}]
|
|
617
|
+
}],
|
|
618
|
+
startTime: [{
|
|
619
|
+
type: i0.Input,
|
|
620
|
+
args: [{
|
|
621
|
+
isSignal: true,
|
|
622
|
+
alias: "startTime",
|
|
623
|
+
required: false
|
|
624
|
+
}]
|
|
625
|
+
}],
|
|
626
|
+
playbackRates: [{
|
|
627
|
+
type: i0.Input,
|
|
628
|
+
args: [{
|
|
629
|
+
isSignal: true,
|
|
630
|
+
alias: "playbackRates",
|
|
631
|
+
required: false
|
|
632
|
+
}]
|
|
633
|
+
}],
|
|
634
|
+
ariaLabel: [{
|
|
635
|
+
type: i0.Input,
|
|
636
|
+
args: [{
|
|
637
|
+
isSignal: true,
|
|
638
|
+
alias: "aria-label",
|
|
639
|
+
required: false
|
|
640
|
+
}]
|
|
641
|
+
}],
|
|
642
|
+
controls: [{
|
|
643
|
+
type: i0.Input,
|
|
644
|
+
args: [{
|
|
645
|
+
isSignal: true,
|
|
646
|
+
alias: "controls",
|
|
647
|
+
required: false
|
|
648
|
+
}]
|
|
649
|
+
}],
|
|
650
|
+
play: [{
|
|
651
|
+
type: i0.Output,
|
|
652
|
+
args: ["play"]
|
|
653
|
+
}],
|
|
654
|
+
pause: [{
|
|
655
|
+
type: i0.Output,
|
|
656
|
+
args: ["pause"]
|
|
657
|
+
}],
|
|
658
|
+
ended: [{
|
|
659
|
+
type: i0.Output,
|
|
660
|
+
args: ["ended"]
|
|
661
|
+
}],
|
|
662
|
+
timeUpdate: [{
|
|
663
|
+
type: i0.Output,
|
|
664
|
+
args: ["timeUpdate"]
|
|
665
|
+
}],
|
|
666
|
+
error: [{
|
|
667
|
+
type: i0.Output,
|
|
668
|
+
args: ["error"]
|
|
669
|
+
}],
|
|
670
|
+
frame: [{
|
|
671
|
+
type: i0.ViewChild,
|
|
672
|
+
args: ["frame", { isSignal: true }]
|
|
673
|
+
}],
|
|
674
|
+
mediaHost: [{
|
|
675
|
+
type: i0.ViewChild,
|
|
676
|
+
args: ["media", { isSignal: true }]
|
|
677
|
+
}]
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
var NbAudioComponent = class NbAudioComponent extends NbMediaPlayer {
|
|
681
|
+
constructor() {
|
|
682
|
+
super(...arguments);
|
|
683
|
+
this.kind = "audio";
|
|
684
|
+
}
|
|
685
|
+
static {
|
|
686
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
687
|
+
minVersion: "12.0.0",
|
|
688
|
+
version: "22.3.0",
|
|
689
|
+
ngImport: i0,
|
|
690
|
+
type: NbAudioComponent,
|
|
691
|
+
deps: null,
|
|
692
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
static {
|
|
696
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
697
|
+
minVersion: "17.0.0",
|
|
698
|
+
version: "22.3.0",
|
|
699
|
+
type: NbAudioComponent,
|
|
700
|
+
isStandalone: true,
|
|
701
|
+
selector: "nb-audio",
|
|
702
|
+
providers: [NbMediaController],
|
|
703
|
+
usesInheritance: true,
|
|
704
|
+
ngImport: i0,
|
|
705
|
+
template: "<div #frame\n class=\"frame\"\n [attr.role]=\"controls() ? 'group' : null\"\n [attr.tabindex]=\"controls() ? 0 : null\"\n [attr.aria-label]=\"controls() ? ariaLabel() : null\"\n [class.bare]=\"!controls()\"\n (keydown)=\"onKeydown($event)\">\n <div #media\n class=\"media\"></div>\n\n <button nbButton\n class=\"play\"\n appearance=\"filled\"\n status=\"primary\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"paused() ? texts().play : texts().pause\"\n (click)=\"togglePlay()\">\n <nb-icon [icon]=\"paused() ? 'play' : 'pause'\"\n pack=\"essentials\" />\n </button>\n\n @if (failed()) {\n <span class=\"message\"\n role=\"alert\">{{ texts().error }}</span>\n } @else if (live()) {\n <span class=\"live\">{{ texts().live }}</span>\n } @else {\n <span class=\"time\"\n dir=\"ltr\"\n aria-hidden=\"true\">{{ elapsed() }}</span>\n <nb-slider class=\"position\"\n size=\"medium\"\n [min]=\"0\"\n [max]=\"seekable() ? duration() : 1\"\n [step]=\"0.1\"\n [labels]=\"false\"\n [showValue]=\"false\"\n [disabled]=\"!seekable()\"\n [formatValue]=\"formatPosition\"\n [value]=\"currentTime()\"\n (valueChange)=\"onPosition($event)\"\n [aria-label]=\"texts().position\" />\n <span class=\"time\"\n dir=\"ltr\"\n aria-hidden=\"true\">{{ length() }}</span>\n }\n\n <button nbButton\n ghost\n status=\"basic\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"volume() === 0 ? texts().unmute : texts().mute\"\n (click)=\"toggleMuted()\">\n <nb-icon [icon]=\"volumeIcon()\"\n pack=\"essentials\" />\n </button>\n <nb-slider class=\"volume\"\n size=\"medium\"\n [min]=\"0\"\n [max]=\"1\"\n [step]=\"0.05\"\n [labels]=\"false\"\n [showValue]=\"false\"\n [formatValue]=\"formatVolume\"\n [value]=\"volume()\"\n (valueChange)=\"onVolume($event)\"\n [aria-label]=\"texts().volume\" />\n\n @if (!live()) {\n <span hidden\n [id]=\"id + '-speed'\">{{ texts().speed }}</span>\n <nb-select class=\"speed\"\n appearance=\"ghost\"\n size=\"small\"\n [aria-labelledby]=\"id + '-speed'\"\n [selected]=\"state().playbackRate ?? 1\"\n (selectedChange)=\"setRate($event)\">\n @for (rate of playbackRates(); track rate) {\n <nb-option [value]=\"rate\">{{ formatRate(rate) }}</nb-option>\n }\n </nb-select>\n }\n</div>\n",
|
|
706
|
+
styles: ["nb-audio{display:block;container-type:inline-size}nb-audio>.frame{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:var(--border-radius);background:var(--background-basic-color-2);color:var(--text-basic-color);font-family:var(--font-family-primary)}nb-audio>.frame:focus-visible{outline:none;box-shadow:0 0 0 var(--outline-width) var(--outline-color)}nb-audio>.frame.bare{display:none}nb-audio .media{display:none}nb-audio .play{flex-shrink:0}nb-audio .position{flex:1;min-width:4rem}nb-audio .volume{flex:0 1 5rem;min-width:3rem}nb-audio .time,nb-audio .live,nb-audio .message{font-size:var(--text-paragraph-2-font-size);font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--text-hint-color)}nb-audio .live,nb-audio .message{flex:1}nb-audio .live{font-weight:600;letter-spacing:.05em;text-transform:uppercase}nb-audio .message{color:var(--text-danger-color);white-space:normal}nb-audio .speed{--select-small-width: 4.5rem}nb-audio [nbButton]{flex-shrink:0}@container (max-width: 24rem){nb-audio .volume,nb-audio .speed{display:none}}\n"],
|
|
707
|
+
dependencies: [
|
|
708
|
+
{
|
|
709
|
+
kind: "component",
|
|
710
|
+
type: NbButtonComponent,
|
|
711
|
+
selector: "button[nbButton],a[nbButton],input[type=\"button\"][nbButton],input[type=\"submit\"][nbButton]",
|
|
712
|
+
inputs: ["hero", "loading"]
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
kind: "component",
|
|
716
|
+
type: NbIconComponent,
|
|
717
|
+
selector: "nb-icon",
|
|
718
|
+
inputs: [
|
|
719
|
+
"icon",
|
|
720
|
+
"pack",
|
|
721
|
+
"options",
|
|
722
|
+
"status",
|
|
723
|
+
"config"
|
|
724
|
+
]
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
kind: "component",
|
|
728
|
+
type: NbOptionComponent,
|
|
729
|
+
selector: "nb-option",
|
|
730
|
+
inputs: [
|
|
731
|
+
"value",
|
|
732
|
+
"disabled",
|
|
733
|
+
"selectAll"
|
|
734
|
+
],
|
|
735
|
+
outputs: ["selectionChange"]
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
kind: "component",
|
|
739
|
+
type: NbSelectComponent,
|
|
740
|
+
selector: "nb-select",
|
|
741
|
+
inputs: [
|
|
742
|
+
"size",
|
|
743
|
+
"status",
|
|
744
|
+
"shape",
|
|
745
|
+
"appearance",
|
|
746
|
+
"optionsListClass",
|
|
747
|
+
"optionsPanelClass",
|
|
748
|
+
"tabIndex",
|
|
749
|
+
"optionsWidth",
|
|
750
|
+
"outline",
|
|
751
|
+
"filled",
|
|
752
|
+
"hero",
|
|
753
|
+
"ghost",
|
|
754
|
+
"disabled",
|
|
755
|
+
"fullWidth",
|
|
756
|
+
"placeholder",
|
|
757
|
+
"aria-labelledby",
|
|
758
|
+
"compareWith",
|
|
759
|
+
"selected",
|
|
760
|
+
"multiple",
|
|
761
|
+
"nullable",
|
|
762
|
+
"chips",
|
|
763
|
+
"maxSelections",
|
|
764
|
+
"searchable",
|
|
765
|
+
"searchFn",
|
|
766
|
+
"overlayOffset",
|
|
767
|
+
"scrollStrategy",
|
|
768
|
+
"nestedLevels"
|
|
769
|
+
],
|
|
770
|
+
outputs: ["selectedChange"]
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
kind: "component",
|
|
774
|
+
type: NbSliderComponent,
|
|
775
|
+
selector: "nb-slider",
|
|
776
|
+
inputs: [
|
|
777
|
+
"min",
|
|
778
|
+
"max",
|
|
779
|
+
"step",
|
|
780
|
+
"center",
|
|
781
|
+
"range",
|
|
782
|
+
"vertical",
|
|
783
|
+
"ticks",
|
|
784
|
+
"labels",
|
|
785
|
+
"showValue",
|
|
786
|
+
"transform",
|
|
787
|
+
"formatValue",
|
|
788
|
+
"status",
|
|
789
|
+
"size",
|
|
790
|
+
"disabled",
|
|
791
|
+
"aria-label",
|
|
792
|
+
"aria-labelledby",
|
|
793
|
+
"value"
|
|
794
|
+
],
|
|
795
|
+
outputs: ["valueChange"]
|
|
796
|
+
}
|
|
797
|
+
],
|
|
798
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
799
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
804
|
+
minVersion: "12.0.0",
|
|
805
|
+
version: "22.3.0",
|
|
806
|
+
ngImport: i0,
|
|
807
|
+
type: NbAudioComponent,
|
|
808
|
+
decorators: [{
|
|
809
|
+
type: Component,
|
|
810
|
+
args: [{
|
|
811
|
+
selector: "nb-audio",
|
|
812
|
+
encapsulation: ViewEncapsulation.None,
|
|
813
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
814
|
+
providers: [NbMediaController],
|
|
815
|
+
imports: [
|
|
816
|
+
NbButtonComponent,
|
|
817
|
+
NbIconComponent,
|
|
818
|
+
NbOptionComponent,
|
|
819
|
+
NbSelectComponent,
|
|
820
|
+
NbSliderComponent
|
|
821
|
+
],
|
|
822
|
+
template: "<div #frame\n class=\"frame\"\n [attr.role]=\"controls() ? 'group' : null\"\n [attr.tabindex]=\"controls() ? 0 : null\"\n [attr.aria-label]=\"controls() ? ariaLabel() : null\"\n [class.bare]=\"!controls()\"\n (keydown)=\"onKeydown($event)\">\n <div #media\n class=\"media\"></div>\n\n <button nbButton\n class=\"play\"\n appearance=\"filled\"\n status=\"primary\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"paused() ? texts().play : texts().pause\"\n (click)=\"togglePlay()\">\n <nb-icon [icon]=\"paused() ? 'play' : 'pause'\"\n pack=\"essentials\" />\n </button>\n\n @if (failed()) {\n <span class=\"message\"\n role=\"alert\">{{ texts().error }}</span>\n } @else if (live()) {\n <span class=\"live\">{{ texts().live }}</span>\n } @else {\n <span class=\"time\"\n dir=\"ltr\"\n aria-hidden=\"true\">{{ elapsed() }}</span>\n <nb-slider class=\"position\"\n size=\"medium\"\n [min]=\"0\"\n [max]=\"seekable() ? duration() : 1\"\n [step]=\"0.1\"\n [labels]=\"false\"\n [showValue]=\"false\"\n [disabled]=\"!seekable()\"\n [formatValue]=\"formatPosition\"\n [value]=\"currentTime()\"\n (valueChange)=\"onPosition($event)\"\n [aria-label]=\"texts().position\" />\n <span class=\"time\"\n dir=\"ltr\"\n aria-hidden=\"true\">{{ length() }}</span>\n }\n\n <button nbButton\n ghost\n status=\"basic\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"volume() === 0 ? texts().unmute : texts().mute\"\n (click)=\"toggleMuted()\">\n <nb-icon [icon]=\"volumeIcon()\"\n pack=\"essentials\" />\n </button>\n <nb-slider class=\"volume\"\n size=\"medium\"\n [min]=\"0\"\n [max]=\"1\"\n [step]=\"0.05\"\n [labels]=\"false\"\n [showValue]=\"false\"\n [formatValue]=\"formatVolume\"\n [value]=\"volume()\"\n (valueChange)=\"onVolume($event)\"\n [aria-label]=\"texts().volume\" />\n\n @if (!live()) {\n <span hidden\n [id]=\"id + '-speed'\">{{ texts().speed }}</span>\n <nb-select class=\"speed\"\n appearance=\"ghost\"\n size=\"small\"\n [aria-labelledby]=\"id + '-speed'\"\n [selected]=\"state().playbackRate ?? 1\"\n (selectedChange)=\"setRate($event)\">\n @for (rate of playbackRates(); track rate) {\n <nb-option [value]=\"rate\">{{ formatRate(rate) }}</nb-option>\n }\n </nb-select>\n }\n</div>\n",
|
|
823
|
+
styles: ["nb-audio{display:block;container-type:inline-size}nb-audio>.frame{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:var(--border-radius);background:var(--background-basic-color-2);color:var(--text-basic-color);font-family:var(--font-family-primary)}nb-audio>.frame:focus-visible{outline:none;box-shadow:0 0 0 var(--outline-width) var(--outline-color)}nb-audio>.frame.bare{display:none}nb-audio .media{display:none}nb-audio .play{flex-shrink:0}nb-audio .position{flex:1;min-width:4rem}nb-audio .volume{flex:0 1 5rem;min-width:3rem}nb-audio .time,nb-audio .live,nb-audio .message{font-size:var(--text-paragraph-2-font-size);font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--text-hint-color)}nb-audio .live,nb-audio .message{flex:1}nb-audio .live{font-weight:600;letter-spacing:.05em;text-transform:uppercase}nb-audio .message{color:var(--text-danger-color);white-space:normal}nb-audio .speed{--select-small-width: 4.5rem}nb-audio [nbButton]{flex-shrink:0}@container (max-width: 24rem){nb-audio .volume,nb-audio .speed{display:none}}\n"]
|
|
824
|
+
}]
|
|
825
|
+
}]
|
|
826
|
+
});
|
|
827
|
+
function nbHoldPausedFrame(video, container, still) {
|
|
828
|
+
if (!("webkitSetPresentationMode" in video)) return () => {};
|
|
829
|
+
const document = container.ownerDocument;
|
|
830
|
+
const fullscreen = () => (document.fullscreenElement ?? document.webkitFullscreenElement) === container;
|
|
831
|
+
const release = () => {
|
|
832
|
+
still.classList.remove("shown");
|
|
833
|
+
video.style.removeProperty("width");
|
|
834
|
+
video.style.removeProperty("height");
|
|
835
|
+
};
|
|
836
|
+
const hold = () => {
|
|
837
|
+
if (!video.played.length || video.readyState < HTMLMediaElement.HAVE_CURRENT_DATA || !video.videoWidth) return;
|
|
838
|
+
try {
|
|
839
|
+
still.width = video.videoWidth;
|
|
840
|
+
still.height = video.videoHeight;
|
|
841
|
+
still.getContext("2d")?.drawImage(video, 0, 0);
|
|
842
|
+
} catch {
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
still.classList.add("shown");
|
|
846
|
+
video.style.width = "0";
|
|
847
|
+
video.style.height = "0";
|
|
848
|
+
};
|
|
849
|
+
const update = () => video.paused && !video.seeking && fullscreen() ? hold() : release();
|
|
850
|
+
const controller = new AbortController();
|
|
851
|
+
const options = { signal: controller.signal };
|
|
852
|
+
for (const type of [
|
|
853
|
+
"pause",
|
|
854
|
+
"seeked",
|
|
855
|
+
"ended"
|
|
856
|
+
]) video.addEventListener(type, update, options);
|
|
857
|
+
video.addEventListener("play", release, options);
|
|
858
|
+
video.addEventListener("seeking", release, options);
|
|
859
|
+
document.addEventListener("fullscreenchange", update, options);
|
|
860
|
+
document.addEventListener("webkitfullscreenchange", update, options);
|
|
861
|
+
update();
|
|
862
|
+
return () => {
|
|
863
|
+
controller.abort();
|
|
864
|
+
release();
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
var NbVideoComponent = class NbVideoComponent extends NbMediaPlayer {
|
|
868
|
+
constructor() {
|
|
869
|
+
super();
|
|
870
|
+
this.kind = "video";
|
|
871
|
+
this.poster = input(void 0, ...ngDevMode ? [{ debugName: "poster" }] : /* istanbul ignore next */ []);
|
|
872
|
+
this.cue = signal("", ...ngDevMode ? [{ debugName: "cue" }] : /* istanbul ignore next */ []);
|
|
873
|
+
this.still = viewChild.required("still", ...ngDevMode ? [{ debugName: "still" }] : /* istanbul ignore next */ []);
|
|
874
|
+
this.qualities = computed(() => {
|
|
875
|
+
const seen = /* @__PURE__ */ new Set();
|
|
876
|
+
const texts = this.texts();
|
|
877
|
+
return [...this.state().videoRenditionList ?? []].sort((a, b) => (b.height ?? 0) - (a.height ?? 0) || (b.bitrate ?? 0) - (a.bitrate ?? 0)).map((rendition) => ({
|
|
878
|
+
id: rendition.id,
|
|
879
|
+
label: rendition.height ? texts.qualityHeight(String(rendition.height)) : rendition.bitrate ? texts.qualityBitrate(String(Math.round(rendition.bitrate / 1e3))) : rendition.id
|
|
880
|
+
})).filter(({ label }) => !seen.has(label) && !!seen.add(label));
|
|
881
|
+
}, ...ngDevMode ? [{ debugName: "qualities" }] : /* istanbul ignore next */ []);
|
|
882
|
+
this.quality = computed(() => this.state().videoRenditionList?.find((rendition) => rendition.selected)?.id ?? "auto", ...ngDevMode ? [{ debugName: "quality" }] : /* istanbul ignore next */ []);
|
|
883
|
+
this.hasCaptions = computed(() => (this.state().textTrackList ?? []).some((track) => track.kind === "subtitles" || track.kind === "captions"), ...ngDevMode ? [{ debugName: "hasCaptions" }] : /* istanbul ignore next */ []);
|
|
884
|
+
afterRenderEffect(() => {
|
|
885
|
+
const element = this.controller.element();
|
|
886
|
+
const poster = this.poster() ?? "";
|
|
887
|
+
if (element instanceof HTMLVideoElement && element.poster !== poster) element.poster = poster;
|
|
888
|
+
});
|
|
889
|
+
afterRenderEffect((onCleanup) => {
|
|
890
|
+
const element = this.controller.element();
|
|
891
|
+
if (element instanceof HTMLVideoElement) onCleanup(this.followCues(element));
|
|
892
|
+
});
|
|
893
|
+
afterRenderEffect((onCleanup) => {
|
|
894
|
+
const element = this.controller.element();
|
|
895
|
+
if (element instanceof HTMLVideoElement) onCleanup(nbHoldPausedFrame(element, this.frame().nativeElement, this.still().nativeElement));
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
toggleCaptions() {
|
|
899
|
+
this.store?.toggleSubtitles?.();
|
|
900
|
+
}
|
|
901
|
+
toggleFullscreen() {
|
|
902
|
+
const store = this.store;
|
|
903
|
+
if (store?.fullscreenAvailability !== "available") return;
|
|
904
|
+
(store.isFullscreen ? store.exitFullscreen?.() : store.requestFullscreen?.())?.catch(() => {});
|
|
905
|
+
}
|
|
906
|
+
togglePictureInPicture() {
|
|
907
|
+
const store = this.store;
|
|
908
|
+
if (store?.pictureInPictureAvailability !== "available") return;
|
|
909
|
+
(store.isPictureInPicture ? store.exitPictureInPicture?.() : store.requestPictureInPicture?.())?.catch(() => {});
|
|
910
|
+
}
|
|
911
|
+
followCues(video) {
|
|
912
|
+
const tracks = video.textTracks;
|
|
913
|
+
const update = () => {
|
|
914
|
+
const lines = new Array();
|
|
915
|
+
for (const track of tracks) if (track.mode === "showing" && (track.kind === "subtitles" || track.kind === "captions")) for (const cue of track.activeCues ?? []) lines.push(cue instanceof VTTCue ? cue.getCueAsHTML().textContent ?? "" : "");
|
|
916
|
+
this.cue.set(lines.filter(Boolean).join("\n"));
|
|
917
|
+
};
|
|
918
|
+
const events = new AbortController();
|
|
919
|
+
const options = { signal: events.signal };
|
|
920
|
+
const follow = (track) => track.addEventListener("cuechange", update, options);
|
|
921
|
+
for (const track of tracks) follow(track);
|
|
922
|
+
tracks.addEventListener("addtrack", (event) => event.track && follow(event.track), options);
|
|
923
|
+
tracks.addEventListener("change", update, options);
|
|
924
|
+
update();
|
|
925
|
+
return () => {
|
|
926
|
+
events.abort();
|
|
927
|
+
this.cue.set("");
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
setQuality(id) {
|
|
931
|
+
this.store?.selectVideoRendition?.(id ?? "auto");
|
|
932
|
+
}
|
|
933
|
+
handleKey(key) {
|
|
934
|
+
switch (key) {
|
|
935
|
+
case "f":
|
|
936
|
+
this.toggleFullscreen();
|
|
937
|
+
return true;
|
|
938
|
+
case "c":
|
|
939
|
+
this.toggleCaptions();
|
|
940
|
+
return true;
|
|
941
|
+
default: return super.handleKey(key);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
prepare(element, tracks) {
|
|
945
|
+
super.prepare(element, tracks);
|
|
946
|
+
if (element instanceof HTMLVideoElement) {
|
|
947
|
+
element.playsInline = true;
|
|
948
|
+
const poster = this.poster();
|
|
949
|
+
if (poster) element.poster = poster;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
static {
|
|
953
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
954
|
+
minVersion: "12.0.0",
|
|
955
|
+
version: "22.3.0",
|
|
956
|
+
ngImport: i0,
|
|
957
|
+
type: NbVideoComponent,
|
|
958
|
+
deps: [],
|
|
959
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
static {
|
|
963
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
964
|
+
minVersion: "17.0.0",
|
|
965
|
+
version: "22.3.0",
|
|
966
|
+
type: NbVideoComponent,
|
|
967
|
+
isStandalone: true,
|
|
968
|
+
selector: "nb-video",
|
|
969
|
+
inputs: { poster: {
|
|
970
|
+
classPropertyName: "poster",
|
|
971
|
+
publicName: "poster",
|
|
972
|
+
isSignal: true,
|
|
973
|
+
isRequired: false,
|
|
974
|
+
transformFunction: null
|
|
975
|
+
} },
|
|
976
|
+
providers: [NbMediaController],
|
|
977
|
+
viewQueries: [{
|
|
978
|
+
propertyName: "still",
|
|
979
|
+
first: true,
|
|
980
|
+
predicate: ["still"],
|
|
981
|
+
descendants: true,
|
|
982
|
+
isSignal: true
|
|
983
|
+
}],
|
|
984
|
+
usesInheritance: true,
|
|
985
|
+
ngImport: i0,
|
|
986
|
+
template: "<div #frame\n class=\"frame\"\n nbOverlayHost\n [attr.role]=\"controls() ? 'group' : null\"\n [attr.tabindex]=\"controls() ? 0 : null\"\n [attr.aria-label]=\"controls() ? ariaLabel() : null\"\n [class.bare]=\"!controls()\"\n [class.paused]=\"paused()\"\n [class.idle]=\"controls() && state().controlsVisible === false\"\n (keydown)=\"onKeydown($event)\">\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- Pointer shortcuts; the player's keys and controls do the same. -->\n <div #media\n class=\"media\"\n (click)=\"controls() && togglePlay()\"\n (dblclick)=\"controls() && toggleFullscreen()\">\n <canvas #still\n class=\"still\"></canvas>\n </div>\n\n <!-- The captions, above the controls. Assistive technologies read the media's own. -->\n @if (cue()) {\n <div class=\"cue\"\n aria-hidden=\"true\">\n <span>{{ cue() }}</span>\n </div>\n }\n\n <!-- Without controls, it's just the media. -->\n @if (controls()) {\n @if (failed()) {\n <div class=\"message\"\n role=\"alert\">\n <nb-icon icon=\"alert-circle-outline\"\n pack=\"essentials\" />\n {{ texts().error }}\n </div>\n } @else if (waiting()) {\n <nb-spinner class=\"waiting\"\n status=\"control\"\n size=\"giant\" />\n } @else if (paused()) {\n <button class=\"big-play\"\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"texts().play\"\n (click)=\"togglePlay()\">\n <nb-icon icon=\"play\"\n pack=\"essentials\" />\n </button>\n }\n\n <div class=\"controls\">\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"paused() ? texts().play : texts().pause\"\n (click)=\"togglePlay()\">\n <nb-icon [icon]=\"paused() ? 'play' : 'pause'\"\n pack=\"essentials\" />\n </button>\n\n <!-- The volume opens beside the mute button while it's pointed at or has the focus. -->\n <div class=\"volume\">\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"volume() === 0 ? texts().unmute : texts().mute\"\n (click)=\"toggleMuted()\">\n <nb-icon [icon]=\"volumeIcon()\"\n pack=\"essentials\" />\n </button>\n <nb-slider status=\"control\"\n size=\"medium\"\n [min]=\"0\"\n [max]=\"1\"\n [step]=\"0.05\"\n [labels]=\"false\"\n [showValue]=\"false\"\n [formatValue]=\"formatVolume\"\n [value]=\"volume()\"\n (valueChange)=\"onVolume($event)\"\n [aria-label]=\"texts().volume\" />\n </div>\n\n @if (live()) {\n <span class=\"live\">{{ texts().live }}</span>\n } @else {\n <nb-slider class=\"position\"\n size=\"medium\"\n status=\"control\"\n [min]=\"0\"\n [max]=\"seekable() ? duration() : 1\"\n [step]=\"0.1\"\n [labels]=\"false\"\n [showValue]=\"false\"\n [disabled]=\"!seekable()\"\n [formatValue]=\"formatPosition\"\n [value]=\"currentTime()\"\n (valueChange)=\"onPosition($event)\"\n [aria-label]=\"texts().position\" />\n <span class=\"time\"\n dir=\"ltr\"\n aria-hidden=\"true\">{{ elapsed() }} / {{ length() }}</span>\n }\n\n @if (!live() && state().playbackRateAvailability !== 'unsupported') {\n <span hidden\n [id]=\"id + '-speed'\">{{ texts().speed }}</span>\n <nb-select class=\"speed\"\n status=\"control\"\n appearance=\"ghost\"\n size=\"small\"\n [aria-labelledby]=\"id + '-speed'\"\n [selected]=\"state().playbackRate ?? 1\"\n (selectedChange)=\"setRate($event)\">\n @for (rate of playbackRates(); track rate) {\n <nb-option [value]=\"rate\">{{ formatRate(rate) }}</nb-option>\n }\n </nb-select>\n }\n\n @if (qualities().length > 1) {\n <span hidden\n [id]=\"id + '-quality'\">{{ texts().quality }}</span>\n <nb-select class=\"quality\"\n status=\"control\"\n appearance=\"ghost\"\n size=\"small\"\n [aria-labelledby]=\"id + '-quality'\"\n [selected]=\"quality()\"\n (selectedChange)=\"setQuality($event)\">\n <nb-option value=\"auto\">{{ texts().qualityAuto }}</nb-option>\n @for (rendition of qualities(); track rendition.id) {\n <nb-option [value]=\"rendition.id\">{{ rendition.label }}</nb-option>\n }\n </nb-select>\n }\n\n @if (hasCaptions()) {\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"state().subtitlesShowing ? texts().captionsOff : texts().captions\"\n [attr.aria-pressed]=\"!!state().subtitlesShowing\"\n (click)=\"toggleCaptions()\">\n <nb-icon [icon]=\"state().subtitlesShowing ? 'closed-captions' : 'closed-captions-outline'\"\n pack=\"essentials\" />\n </button>\n }\n\n @if (state().pictureInPictureAvailability === 'available') {\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"state().isPictureInPicture ? texts().exitPictureInPicture : texts().pictureInPicture\"\n (click)=\"togglePictureInPicture()\">\n <nb-icon [icon]=\"state().isPictureInPicture ? 'picture-in-picture' : 'picture-in-picture-outline'\"\n pack=\"essentials\" />\n </button>\n }\n\n @if (state().fullscreenAvailability === 'available') {\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"state().isFullscreen ? texts().exitFullscreen : texts().fullscreen\"\n (click)=\"toggleFullscreen()\">\n <nb-icon [icon]=\"state().isFullscreen ? 'collapse-outline' : 'expand-outline'\"\n pack=\"essentials\" />\n </button>\n }\n </div>\n }\n</div>\n",
|
|
987
|
+
styles: ["nb-video{display:block;aspect-ratio:16/9}nb-video>.frame{position:relative;container-type:inline-size;width:100%;height:100%;overflow:hidden;border-radius:var(--border-radius);background:#000;color:var(--text-control-color);font-family:var(--font-family-primary)}nb-video>.frame:focus-visible{outline:none;box-shadow:0 0 0 var(--outline-width) var(--outline-color)}nb-video>.frame:fullscreen{border-radius:0}nb-video>.frame.idle:not(:has(:focus-visible,nb-select.open)){cursor:none}nb-video>.frame.idle:not(:has(:focus-visible,nb-select.open))>.controls{opacity:0}nb-video>.frame.idle:not(:has(:focus-visible,nb-select.open))>.cue{bottom:1.5rem}nb-video>.frame.idle:not(:has(:focus-visible,nb-select.open)):after{opacity:0}nb-video>.frame:not(.bare):after{content:\"\";position:absolute;inset:0;background:linear-gradient(to top,rgba(0,0,0,.7),transparent 35%);pointer-events:none;transition:opacity .3s ease}nb-video .media{position:absolute;inset:0}nb-video .media video,nb-video .media iframe,nb-video .media .still{display:block;width:100%;height:100%;border:0;object-fit:contain}nb-video .media video::cue{visibility:hidden}nb-video .media .still:not(.shown){display:none}nb-video .cue{position:absolute;inset-inline:0;bottom:4rem;z-index:1;display:flex;justify-content:center;padding-inline:5%;color:#fff;font-size:1.125rem;line-height:1.4;text-align:center;white-space:pre-line;pointer-events:none;transition:bottom .3s ease}nb-video .cue span{padding:.1em .4em;border-radius:.2em;background:#000000bf;-webkit-box-decoration-break:clone;box-decoration-break:clone}nb-video .frame.bare>.cue{bottom:1.5rem}nb-video .frame:fullscreen>.cue{bottom:6rem}nb-video .big-play{position:absolute;inset:0;z-index:1;display:grid;place-items:center;width:5rem;height:5rem;margin:auto;padding:0 0 0 .25rem;border:0;border-radius:50%;background:#ffffffeb;color:var(--color-primary-default);font-size:2.5rem;cursor:pointer;transition:transform .15s ease}nb-video .big-play:hover{transform:scale(1.05)}nb-video .big-play nb-icon{font-size:inherit}nb-video .waiting{z-index:1;background:none;pointer-events:none}nb-video .message{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;gap:.5rem;padding:1rem;text-align:center}nb-video .message nb-icon{flex-shrink:0;font-size:1.5rem}nb-video .controls{position:absolute;inset-block-end:0;inset-inline:0;z-index:2;display:flex;align-items:center;gap:.25rem;padding:.5rem .75rem;transition:opacity .3s ease;--button-small-icon-size: 1.5rem;--button-small-icon-vertical-margin: -.375rem;--icon-button-ghost-small-padding: .5625rem .1875rem}nb-video .controls .position{flex:1;min-width:4rem;margin-inline:.5rem}nb-video .controls .volume{display:flex;flex-shrink:0;align-items:center}nb-video .controls .volume nb-slider{width:4.5rem;margin-inline:.25rem .5rem;transition:width .2s ease,padding .2s ease,margin .2s ease,opacity .2s ease}nb-video .controls .volume:not(:hover,:has(:focus-visible)) nb-slider{width:0;margin-inline:0;padding-inline:0;overflow:hidden;opacity:0}nb-video .controls .time,nb-video .controls .live{font-size:var(--text-paragraph-2-font-size);font-variant-numeric:tabular-nums;white-space:nowrap}nb-video .controls .live{flex:1;margin-inline:.5rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase}nb-video .controls .speed{--select-small-width: 4.5rem}nb-video .controls .quality{--select-small-width: 5.5rem}nb-video .controls [nbButton]{flex-shrink:0}nb-video .frame:fullscreen .controls{gap:.5rem;padding:1rem 1.5rem;--button-small-icon-size: 2rem;--button-small-icon-vertical-margin: -.625rem;--icon-button-ghost-small-padding: .9375rem .3125rem}nb-video .frame:fullscreen .controls .time,nb-video .frame:fullscreen .controls .live{font-size:1rem}nb-video .frame:fullscreen .controls .speed,nb-video .frame:fullscreen .controls .quality{--select-small-text-font-size: 1rem;--select-small-text-line-height: 1.75rem}nb-video .frame:fullscreen .controls .speed{--select-small-width: 5.25rem}nb-video .frame:fullscreen .controls .quality{--select-small-width: 6.5rem}@media(prefers-reduced-motion:reduce){nb-video .frame:after,nb-video .controls,nb-video .cue,nb-video .volume nb-slider,nb-video .big-play{transition:none}}@container (min-width: 60rem){nb-video .cue{font-size:1.625rem}}@container (min-width: 90rem){nb-video .cue{font-size:2.25rem}}@container (max-width: 30rem){nb-video .cue{bottom:3.25rem;font-size:.875rem}nb-video .controls .volume nb-slider,nb-video .controls .speed,nb-video .controls .quality,nb-video .controls .time{display:none}nb-video .big-play{width:3.5rem;height:3.5rem;font-size:1.75rem}}\n"],
|
|
988
|
+
dependencies: [
|
|
989
|
+
{
|
|
990
|
+
kind: "component",
|
|
991
|
+
type: NbButtonComponent,
|
|
992
|
+
selector: "button[nbButton],a[nbButton],input[type=\"button\"][nbButton],input[type=\"submit\"][nbButton]",
|
|
993
|
+
inputs: ["hero", "loading"]
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
kind: "component",
|
|
997
|
+
type: NbIconComponent,
|
|
998
|
+
selector: "nb-icon",
|
|
999
|
+
inputs: [
|
|
1000
|
+
"icon",
|
|
1001
|
+
"pack",
|
|
1002
|
+
"options",
|
|
1003
|
+
"status",
|
|
1004
|
+
"config"
|
|
1005
|
+
]
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
kind: "component",
|
|
1009
|
+
type: NbOptionComponent,
|
|
1010
|
+
selector: "nb-option",
|
|
1011
|
+
inputs: [
|
|
1012
|
+
"value",
|
|
1013
|
+
"disabled",
|
|
1014
|
+
"selectAll"
|
|
1015
|
+
],
|
|
1016
|
+
outputs: ["selectionChange"]
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
kind: "directive",
|
|
1020
|
+
type: NbOverlayHostDirective,
|
|
1021
|
+
selector: "[nbOverlayHost]"
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
kind: "component",
|
|
1025
|
+
type: NbSelectComponent,
|
|
1026
|
+
selector: "nb-select",
|
|
1027
|
+
inputs: [
|
|
1028
|
+
"size",
|
|
1029
|
+
"status",
|
|
1030
|
+
"shape",
|
|
1031
|
+
"appearance",
|
|
1032
|
+
"optionsListClass",
|
|
1033
|
+
"optionsPanelClass",
|
|
1034
|
+
"tabIndex",
|
|
1035
|
+
"optionsWidth",
|
|
1036
|
+
"outline",
|
|
1037
|
+
"filled",
|
|
1038
|
+
"hero",
|
|
1039
|
+
"ghost",
|
|
1040
|
+
"disabled",
|
|
1041
|
+
"fullWidth",
|
|
1042
|
+
"placeholder",
|
|
1043
|
+
"aria-labelledby",
|
|
1044
|
+
"compareWith",
|
|
1045
|
+
"selected",
|
|
1046
|
+
"multiple",
|
|
1047
|
+
"nullable",
|
|
1048
|
+
"chips",
|
|
1049
|
+
"maxSelections",
|
|
1050
|
+
"searchable",
|
|
1051
|
+
"searchFn",
|
|
1052
|
+
"overlayOffset",
|
|
1053
|
+
"scrollStrategy",
|
|
1054
|
+
"nestedLevels"
|
|
1055
|
+
],
|
|
1056
|
+
outputs: ["selectedChange"]
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
kind: "component",
|
|
1060
|
+
type: NbSliderComponent,
|
|
1061
|
+
selector: "nb-slider",
|
|
1062
|
+
inputs: [
|
|
1063
|
+
"min",
|
|
1064
|
+
"max",
|
|
1065
|
+
"step",
|
|
1066
|
+
"center",
|
|
1067
|
+
"range",
|
|
1068
|
+
"vertical",
|
|
1069
|
+
"ticks",
|
|
1070
|
+
"labels",
|
|
1071
|
+
"showValue",
|
|
1072
|
+
"transform",
|
|
1073
|
+
"formatValue",
|
|
1074
|
+
"status",
|
|
1075
|
+
"size",
|
|
1076
|
+
"disabled",
|
|
1077
|
+
"aria-label",
|
|
1078
|
+
"aria-labelledby",
|
|
1079
|
+
"value"
|
|
1080
|
+
],
|
|
1081
|
+
outputs: ["valueChange"]
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
kind: "component",
|
|
1085
|
+
type: NbSpinnerComponent,
|
|
1086
|
+
selector: "nb-spinner",
|
|
1087
|
+
inputs: [
|
|
1088
|
+
"message",
|
|
1089
|
+
"size",
|
|
1090
|
+
"status"
|
|
1091
|
+
]
|
|
1092
|
+
}
|
|
1093
|
+
],
|
|
1094
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1095
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1100
|
+
minVersion: "12.0.0",
|
|
1101
|
+
version: "22.3.0",
|
|
1102
|
+
ngImport: i0,
|
|
1103
|
+
type: NbVideoComponent,
|
|
1104
|
+
decorators: [{
|
|
1105
|
+
type: Component,
|
|
1106
|
+
args: [{
|
|
1107
|
+
selector: "nb-video",
|
|
1108
|
+
encapsulation: ViewEncapsulation.None,
|
|
1109
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1110
|
+
providers: [NbMediaController],
|
|
1111
|
+
imports: [
|
|
1112
|
+
NbButtonComponent,
|
|
1113
|
+
NbIconComponent,
|
|
1114
|
+
NbOptionComponent,
|
|
1115
|
+
NbOverlayHostDirective,
|
|
1116
|
+
NbSelectComponent,
|
|
1117
|
+
NbSliderComponent,
|
|
1118
|
+
NbSpinnerComponent
|
|
1119
|
+
],
|
|
1120
|
+
template: "<div #frame\n class=\"frame\"\n nbOverlayHost\n [attr.role]=\"controls() ? 'group' : null\"\n [attr.tabindex]=\"controls() ? 0 : null\"\n [attr.aria-label]=\"controls() ? ariaLabel() : null\"\n [class.bare]=\"!controls()\"\n [class.paused]=\"paused()\"\n [class.idle]=\"controls() && state().controlsVisible === false\"\n (keydown)=\"onKeydown($event)\">\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- Pointer shortcuts; the player's keys and controls do the same. -->\n <div #media\n class=\"media\"\n (click)=\"controls() && togglePlay()\"\n (dblclick)=\"controls() && toggleFullscreen()\">\n <canvas #still\n class=\"still\"></canvas>\n </div>\n\n <!-- The captions, above the controls. Assistive technologies read the media's own. -->\n @if (cue()) {\n <div class=\"cue\"\n aria-hidden=\"true\">\n <span>{{ cue() }}</span>\n </div>\n }\n\n <!-- Without controls, it's just the media. -->\n @if (controls()) {\n @if (failed()) {\n <div class=\"message\"\n role=\"alert\">\n <nb-icon icon=\"alert-circle-outline\"\n pack=\"essentials\" />\n {{ texts().error }}\n </div>\n } @else if (waiting()) {\n <nb-spinner class=\"waiting\"\n status=\"control\"\n size=\"giant\" />\n } @else if (paused()) {\n <button class=\"big-play\"\n type=\"button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"texts().play\"\n (click)=\"togglePlay()\">\n <nb-icon icon=\"play\"\n pack=\"essentials\" />\n </button>\n }\n\n <div class=\"controls\">\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"paused() ? texts().play : texts().pause\"\n (click)=\"togglePlay()\">\n <nb-icon [icon]=\"paused() ? 'play' : 'pause'\"\n pack=\"essentials\" />\n </button>\n\n <!-- The volume opens beside the mute button while it's pointed at or has the focus. -->\n <div class=\"volume\">\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"volume() === 0 ? texts().unmute : texts().mute\"\n (click)=\"toggleMuted()\">\n <nb-icon [icon]=\"volumeIcon()\"\n pack=\"essentials\" />\n </button>\n <nb-slider status=\"control\"\n size=\"medium\"\n [min]=\"0\"\n [max]=\"1\"\n [step]=\"0.05\"\n [labels]=\"false\"\n [showValue]=\"false\"\n [formatValue]=\"formatVolume\"\n [value]=\"volume()\"\n (valueChange)=\"onVolume($event)\"\n [aria-label]=\"texts().volume\" />\n </div>\n\n @if (live()) {\n <span class=\"live\">{{ texts().live }}</span>\n } @else {\n <nb-slider class=\"position\"\n size=\"medium\"\n status=\"control\"\n [min]=\"0\"\n [max]=\"seekable() ? duration() : 1\"\n [step]=\"0.1\"\n [labels]=\"false\"\n [showValue]=\"false\"\n [disabled]=\"!seekable()\"\n [formatValue]=\"formatPosition\"\n [value]=\"currentTime()\"\n (valueChange)=\"onPosition($event)\"\n [aria-label]=\"texts().position\" />\n <span class=\"time\"\n dir=\"ltr\"\n aria-hidden=\"true\">{{ elapsed() }} / {{ length() }}</span>\n }\n\n @if (!live() && state().playbackRateAvailability !== 'unsupported') {\n <span hidden\n [id]=\"id + '-speed'\">{{ texts().speed }}</span>\n <nb-select class=\"speed\"\n status=\"control\"\n appearance=\"ghost\"\n size=\"small\"\n [aria-labelledby]=\"id + '-speed'\"\n [selected]=\"state().playbackRate ?? 1\"\n (selectedChange)=\"setRate($event)\">\n @for (rate of playbackRates(); track rate) {\n <nb-option [value]=\"rate\">{{ formatRate(rate) }}</nb-option>\n }\n </nb-select>\n }\n\n @if (qualities().length > 1) {\n <span hidden\n [id]=\"id + '-quality'\">{{ texts().quality }}</span>\n <nb-select class=\"quality\"\n status=\"control\"\n appearance=\"ghost\"\n size=\"small\"\n [aria-labelledby]=\"id + '-quality'\"\n [selected]=\"quality()\"\n (selectedChange)=\"setQuality($event)\">\n <nb-option value=\"auto\">{{ texts().qualityAuto }}</nb-option>\n @for (rendition of qualities(); track rendition.id) {\n <nb-option [value]=\"rendition.id\">{{ rendition.label }}</nb-option>\n }\n </nb-select>\n }\n\n @if (hasCaptions()) {\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"state().subtitlesShowing ? texts().captionsOff : texts().captions\"\n [attr.aria-pressed]=\"!!state().subtitlesShowing\"\n (click)=\"toggleCaptions()\">\n <nb-icon [icon]=\"state().subtitlesShowing ? 'closed-captions' : 'closed-captions-outline'\"\n pack=\"essentials\" />\n </button>\n }\n\n @if (state().pictureInPictureAvailability === 'available') {\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"state().isPictureInPicture ? texts().exitPictureInPicture : texts().pictureInPicture\"\n (click)=\"togglePictureInPicture()\">\n <nb-icon [icon]=\"state().isPictureInPicture ? 'picture-in-picture' : 'picture-in-picture-outline'\"\n pack=\"essentials\" />\n </button>\n }\n\n @if (state().fullscreenAvailability === 'available') {\n <button nbButton\n ghost\n status=\"control\"\n size=\"small\"\n type=\"button\"\n [attr.aria-label]=\"state().isFullscreen ? texts().exitFullscreen : texts().fullscreen\"\n (click)=\"toggleFullscreen()\">\n <nb-icon [icon]=\"state().isFullscreen ? 'collapse-outline' : 'expand-outline'\"\n pack=\"essentials\" />\n </button>\n }\n </div>\n }\n</div>\n",
|
|
1121
|
+
styles: ["nb-video{display:block;aspect-ratio:16/9}nb-video>.frame{position:relative;container-type:inline-size;width:100%;height:100%;overflow:hidden;border-radius:var(--border-radius);background:#000;color:var(--text-control-color);font-family:var(--font-family-primary)}nb-video>.frame:focus-visible{outline:none;box-shadow:0 0 0 var(--outline-width) var(--outline-color)}nb-video>.frame:fullscreen{border-radius:0}nb-video>.frame.idle:not(:has(:focus-visible,nb-select.open)){cursor:none}nb-video>.frame.idle:not(:has(:focus-visible,nb-select.open))>.controls{opacity:0}nb-video>.frame.idle:not(:has(:focus-visible,nb-select.open))>.cue{bottom:1.5rem}nb-video>.frame.idle:not(:has(:focus-visible,nb-select.open)):after{opacity:0}nb-video>.frame:not(.bare):after{content:\"\";position:absolute;inset:0;background:linear-gradient(to top,rgba(0,0,0,.7),transparent 35%);pointer-events:none;transition:opacity .3s ease}nb-video .media{position:absolute;inset:0}nb-video .media video,nb-video .media iframe,nb-video .media .still{display:block;width:100%;height:100%;border:0;object-fit:contain}nb-video .media video::cue{visibility:hidden}nb-video .media .still:not(.shown){display:none}nb-video .cue{position:absolute;inset-inline:0;bottom:4rem;z-index:1;display:flex;justify-content:center;padding-inline:5%;color:#fff;font-size:1.125rem;line-height:1.4;text-align:center;white-space:pre-line;pointer-events:none;transition:bottom .3s ease}nb-video .cue span{padding:.1em .4em;border-radius:.2em;background:#000000bf;-webkit-box-decoration-break:clone;box-decoration-break:clone}nb-video .frame.bare>.cue{bottom:1.5rem}nb-video .frame:fullscreen>.cue{bottom:6rem}nb-video .big-play{position:absolute;inset:0;z-index:1;display:grid;place-items:center;width:5rem;height:5rem;margin:auto;padding:0 0 0 .25rem;border:0;border-radius:50%;background:#ffffffeb;color:var(--color-primary-default);font-size:2.5rem;cursor:pointer;transition:transform .15s ease}nb-video .big-play:hover{transform:scale(1.05)}nb-video .big-play nb-icon{font-size:inherit}nb-video .waiting{z-index:1;background:none;pointer-events:none}nb-video .message{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;gap:.5rem;padding:1rem;text-align:center}nb-video .message nb-icon{flex-shrink:0;font-size:1.5rem}nb-video .controls{position:absolute;inset-block-end:0;inset-inline:0;z-index:2;display:flex;align-items:center;gap:.25rem;padding:.5rem .75rem;transition:opacity .3s ease;--button-small-icon-size: 1.5rem;--button-small-icon-vertical-margin: -.375rem;--icon-button-ghost-small-padding: .5625rem .1875rem}nb-video .controls .position{flex:1;min-width:4rem;margin-inline:.5rem}nb-video .controls .volume{display:flex;flex-shrink:0;align-items:center}nb-video .controls .volume nb-slider{width:4.5rem;margin-inline:.25rem .5rem;transition:width .2s ease,padding .2s ease,margin .2s ease,opacity .2s ease}nb-video .controls .volume:not(:hover,:has(:focus-visible)) nb-slider{width:0;margin-inline:0;padding-inline:0;overflow:hidden;opacity:0}nb-video .controls .time,nb-video .controls .live{font-size:var(--text-paragraph-2-font-size);font-variant-numeric:tabular-nums;white-space:nowrap}nb-video .controls .live{flex:1;margin-inline:.5rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase}nb-video .controls .speed{--select-small-width: 4.5rem}nb-video .controls .quality{--select-small-width: 5.5rem}nb-video .controls [nbButton]{flex-shrink:0}nb-video .frame:fullscreen .controls{gap:.5rem;padding:1rem 1.5rem;--button-small-icon-size: 2rem;--button-small-icon-vertical-margin: -.625rem;--icon-button-ghost-small-padding: .9375rem .3125rem}nb-video .frame:fullscreen .controls .time,nb-video .frame:fullscreen .controls .live{font-size:1rem}nb-video .frame:fullscreen .controls .speed,nb-video .frame:fullscreen .controls .quality{--select-small-text-font-size: 1rem;--select-small-text-line-height: 1.75rem}nb-video .frame:fullscreen .controls .speed{--select-small-width: 5.25rem}nb-video .frame:fullscreen .controls .quality{--select-small-width: 6.5rem}@media(prefers-reduced-motion:reduce){nb-video .frame:after,nb-video .controls,nb-video .cue,nb-video .volume nb-slider,nb-video .big-play{transition:none}}@container (min-width: 60rem){nb-video .cue{font-size:1.625rem}}@container (min-width: 90rem){nb-video .cue{font-size:2.25rem}}@container (max-width: 30rem){nb-video .cue{bottom:3.25rem;font-size:.875rem}nb-video .controls .volume nb-slider,nb-video .controls .speed,nb-video .controls .quality,nb-video .controls .time{display:none}nb-video .big-play{width:3.5rem;height:3.5rem;font-size:1.75rem}}\n"]
|
|
1122
|
+
}]
|
|
1123
|
+
}],
|
|
1124
|
+
ctorParameters: () => [],
|
|
1125
|
+
propDecorators: {
|
|
1126
|
+
poster: [{
|
|
1127
|
+
type: i0.Input,
|
|
1128
|
+
args: [{
|
|
1129
|
+
isSignal: true,
|
|
1130
|
+
alias: "poster",
|
|
1131
|
+
required: false
|
|
1132
|
+
}]
|
|
1133
|
+
}],
|
|
1134
|
+
still: [{
|
|
1135
|
+
type: i0.ViewChild,
|
|
1136
|
+
args: ["still", { isSignal: true }]
|
|
1137
|
+
}]
|
|
1138
|
+
}
|
|
1139
|
+
});
|
|
1140
|
+
export { NB_MEDIA_PLAYER_CONFIG, NbAudioComponent, NbMediaPlayer, NbVideoComponent, nbFormatMediaTime, provideNbMediaPlayer, withMediaEngines, withMediaExtensions };
|
|
1141
|
+
|
|
1142
|
+
//# sourceMappingURL=liquid-js-lyr-extras-media.mjs.map
|