@locpd/vidstack 1.12.14
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 +21 -0
- package/README.md +22 -0
- package/analyze.json.d.ts +8 -0
- package/bundle.d.ts +1 -0
- package/cdn/chunks/vidstack-2f5gzOW6.js +1 -0
- package/cdn/chunks/vidstack-BYgY9wmd.js +1 -0
- package/cdn/chunks/vidstack-BfBBPhXV.js +1 -0
- package/cdn/chunks/vidstack-Bjo5esRp.js +1 -0
- package/cdn/chunks/vidstack-BuL67v3q.js +1 -0
- package/cdn/chunks/vidstack-C0msPRTd.js +3 -0
- package/cdn/chunks/vidstack-CJNLoJPa.js +1 -0
- package/cdn/chunks/vidstack-CQSpZ7X8.js +16 -0
- package/cdn/chunks/vidstack-C_AxqLKV.js +1 -0
- package/cdn/chunks/vidstack-CioT3Yw2.js +1 -0
- package/cdn/chunks/vidstack-CrqkytHl.js +1 -0
- package/cdn/chunks/vidstack-D0M8R0ZU.js +1 -0
- package/cdn/chunks/vidstack-D40FSa5B.js +3 -0
- package/cdn/chunks/vidstack-DD2JwFVU.js +1 -0
- package/cdn/chunks/vidstack-DRH_1tFW.js +1 -0
- package/cdn/chunks/vidstack-DfDZuHNP.js +1 -0
- package/cdn/chunks/vidstack-DiNS2Vx5.js +1 -0
- package/cdn/chunks/vidstack-xjJ-ui_l.js +1 -0
- package/cdn/providers/vidstack-audio-2Dt_Ivbp.js +1 -0
- package/cdn/providers/vidstack-dash-CUtD4e6q.js +1 -0
- package/cdn/providers/vidstack-google-cast-BdORATUX.js +1 -0
- package/cdn/providers/vidstack-hls-R25Kb6DP.js +1 -0
- package/cdn/providers/vidstack-html-DaAUJYsD.js +1 -0
- package/cdn/providers/vidstack-video-Csvox7SO.js +1 -0
- package/cdn/providers/vidstack-vimeo-D4Z96kg2.js +1 -0
- package/cdn/providers/vidstack-youtube-DiND6h3s.js +1 -0
- package/cdn/vidstack.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-2f5gzOW6.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-45yH5los.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BBVMdOnf.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BB_ulI_T.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BcAewM33.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BfBBPhXV.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-Bxv1Qnxe.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-C2ZbG62f.js +3 -0
- package/cdn/with-layouts/chunks/vidstack-CCYIOKgL.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CL6PeIO1.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-C_AxqLKV.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CifDkwDH.js +795 -0
- package/cdn/with-layouts/chunks/vidstack-Cry7aD59.js +3 -0
- package/cdn/with-layouts/chunks/vidstack-D065okCn.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-DGuMoXmI.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-DRH_1tFW.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-DVBs1XoQ.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-Dge3KT8k.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-DiNS2Vx5.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-HvYfJoen.js +1 -0
- package/cdn/with-layouts/providers/vidstack-audio-DE5vKIzW.js +1 -0
- package/cdn/with-layouts/providers/vidstack-dash-CA2agUuZ.js +1 -0
- package/cdn/with-layouts/providers/vidstack-google-cast-CGs-t8HM.js +1 -0
- package/cdn/with-layouts/providers/vidstack-hls-BHMbMFFR.js +1 -0
- package/cdn/with-layouts/providers/vidstack-html-Dm9gmNk6.js +1 -0
- package/cdn/with-layouts/providers/vidstack-video-C5it_Lbl.js +1 -0
- package/cdn/with-layouts/providers/vidstack-vimeo-BabLn9sy.js +1 -0
- package/cdn/with-layouts/providers/vidstack-youtube-D8UlccUL.js +1 -0
- package/cdn/with-layouts/vidstack.js +1 -0
- package/dev/chunks/vidstack-B7Zi3v_O.js +104 -0
- package/dev/chunks/vidstack-BFg1ZqiG.js +91 -0
- package/dev/chunks/vidstack-BGB2pa9s.js +58 -0
- package/dev/chunks/vidstack-BaIbHZE3.js +1519 -0
- package/dev/chunks/vidstack-Bb2rASIc.js +5188 -0
- package/dev/chunks/vidstack-Bcmx8pmK.js +224 -0
- package/dev/chunks/vidstack-Bl4b0Nen.js +29 -0
- package/dev/chunks/vidstack-Bo5OTJ06.js +58 -0
- package/dev/chunks/vidstack-BoAGnlRt.js +58 -0
- package/dev/chunks/vidstack-Bpr4fI4n.js +7 -0
- package/dev/chunks/vidstack-Bt8MP2DK.js +204 -0
- package/dev/chunks/vidstack-Bu2kfzUd.js +1637 -0
- package/dev/chunks/vidstack-C-ffXlSV.js +2995 -0
- package/dev/chunks/vidstack-C-ztJq-f.js +109 -0
- package/dev/chunks/vidstack-CFNlaVTR.js +55 -0
- package/dev/chunks/vidstack-C_l97D5j.js +254 -0
- package/dev/chunks/vidstack-CjhKISI0.js +114 -0
- package/dev/chunks/vidstack-CofXIJAy.js +57 -0
- package/dev/chunks/vidstack-CwTj4H1w.js +18 -0
- package/dev/chunks/vidstack-DDwbYVHV.js +66 -0
- package/dev/chunks/vidstack-DFImIcIL.js +11 -0
- package/dev/chunks/vidstack-DGDvUbvO.js +33 -0
- package/dev/chunks/vidstack-DO0kqA99.js +107 -0
- package/dev/chunks/vidstack-DXxIKXmd.js +50 -0
- package/dev/chunks/vidstack-DajrMUR0.js +297 -0
- package/dev/chunks/vidstack-DbBJlz7I.js +10 -0
- package/dev/chunks/vidstack-Dihypf8P.js +11 -0
- package/dev/chunks/vidstack-DlAhl87f.js +1193 -0
- package/dev/chunks/vidstack-Dm1xEU9Q.js +34 -0
- package/dev/chunks/vidstack-Dv_LIPFu.js +14 -0
- package/dev/chunks/vidstack-igYn0Apa.js +254 -0
- package/dev/chunks/vidstack-krOAtKMi.js +32 -0
- package/dev/chunks/vidstack-qh1N5_f_.js +26 -0
- package/dev/chunks/vidstack-rB-wqXw1.js +107 -0
- package/dev/chunks/vidstack-zG6PIeGg.js +66 -0
- package/dev/define/plyr-layout.js +51 -0
- package/dev/define/templates/plyr-layout.js +571 -0
- package/dev/define/templates/vidstack-audio-layout.js +167 -0
- package/dev/define/templates/vidstack-video-layout.js +390 -0
- package/dev/define/vidstack-icons.js +1 -0
- package/dev/define/vidstack-player-default-layout.js +21 -0
- package/dev/define/vidstack-player-layouts.js +25 -0
- package/dev/define/vidstack-player-ui.js +70 -0
- package/dev/define/vidstack-player.js +19 -0
- package/dev/global/plyr.js +501 -0
- package/dev/global/vidstack-player.js +129 -0
- package/dev/providers/vidstack-audio.js +35 -0
- package/dev/providers/vidstack-dash.js +516 -0
- package/dev/providers/vidstack-google-cast.js +474 -0
- package/dev/providers/vidstack-hls.js +408 -0
- package/dev/providers/vidstack-html.js +567 -0
- package/dev/providers/vidstack-video.js +207 -0
- package/dev/providers/vidstack-vimeo.js +554 -0
- package/dev/providers/vidstack-youtube.js +286 -0
- package/dev/vidstack-elements.js +36 -0
- package/dev/vidstack.js +91 -0
- package/dom.d.ts +91 -0
- package/elements.d.ts +1433 -0
- package/empty.vtt +1 -0
- package/global/player.d.ts +52 -0
- package/global/plyr.d.ts +343 -0
- package/google-cast.d.ts +1422 -0
- package/icons.d.ts +1 -0
- package/index.d.ts +402 -0
- package/package.json +199 -0
- package/player/index.d.ts +3 -0
- package/player/layouts/default.d.ts +3 -0
- package/player/layouts/index.d.ts +3 -0
- package/player/layouts/plyr.d.ts +3 -0
- package/player/styles/base.css +153 -0
- package/player/styles/default/buffering.css +55 -0
- package/player/styles/default/buttons.css +175 -0
- package/player/styles/default/captions.css +181 -0
- package/player/styles/default/chapter-title.css +26 -0
- package/player/styles/default/controls.css +56 -0
- package/player/styles/default/gestures.css +19 -0
- package/player/styles/default/icons.css +6 -0
- package/player/styles/default/keyboard.css +148 -0
- package/player/styles/default/layouts/audio.css +417 -0
- package/player/styles/default/layouts/video.css +590 -0
- package/player/styles/default/menus.css +959 -0
- package/player/styles/default/poster.css +52 -0
- package/player/styles/default/sliders.css +391 -0
- package/player/styles/default/theme.css +2461 -0
- package/player/styles/default/thumbnail.css +40 -0
- package/player/styles/default/time.css +45 -0
- package/player/styles/default/tooltips.css +141 -0
- package/player/styles/plyr/theme.css +1237 -0
- package/player/ui.d.ts +3 -0
- package/plugins.d.ts +19 -0
- package/plugins.js +13 -0
- package/prod/chunks/vidstack-B01xzxC4.js +7 -0
- package/prod/chunks/vidstack-BCeb7ryV.js +201 -0
- package/prod/chunks/vidstack-BGSTndAW.js +1590 -0
- package/prod/chunks/vidstack-BPitBBjh.js +1519 -0
- package/prod/chunks/vidstack-BQlOPwOu.js +45 -0
- package/prod/chunks/vidstack-BSDzlwxO.js +4778 -0
- package/prod/chunks/vidstack-BT0m6zEi.js +109 -0
- package/prod/chunks/vidstack-BTigPj2h.js +55 -0
- package/prod/chunks/vidstack-BiyXcJ_M.js +107 -0
- package/prod/chunks/vidstack-BoVf5n1M.js +2985 -0
- package/prod/chunks/vidstack-Bq6c3Bam.js +58 -0
- package/prod/chunks/vidstack-ByLCIBtB.js +297 -0
- package/prod/chunks/vidstack-C2US-gSO.js +248 -0
- package/prod/chunks/vidstack-C9vIqaYT.js +10 -0
- package/prod/chunks/vidstack-CF6fixCQ.js +1193 -0
- package/prod/chunks/vidstack-CTojmhKq.js +66 -0
- package/prod/chunks/vidstack-ChQTHmIQ.js +77 -0
- package/prod/chunks/vidstack-Cm6_unwd.js +246 -0
- package/prod/chunks/vidstack-CwTj4H1w.js +18 -0
- package/prod/chunks/vidstack-D3ltXc3a.js +33 -0
- package/prod/chunks/vidstack-D5EzK014.js +14 -0
- package/prod/chunks/vidstack-DDXt6fpN.js +58 -0
- package/prod/chunks/vidstack-DJDnh4xT.js +11 -0
- package/prod/chunks/vidstack-DXxIKXmd.js +50 -0
- package/prod/chunks/vidstack-D_-9AA6_.js +29 -0
- package/prod/chunks/vidstack-DbkZGjSn.js +107 -0
- package/prod/chunks/vidstack-Dihypf8P.js +11 -0
- package/prod/chunks/vidstack-Dm1xEU9Q.js +34 -0
- package/prod/chunks/vidstack-Dq5Yu0Vr.js +205 -0
- package/prod/chunks/vidstack-DqAw8m9J.js +26 -0
- package/prod/chunks/vidstack-DsPOyKtl.js +57 -0
- package/prod/chunks/vidstack-krOAtKMi.js +32 -0
- package/prod/chunks/vidstack-nLyr4NEP.js +58 -0
- package/prod/chunks/vidstack-xMS8dnYq.js +114 -0
- package/prod/chunks/vidstack-yEGTpgeA.js +104 -0
- package/prod/define/plyr-layout.js +51 -0
- package/prod/define/templates/plyr-layout.js +571 -0
- package/prod/define/templates/vidstack-audio-layout.js +167 -0
- package/prod/define/templates/vidstack-video-layout.js +390 -0
- package/prod/define/vidstack-icons.js +1 -0
- package/prod/define/vidstack-player-default-layout.js +21 -0
- package/prod/define/vidstack-player-layouts.js +25 -0
- package/prod/define/vidstack-player-ui.js +70 -0
- package/prod/define/vidstack-player.js +19 -0
- package/prod/global/plyr.js +493 -0
- package/prod/global/vidstack-player.js +129 -0
- package/prod/providers/vidstack-audio.js +35 -0
- package/prod/providers/vidstack-dash.js +501 -0
- package/prod/providers/vidstack-google-cast.js +468 -0
- package/prod/providers/vidstack-hls.js +393 -0
- package/prod/providers/vidstack-html.js +555 -0
- package/prod/providers/vidstack-video.js +204 -0
- package/prod/providers/vidstack-vimeo.js +548 -0
- package/prod/providers/vidstack-youtube.js +286 -0
- package/prod/vidstack-elements.js +36 -0
- package/prod/vidstack.js +158 -0
- package/server/chunks/vidstack-6juFdkKy.js +29 -0
- package/server/chunks/vidstack-B7iHmv7_.js +307 -0
- package/server/chunks/vidstack-BmxyML9v.js +1619 -0
- package/server/chunks/vidstack-BskfxwD3.js +566 -0
- package/server/chunks/vidstack-BvLV0SMz.js +4642 -0
- package/server/chunks/vidstack-BvWwluXZ.js +205 -0
- package/server/chunks/vidstack-C-413dj2.js +8 -0
- package/server/chunks/vidstack-C26K8z_-.js +55 -0
- package/server/chunks/vidstack-CJJiksDz.js +107 -0
- package/server/chunks/vidstack-CUNv52x1.js +141 -0
- package/server/chunks/vidstack-CqyBCODe.js +295 -0
- package/server/chunks/vidstack-CwTj4H1w.js +18 -0
- package/server/chunks/vidstack-DHAyGSOl.js +1502 -0
- package/server/chunks/vidstack-DLU3cjcp.js +381 -0
- package/server/chunks/vidstack-DXxIKXmd.js +50 -0
- package/server/chunks/vidstack-DbtDXDS2.js +104 -0
- package/server/chunks/vidstack-Dm1xEU9Q.js +34 -0
- package/server/chunks/vidstack-DzTHw_bw.js +207 -0
- package/server/chunks/vidstack-Wn3NH5Sg.js +1566 -0
- package/server/chunks/vidstack-krOAtKMi.js +32 -0
- package/server/chunks/vidstack-wNViAkr4.js +3045 -0
- package/server/define/plyr-layout.js +16 -0
- package/server/define/vidstack-icons.js +1 -0
- package/server/define/vidstack-player-default-layout.js +13 -0
- package/server/define/vidstack-player-layouts.js +16 -0
- package/server/define/vidstack-player-ui.js +11 -0
- package/server/define/vidstack-player.js +6 -0
- package/server/global/plyr.js +322 -0
- package/server/global/vidstack-player.js +58 -0
- package/server/vidstack-elements.js +46 -0
- package/server/vidstack.js +148 -0
- package/tailwind.cjs +101 -0
- package/tailwind.d.cts +15 -0
- package/types/vidstack-BOvzfZjK.d.ts +1269 -0
- package/types/vidstack-Cttpg6GU.d.ts +7474 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { isNull, isString, deferredPromise, isBoolean } from './vidstack-BGSTndAW.js';
|
|
2
|
+
import { isAudioSrc, isVideoSrc } from './vidstack-xMS8dnYq.js';
|
|
3
|
+
|
|
4
|
+
function appendParamsToURL(baseUrl, params) {
|
|
5
|
+
const url = new URL(baseUrl);
|
|
6
|
+
for (const key of Object.keys(params)) {
|
|
7
|
+
url.searchParams.set(key, params[key] + "");
|
|
8
|
+
}
|
|
9
|
+
return url.toString();
|
|
10
|
+
}
|
|
11
|
+
function preconnect(url, rel = "preconnect") {
|
|
12
|
+
const exists = document.querySelector(`link[href="${url}"]`);
|
|
13
|
+
if (!isNull(exists)) return true;
|
|
14
|
+
const link = document.createElement("link");
|
|
15
|
+
link.rel = rel;
|
|
16
|
+
link.href = url;
|
|
17
|
+
link.crossOrigin = "true";
|
|
18
|
+
document.head.append(link);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
const pendingRequests = {};
|
|
22
|
+
function loadScript(src) {
|
|
23
|
+
if (pendingRequests[src]) return pendingRequests[src].promise;
|
|
24
|
+
const promise = deferredPromise(), exists = document.querySelector(`script[src="${src}"]`);
|
|
25
|
+
if (!isNull(exists)) {
|
|
26
|
+
promise.resolve();
|
|
27
|
+
return promise.promise;
|
|
28
|
+
}
|
|
29
|
+
pendingRequests[src] = promise;
|
|
30
|
+
const script = document.createElement("script");
|
|
31
|
+
script.src = src;
|
|
32
|
+
script.onload = () => {
|
|
33
|
+
promise.resolve();
|
|
34
|
+
delete pendingRequests[src];
|
|
35
|
+
};
|
|
36
|
+
script.onerror = () => {
|
|
37
|
+
promise.reject();
|
|
38
|
+
delete pendingRequests[src];
|
|
39
|
+
};
|
|
40
|
+
setTimeout(() => document.head.append(script), 0);
|
|
41
|
+
return promise.promise;
|
|
42
|
+
}
|
|
43
|
+
function getRequestCredentials(crossOrigin) {
|
|
44
|
+
return crossOrigin === "use-credentials" ? "include" : isString(crossOrigin) ? "same-origin" : void 0;
|
|
45
|
+
}
|
|
46
|
+
function getDownloadFile({
|
|
47
|
+
title,
|
|
48
|
+
src,
|
|
49
|
+
download
|
|
50
|
+
}) {
|
|
51
|
+
const url = isBoolean(download) || download === "" ? src.src : isString(download) ? download : download?.url;
|
|
52
|
+
if (!isValidFileDownload({ url, src, download })) return null;
|
|
53
|
+
return {
|
|
54
|
+
url,
|
|
55
|
+
name: !isBoolean(download) && !isString(download) && download?.filename || title.toLowerCase() || "media"
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function isValidFileDownload({
|
|
59
|
+
url,
|
|
60
|
+
src,
|
|
61
|
+
download
|
|
62
|
+
}) {
|
|
63
|
+
return isString(url) && (download && download !== true || isAudioSrc(src) || isVideoSrc(src));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { appendParamsToURL, getDownloadFile, getRequestCredentials, loadScript, preconnect };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { isArray, isUndefined } from './vidstack-BGSTndAW.js';
|
|
2
|
+
|
|
3
|
+
class TimeRange {
|
|
4
|
+
#ranges;
|
|
5
|
+
get length() {
|
|
6
|
+
return this.#ranges.length;
|
|
7
|
+
}
|
|
8
|
+
constructor(start, end) {
|
|
9
|
+
if (isArray(start)) {
|
|
10
|
+
this.#ranges = start;
|
|
11
|
+
} else if (!isUndefined(start) && !isUndefined(end)) {
|
|
12
|
+
this.#ranges = [[start, end]];
|
|
13
|
+
} else {
|
|
14
|
+
this.#ranges = [];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
start(index) {
|
|
18
|
+
return this.#ranges[index][0] ?? Infinity;
|
|
19
|
+
}
|
|
20
|
+
end(index) {
|
|
21
|
+
return this.#ranges[index][1] ?? Infinity;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function getTimeRangesStart(range) {
|
|
25
|
+
if (!range.length) return null;
|
|
26
|
+
let min = range.start(0);
|
|
27
|
+
for (let i = 1; i < range.length; i++) {
|
|
28
|
+
const value = range.start(i);
|
|
29
|
+
if (value < min) min = value;
|
|
30
|
+
}
|
|
31
|
+
return min;
|
|
32
|
+
}
|
|
33
|
+
function getTimeRangesEnd(range) {
|
|
34
|
+
if (!range.length) return null;
|
|
35
|
+
let max = range.end(0);
|
|
36
|
+
for (let i = 1; i < range.length; i++) {
|
|
37
|
+
const value = range.end(i);
|
|
38
|
+
if (value > max) max = value;
|
|
39
|
+
}
|
|
40
|
+
return max;
|
|
41
|
+
}
|
|
42
|
+
function normalizeTimeIntervals(intervals) {
|
|
43
|
+
if (intervals.length <= 1) {
|
|
44
|
+
return intervals;
|
|
45
|
+
}
|
|
46
|
+
intervals.sort((a, b) => a[0] - b[0]);
|
|
47
|
+
let normalized = [], current = intervals[0];
|
|
48
|
+
for (let i = 1; i < intervals.length; i++) {
|
|
49
|
+
const next = intervals[i];
|
|
50
|
+
if (current[1] >= next[0] - 1) {
|
|
51
|
+
current = [current[0], Math.max(current[1], next[1])];
|
|
52
|
+
} else {
|
|
53
|
+
normalized.push(current);
|
|
54
|
+
current = next;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
normalized.push(current);
|
|
58
|
+
return normalized;
|
|
59
|
+
}
|
|
60
|
+
function updateTimeIntervals(intervals, interval, value) {
|
|
61
|
+
let start = interval[0], end = interval[1];
|
|
62
|
+
if (value < start) {
|
|
63
|
+
return [value, -1];
|
|
64
|
+
} else if (value === start) {
|
|
65
|
+
return interval;
|
|
66
|
+
} else if (start === -1) {
|
|
67
|
+
interval[0] = value;
|
|
68
|
+
return interval;
|
|
69
|
+
} else if (value > start) {
|
|
70
|
+
interval[1] = value;
|
|
71
|
+
if (end === -1) intervals.push(interval);
|
|
72
|
+
}
|
|
73
|
+
normalizeTimeIntervals(intervals);
|
|
74
|
+
return interval;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { TimeRange, getTimeRangesEnd, getTimeRangesStart, normalizeTimeIntervals, updateTimeIntervals };
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { EventsTarget, DOMEvent, isString, isArray, isNumber } from './vidstack-BGSTndAW.js';
|
|
2
|
+
import { getRequestCredentials } from './vidstack-CTojmhKq.js';
|
|
3
|
+
import { isCueActive } from './vidstack-nLyr4NEP.js';
|
|
4
|
+
|
|
5
|
+
const CROSS_ORIGIN = Symbol(0), READY_STATE = Symbol(0), UPDATE_ACTIVE_CUES = Symbol(0), CAN_LOAD = Symbol(0), ON_MODE_CHANGE = Symbol(0), NATIVE = Symbol(0), NATIVE_HLS = Symbol(0);
|
|
6
|
+
const TextTrackSymbol = {
|
|
7
|
+
crossOrigin: CROSS_ORIGIN,
|
|
8
|
+
readyState: READY_STATE,
|
|
9
|
+
updateActiveCues: UPDATE_ACTIVE_CUES,
|
|
10
|
+
canLoad: CAN_LOAD,
|
|
11
|
+
onModeChange: ON_MODE_CHANGE,
|
|
12
|
+
native: NATIVE,
|
|
13
|
+
nativeHLS: NATIVE_HLS
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
class TextTrack extends EventsTarget {
|
|
17
|
+
static createId(track) {
|
|
18
|
+
return `vds-${track.type}-${track.kind}-${track.src ?? track.label ?? "?"}`;
|
|
19
|
+
}
|
|
20
|
+
src;
|
|
21
|
+
content;
|
|
22
|
+
type;
|
|
23
|
+
encoding;
|
|
24
|
+
id = "";
|
|
25
|
+
label = "";
|
|
26
|
+
language = "";
|
|
27
|
+
kind;
|
|
28
|
+
default = false;
|
|
29
|
+
#canLoad = false;
|
|
30
|
+
#currentTime = 0;
|
|
31
|
+
#mode = "disabled";
|
|
32
|
+
#metadata = {};
|
|
33
|
+
#regions = [];
|
|
34
|
+
#cues = [];
|
|
35
|
+
#activeCues = [];
|
|
36
|
+
#cueIds = /* @__PURE__ */ new Set();
|
|
37
|
+
/** @internal */
|
|
38
|
+
[TextTrackSymbol.readyState] = 0;
|
|
39
|
+
/** @internal */
|
|
40
|
+
[TextTrackSymbol.crossOrigin];
|
|
41
|
+
/** @internal */
|
|
42
|
+
[TextTrackSymbol.onModeChange] = null;
|
|
43
|
+
/** @internal */
|
|
44
|
+
[TextTrackSymbol.native] = null;
|
|
45
|
+
get metadata() {
|
|
46
|
+
return this.#metadata;
|
|
47
|
+
}
|
|
48
|
+
get regions() {
|
|
49
|
+
return this.#regions;
|
|
50
|
+
}
|
|
51
|
+
get cues() {
|
|
52
|
+
return this.#cues;
|
|
53
|
+
}
|
|
54
|
+
get activeCues() {
|
|
55
|
+
return this.#activeCues;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* - 0: Not Loading
|
|
59
|
+
* - 1: Loading
|
|
60
|
+
* - 2: Ready
|
|
61
|
+
* - 3: Error
|
|
62
|
+
*/
|
|
63
|
+
get readyState() {
|
|
64
|
+
return this[TextTrackSymbol.readyState];
|
|
65
|
+
}
|
|
66
|
+
get mode() {
|
|
67
|
+
return this.#mode;
|
|
68
|
+
}
|
|
69
|
+
set mode(mode) {
|
|
70
|
+
this.setMode(mode);
|
|
71
|
+
}
|
|
72
|
+
constructor(init) {
|
|
73
|
+
super();
|
|
74
|
+
for (const prop of Object.keys(init)) this[prop] = init[prop];
|
|
75
|
+
if (!this.type) this.type = "vtt";
|
|
76
|
+
if (init.content) {
|
|
77
|
+
this.#parseContent(init);
|
|
78
|
+
} else if (!init.src) {
|
|
79
|
+
this[TextTrackSymbol.readyState] = 2;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
addCue(cue, trigger) {
|
|
83
|
+
if (cue.id) {
|
|
84
|
+
if (this.#cueIds.has(cue.id)) return;
|
|
85
|
+
this.#cueIds.add(cue.id);
|
|
86
|
+
}
|
|
87
|
+
let i = 0, length = this.#cues.length;
|
|
88
|
+
for (i = 0; i < length; i++) if (cue.endTime <= this.#cues[i].startTime) break;
|
|
89
|
+
if (i === length) this.#cues.push(cue);
|
|
90
|
+
else this.#cues.splice(i, 0, cue);
|
|
91
|
+
if (!(cue instanceof TextTrackCue)) {
|
|
92
|
+
this[TextTrackSymbol.native]?.track.addCue(cue);
|
|
93
|
+
}
|
|
94
|
+
this.dispatchEvent(new DOMEvent("add-cue", { detail: cue, trigger }));
|
|
95
|
+
if (isCueActive(cue, this.#currentTime)) {
|
|
96
|
+
this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
removeCue(cue, trigger) {
|
|
100
|
+
const index = this.#cues.indexOf(cue);
|
|
101
|
+
if (index >= 0) {
|
|
102
|
+
const isActive = this.#activeCues.includes(cue);
|
|
103
|
+
if (cue.id) this.#cueIds.delete(cue.id);
|
|
104
|
+
this.#cues.splice(index, 1);
|
|
105
|
+
this[TextTrackSymbol.native]?.track.removeCue(cue);
|
|
106
|
+
this.dispatchEvent(new DOMEvent("remove-cue", { detail: cue, trigger }));
|
|
107
|
+
if (isActive) {
|
|
108
|
+
this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
setMode(mode, trigger) {
|
|
113
|
+
if (this.#mode === mode) return;
|
|
114
|
+
this.#mode = mode;
|
|
115
|
+
if (mode === "disabled") {
|
|
116
|
+
this.#activeCues = [];
|
|
117
|
+
this.#activeCuesChanged();
|
|
118
|
+
} else if (this.readyState === 2) {
|
|
119
|
+
this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);
|
|
120
|
+
} else {
|
|
121
|
+
this.#load();
|
|
122
|
+
}
|
|
123
|
+
this.dispatchEvent(new DOMEvent("mode-change", { detail: this, trigger }));
|
|
124
|
+
this[TextTrackSymbol.onModeChange]?.();
|
|
125
|
+
}
|
|
126
|
+
/** @internal */
|
|
127
|
+
[TextTrackSymbol.updateActiveCues](currentTime, trigger) {
|
|
128
|
+
this.#currentTime = currentTime;
|
|
129
|
+
if (this.mode === "disabled" || !this.#cues.length) return;
|
|
130
|
+
const activeCues = [];
|
|
131
|
+
for (let i = 0, length = this.#cues.length; i < length; i++) {
|
|
132
|
+
const cue = this.#cues[i];
|
|
133
|
+
if (isCueActive(cue, currentTime)) activeCues.push(cue);
|
|
134
|
+
}
|
|
135
|
+
let changed = activeCues.length !== this.#activeCues.length;
|
|
136
|
+
if (!changed) {
|
|
137
|
+
for (let i = 0; i < activeCues.length; i++) {
|
|
138
|
+
if (!this.#activeCues.includes(activeCues[i])) {
|
|
139
|
+
changed = true;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
this.#activeCues = activeCues;
|
|
145
|
+
if (changed) this.#activeCuesChanged(trigger);
|
|
146
|
+
}
|
|
147
|
+
/** @internal */
|
|
148
|
+
[TextTrackSymbol.canLoad]() {
|
|
149
|
+
this.#canLoad = true;
|
|
150
|
+
if (this.#mode !== "disabled") this.#load();
|
|
151
|
+
}
|
|
152
|
+
#parseContent(init) {
|
|
153
|
+
import('media-captions').then(({ parseText, VTTCue, VTTRegion }) => {
|
|
154
|
+
if (!isString(init.content) || init.type === "json") {
|
|
155
|
+
this.#parseJSON(init.content, VTTCue, VTTRegion);
|
|
156
|
+
if (this.readyState !== 3) this.#ready();
|
|
157
|
+
} else {
|
|
158
|
+
const content = init.content.split("\n").map((line) => line.trim()).join("\n").trim();
|
|
159
|
+
parseText(content, { type: init.type }).then(({ cues, regions }) => {
|
|
160
|
+
this.#cues = cues;
|
|
161
|
+
this.#regions = regions;
|
|
162
|
+
this.#ready();
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
async #load() {
|
|
168
|
+
if (!this.#canLoad || this[TextTrackSymbol.readyState] > 0) return;
|
|
169
|
+
this[TextTrackSymbol.readyState] = 1;
|
|
170
|
+
this.dispatchEvent(new DOMEvent("load-start"));
|
|
171
|
+
if (!this.src) {
|
|
172
|
+
this.#ready();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
try {
|
|
176
|
+
const { parseResponse, VTTCue, VTTRegion } = await import('media-captions'), crossOrigin = this[TextTrackSymbol.crossOrigin]?.();
|
|
177
|
+
const response = fetch(this.src, {
|
|
178
|
+
headers: this.type === "json" ? { "Content-Type": "application/json" } : void 0,
|
|
179
|
+
credentials: getRequestCredentials(crossOrigin)
|
|
180
|
+
});
|
|
181
|
+
if (this.type === "json") {
|
|
182
|
+
this.#parseJSON(await (await response).text(), VTTCue, VTTRegion);
|
|
183
|
+
} else {
|
|
184
|
+
const { errors, metadata, regions, cues } = await parseResponse(response, {
|
|
185
|
+
type: this.type,
|
|
186
|
+
encoding: this.encoding
|
|
187
|
+
});
|
|
188
|
+
if (errors[0]?.code === 0) {
|
|
189
|
+
throw errors[0];
|
|
190
|
+
} else {
|
|
191
|
+
this.#metadata = metadata;
|
|
192
|
+
this.#regions = regions;
|
|
193
|
+
this.#cues = cues;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
this.#ready();
|
|
197
|
+
} catch (error) {
|
|
198
|
+
this.#error(error);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
#ready() {
|
|
202
|
+
this[TextTrackSymbol.readyState] = 2;
|
|
203
|
+
if (!this.src || this.type !== "vtt") {
|
|
204
|
+
const native = this[TextTrackSymbol.native];
|
|
205
|
+
if (native && !native.managed) {
|
|
206
|
+
for (const cue of this.#cues) native.track.addCue(cue);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const loadEvent = new DOMEvent("load");
|
|
210
|
+
this[TextTrackSymbol.updateActiveCues](this.#currentTime, loadEvent);
|
|
211
|
+
this.dispatchEvent(loadEvent);
|
|
212
|
+
}
|
|
213
|
+
#error(error) {
|
|
214
|
+
this[TextTrackSymbol.readyState] = 3;
|
|
215
|
+
this.dispatchEvent(new DOMEvent("error", { detail: error }));
|
|
216
|
+
}
|
|
217
|
+
#parseJSON(json, VTTCue, VTTRegion) {
|
|
218
|
+
try {
|
|
219
|
+
const { regions, cues } = parseJSONCaptionsFile(json, VTTCue, VTTRegion);
|
|
220
|
+
this.#regions = regions;
|
|
221
|
+
this.#cues = cues;
|
|
222
|
+
} catch (error) {
|
|
223
|
+
this.#error(error);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
#activeCuesChanged(trigger) {
|
|
227
|
+
this.dispatchEvent(new DOMEvent("cue-change", { trigger }));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const captionRE = /captions|subtitles/;
|
|
231
|
+
function isTrackCaptionKind(track) {
|
|
232
|
+
return captionRE.test(track.kind);
|
|
233
|
+
}
|
|
234
|
+
function parseJSONCaptionsFile(json, Cue, Region) {
|
|
235
|
+
const content = isString(json) ? JSON.parse(json) : json;
|
|
236
|
+
let regions = [], cues = [];
|
|
237
|
+
if (content.regions && Region) {
|
|
238
|
+
regions = content.regions.map((region) => Object.assign(new Region(), region));
|
|
239
|
+
}
|
|
240
|
+
if (content.cues || isArray(content)) {
|
|
241
|
+
cues = (isArray(content) ? content : content.cues).filter((content2) => isNumber(content2.startTime) && isNumber(content2.endTime)).map((cue) => Object.assign(new Cue(0, 0, ""), cue));
|
|
242
|
+
}
|
|
243
|
+
return { regions, cues };
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export { TextTrack, TextTrackSymbol, isTrackCaptionKind, parseJSONCaptionsFile };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { render } from 'lit-html';
|
|
2
|
+
|
|
3
|
+
class LitElement extends HTMLElement {
|
|
4
|
+
rootPart = null;
|
|
5
|
+
connectedCallback() {
|
|
6
|
+
this.rootPart = render(this.render(), this, {
|
|
7
|
+
renderBefore: this.firstChild
|
|
8
|
+
});
|
|
9
|
+
this.rootPart.setConnected(true);
|
|
10
|
+
}
|
|
11
|
+
disconnectedCallback() {
|
|
12
|
+
this.rootPart?.setConnected(false);
|
|
13
|
+
this.rootPart = null;
|
|
14
|
+
render(null, this);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { LitElement };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Host, effect, setAttribute } from './vidstack-BGSTndAW.js';
|
|
2
|
+
import { Poster } from './vidstack-BiyXcJ_M.js';
|
|
3
|
+
import './vidstack-DJDnh4xT.js';
|
|
4
|
+
import './vidstack-CTojmhKq.js';
|
|
5
|
+
import './vidstack-xMS8dnYq.js';
|
|
6
|
+
|
|
7
|
+
class MediaPosterElement extends Host(HTMLElement, Poster) {
|
|
8
|
+
static tagName = "media-poster";
|
|
9
|
+
static attrs = {
|
|
10
|
+
crossOrigin: "crossorigin"
|
|
11
|
+
};
|
|
12
|
+
#img = document.createElement("img");
|
|
13
|
+
onSetup() {
|
|
14
|
+
this.$state.img.set(this.#img);
|
|
15
|
+
}
|
|
16
|
+
onConnect() {
|
|
17
|
+
const { src, alt, crossOrigin } = this.$state;
|
|
18
|
+
effect(() => {
|
|
19
|
+
const { loading, hidden } = this.$state;
|
|
20
|
+
this.#img.style.display = loading() || hidden() ? "none" : "";
|
|
21
|
+
});
|
|
22
|
+
effect(() => {
|
|
23
|
+
setAttribute(this.#img, "alt", alt());
|
|
24
|
+
setAttribute(this.#img, "crossorigin", crossOrigin());
|
|
25
|
+
setAttribute(this.#img, "src", src());
|
|
26
|
+
});
|
|
27
|
+
if (this.#img.parentNode !== this) {
|
|
28
|
+
this.prepend(this.#img);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { MediaPosterElement };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const ADD = Symbol(0), REMOVE = Symbol(0), RESET = Symbol(0), SELECT = Symbol(0), READONLY = Symbol(0), SET_READONLY = Symbol(0), ON_RESET = Symbol(0), ON_REMOVE = Symbol(0), ON_USER_SELECT = Symbol(0);
|
|
2
|
+
const ListSymbol = {
|
|
3
|
+
add: ADD,
|
|
4
|
+
remove: REMOVE,
|
|
5
|
+
reset: RESET,
|
|
6
|
+
select: SELECT,
|
|
7
|
+
readonly: READONLY,
|
|
8
|
+
setReadonly: SET_READONLY,
|
|
9
|
+
onReset: ON_RESET,
|
|
10
|
+
onRemove: ON_REMOVE,
|
|
11
|
+
onUserSelect: ON_USER_SELECT
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { ListSymbol };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { signal, listenEvent, effect, peek, isString } from './vidstack-BGSTndAW.js';
|
|
2
|
+
import { appendParamsToURL } from './vidstack-CTojmhKq.js';
|
|
3
|
+
|
|
4
|
+
class EmbedProvider {
|
|
5
|
+
#iframe;
|
|
6
|
+
src = signal("");
|
|
7
|
+
/**
|
|
8
|
+
* Defines which referrer is sent when fetching the resource.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy}
|
|
11
|
+
*/
|
|
12
|
+
referrerPolicy = null;
|
|
13
|
+
get iframe() {
|
|
14
|
+
return this.#iframe;
|
|
15
|
+
}
|
|
16
|
+
constructor(iframe) {
|
|
17
|
+
this.#iframe = iframe;
|
|
18
|
+
iframe.setAttribute("frameBorder", "0");
|
|
19
|
+
iframe.setAttribute("aria-hidden", "true");
|
|
20
|
+
iframe.setAttribute(
|
|
21
|
+
"allow",
|
|
22
|
+
"autoplay; fullscreen; encrypted-media; picture-in-picture; accelerometer; gyroscope"
|
|
23
|
+
);
|
|
24
|
+
if (this.referrerPolicy !== null) {
|
|
25
|
+
iframe.setAttribute("referrerpolicy", this.referrerPolicy);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
setup() {
|
|
29
|
+
listenEvent(window, "message", this.#onWindowMessage.bind(this));
|
|
30
|
+
listenEvent(this.#iframe, "load", this.onLoad.bind(this));
|
|
31
|
+
effect(this.#watchSrc.bind(this));
|
|
32
|
+
}
|
|
33
|
+
#watchSrc() {
|
|
34
|
+
const src = this.src();
|
|
35
|
+
if (!src.length) {
|
|
36
|
+
this.#iframe.setAttribute("src", "");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const params = peek(() => this.buildParams());
|
|
40
|
+
this.#iframe.setAttribute("src", appendParamsToURL(src, params));
|
|
41
|
+
}
|
|
42
|
+
postMessage(message, target) {
|
|
43
|
+
this.#iframe.contentWindow?.postMessage(JSON.stringify(message), target ?? "*");
|
|
44
|
+
}
|
|
45
|
+
#onWindowMessage(event) {
|
|
46
|
+
const origin = this.getOrigin(), isOriginMatch = (event.source === null || event.source === this.#iframe?.contentWindow) && (!isString(origin) || origin === event.origin);
|
|
47
|
+
if (!isOriginMatch) return;
|
|
48
|
+
try {
|
|
49
|
+
const message = JSON.parse(event.data);
|
|
50
|
+
if (message) this.onMessage(message, event);
|
|
51
|
+
return;
|
|
52
|
+
} catch (e) {
|
|
53
|
+
}
|
|
54
|
+
if (event.data) this.onMessage(event.data, event);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { EmbedProvider };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext, createContext } from './vidstack-BGSTndAW.js';
|
|
2
|
+
|
|
3
|
+
const mediaContext = createContext();
|
|
4
|
+
function useMediaContext() {
|
|
5
|
+
return useContext(mediaContext);
|
|
6
|
+
}
|
|
7
|
+
function useMediaState() {
|
|
8
|
+
return useMediaContext().$state;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { mediaContext, useMediaContext, useMediaState };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var airplay = `<g><path d="M16,1 L2,1 C1.447,1 1,1.447 1,2 L1,12 C1,12.553 1.447,13 2,13 L5,13 L5,11 L3,11 L3,3 L15,3 L15,11 L13,11 L13,13 L16,13 C16.553,13 17,12.553 17,12 L17,2 C17,1.447 16.553,1 16,1 L16,1 Z"></path><polygon points="4 17 14 17 9 11"></polygon></g>`;
|
|
2
|
+
|
|
3
|
+
var captionsOff = `<g fill-rule="evenodd" fill-opacity="0.5"><path d="M1,1 C0.4,1 0,1.4 0,2 L0,13 C0,13.6 0.4,14 1,14 L5.6,14 L8.3,16.7 C8.5,16.9 8.7,17 9,17 C9.3,17 9.5,16.9 9.7,16.7 L12.4,14 L17,14 C17.6,14 18,13.6 18,13 L18,2 C18,1.4 17.6,1 17,1 L1,1 Z M5.52,11.15 C7.51,11.15 8.53,9.83 8.8,8.74 L7.51,8.35 C7.32,9.01 6.73,9.8 5.52,9.8 C4.38,9.8 3.32,8.97 3.32,7.46 C3.32,5.85 4.44,5.09 5.5,5.09 C6.73,5.09 7.28,5.84 7.45,6.52 L8.75,6.11 C8.47,4.96 7.46,3.76 5.5,3.76 C3.6,3.76 1.89,5.2 1.89,7.46 C1.89,9.72 3.54,11.15 5.52,11.15 Z M13.09,11.15 C15.08,11.15 16.1,9.83 16.37,8.74 L15.08,8.35 C14.89,9.01 14.3,9.8 13.09,9.8 C11.95,9.8 10.89,8.97 10.89,7.46 C10.89,5.85 12.01,5.09 13.07,5.09 C14.3,5.09 14.85,5.84 15.02,6.52 L16.32,6.11 C16.04,4.96 15.03,3.76 13.07,3.76 C11.17,3.76 9.46,5.2 9.46,7.46 C9.46,9.72 11.11,11.15 13.09,11.15 Z"></path></g>`;
|
|
4
|
+
|
|
5
|
+
var captionsOn = `<g fill-rule="evenodd"><path d="M1,1 C0.4,1 0,1.4 0,2 L0,13 C0,13.6 0.4,14 1,14 L5.6,14 L8.3,16.7 C8.5,16.9 8.7,17 9,17 C9.3,17 9.5,16.9 9.7,16.7 L12.4,14 L17,14 C17.6,14 18,13.6 18,13 L18,2 C18,1.4 17.6,1 17,1 L1,1 Z M5.52,11.15 C7.51,11.15 8.53,9.83 8.8,8.74 L7.51,8.35 C7.32,9.01 6.73,9.8 5.52,9.8 C4.38,9.8 3.32,8.97 3.32,7.46 C3.32,5.85 4.44,5.09 5.5,5.09 C6.73,5.09 7.28,5.84 7.45,6.52 L8.75,6.11 C8.47,4.96 7.46,3.76 5.5,3.76 C3.6,3.76 1.89,5.2 1.89,7.46 C1.89,9.72 3.54,11.15 5.52,11.15 Z M13.09,11.15 C15.08,11.15 16.1,9.83 16.37,8.74 L15.08,8.35 C14.89,9.01 14.3,9.8 13.09,9.8 C11.95,9.8 10.89,8.97 10.89,7.46 C10.89,5.85 12.01,5.09 13.07,5.09 C14.3,5.09 14.85,5.84 15.02,6.52 L16.32,6.11 C16.04,4.96 15.03,3.76 13.07,3.76 C11.17,3.76 9.46,5.2 9.46,7.46 C9.46,9.72 11.11,11.15 13.09,11.15 Z"></path></g>`;
|
|
6
|
+
|
|
7
|
+
var download = `<g transform="translate(2 1)"><path d="M7,12 C7.3,12 7.5,11.9 7.7,11.7 L13.4,6 L12,4.6 L8,8.6 L8,0 L6,0 L6,8.6 L2,4.6 L0.6,6 L6.3,11.7 C6.5,11.9 6.7,12 7,12 Z" /><rect width="14" height="2" y="14" /></g>`;
|
|
8
|
+
|
|
9
|
+
var exitFullscreen = `<polygon points="10 3 13.6 3 9.6 7 11 8.4 15 4.4 15 8 17 8 17 1 10 1"></polygon><polygon points="7 9.6 3 13.6 3 10 1 10 1 17 8 17 8 15 4.4 15 8.4 11"></polygon>`;
|
|
10
|
+
|
|
11
|
+
var enterFullscreen = `<polygon points="1 12 4.6 12 0.6 16 2 17.4 6 13.4 6 17 8 17 8 10 1 10"></polygon><polygon points="16 0.6 12 4.6 12 1 10 1 10 8 17 8 17 6 13.4 6 17.4 2"></polygon>`;
|
|
12
|
+
|
|
13
|
+
var fastForward = `<polygon points="7.875 7.17142857 0 1 0 17 7.875 10.8285714 7.875 17 18 9 7.875 1"></polygon>`;
|
|
14
|
+
|
|
15
|
+
var muted = `<polygon points="12.4 12.5 14.5 10.4 16.6 12.5 18 11.1 15.9 9 18 6.9 16.6 5.5 14.5 7.6 12.4 5.5 11 6.9 13.1 9 11 11.1"></polygon><path d="M3.78571429,6.00820648 L0.714285714,6.00820648 C0.285714286,6.00820648 0,6.30901277 0,6.76022222 L0,11.2723167 C0,11.7235261 0.285714286,12.0243324 0.714285714,12.0243324 L3.78571429,12.0243324 L7.85714286,15.8819922 C8.35714286,16.1827985 9,15.8819922 9,15.2803796 L9,2.75215925 C9,2.15054666 8.35714286,1.77453879 7.85714286,2.15054666 L3.78571429,6.00820648 Z"></path>`;
|
|
16
|
+
|
|
17
|
+
var pause = `<path d="M6,1 L3,1 C2.4,1 2,1.4 2,2 L2,16 C2,16.6 2.4,17 3,17 L6,17 C6.6,17 7,16.6 7,16 L7,2 C7,1.4 6.6,1 6,1 L6,1 Z"></path><path d="M12,1 C11.4,1 11,1.4 11,2 L11,16 C11,16.6 11.4,17 12,17 L15,17 C15.6,17 16,16.6 16,16 L16,2 C16,1.4 15.6,1 15,1 L12,1 Z"></path>`;
|
|
18
|
+
|
|
19
|
+
var pip = `<polygon points="13.293 3.293 7.022 9.564 8.436 10.978 14.707 4.707 17 7 17 1 11 1"></polygon><path d="M13,15 L3,15 L3,5 L8,5 L8,3 L2,3 C1.448,3 1,3.448 1,4 L1,16 C1,16.552 1.448,17 2,17 L14,17 C14.552,17 15,16.552 15,16 L15,10 L13,10 L13,15 L13,15 Z"></path>`;
|
|
20
|
+
|
|
21
|
+
var play = `<path d="M15.5615866,8.10002147 L3.87056367,0.225209313 C3.05219207,-0.33727727 2,0.225209313 2,1.12518784 L2,16.8748122 C2,17.7747907 3.05219207,18.3372773 3.87056367,17.7747907 L15.5615866,9.89997853 C16.1461378,9.44998927 16.1461378,8.55001073 15.5615866,8.10002147 L15.5615866,8.10002147 Z"></path>`;
|
|
22
|
+
|
|
23
|
+
var restart = `<path d="M9.7,1.2 L10.4,7.6 L12.5,5.5 C14.4,7.4 14.4,10.6 12.5,12.5 C11.6,13.5 10.3,14 9,14 C7.7,14 6.4,13.5 5.5,12.5 C3.6,10.6 3.6,7.4 5.5,5.5 C6.1,4.9 6.9,4.4 7.8,4.2 L7.2,2.3 C6,2.6 4.9,3.2 4,4.1 C1.3,6.8 1.3,11.2 4,14 C5.3,15.3 7.1,16 8.9,16 C10.8,16 12.5,15.3 13.8,14 C16.5,11.3 16.5,6.9 13.8,4.1 L16,1.9 L9.7,1.2 L9.7,1.2 Z"></path>`;
|
|
24
|
+
|
|
25
|
+
var rewind = `<polygon points="10.125 1 0 9 10.125 17 10.125 10.8285714 18 17 18 1 10.125 7.17142857"></polygon>`;
|
|
26
|
+
|
|
27
|
+
var settings = `<path d="M16.135,7.784 C14.832,7.458 14.214,5.966 14.905,4.815 C15.227,4.279 15.13,3.817 14.811,3.499 L14.501,3.189 C14.183,2.871 13.721,2.774 13.185,3.095 C12.033,3.786 10.541,3.168 10.216,1.865 C10.065,1.258 9.669,1 9.219,1 L8.781,1 C8.331,1 7.936,1.258 7.784,1.865 C7.458,3.168 5.966,3.786 4.815,3.095 C4.279,2.773 3.816,2.87 3.498,3.188 L3.188,3.498 C2.87,3.816 2.773,4.279 3.095,4.815 C3.786,5.967 3.168,7.459 1.865,7.784 C1.26,7.935 1,8.33 1,8.781 L1,9.219 C1,9.669 1.258,10.064 1.865,10.216 C3.168,10.542 3.786,12.034 3.095,13.185 C2.773,13.721 2.87,14.183 3.189,14.501 L3.499,14.811 C3.818,15.13 4.281,15.226 4.815,14.905 C5.967,14.214 7.459,14.832 7.784,16.135 C7.935,16.742 8.331,17 8.781,17 L9.219,17 C9.669,17 10.064,16.742 10.216,16.135 C10.542,14.832 12.034,14.214 13.185,14.905 C13.72,15.226 14.182,15.13 14.501,14.811 L14.811,14.501 C15.129,14.183 15.226,13.72 14.905,13.185 C14.214,12.033 14.832,10.541 16.135,10.216 C16.742,10.065 17,9.669 17,9.219 L17,8.781 C17,8.33 16.74,7.935 16.135,7.784 L16.135,7.784 Z M9,12 C7.343,12 6,10.657 6,9 C6,7.343 7.343,6 9,6 C10.657,6 12,7.343 12,9 C12,10.657 10.657,12 9,12 L9,12 Z"></path>`;
|
|
28
|
+
|
|
29
|
+
var volume = `<path d="M15.5999996,3.3 C15.1999996,2.9 14.5999996,2.9 14.1999996,3.3 C13.7999996,3.7 13.7999996,4.3 14.1999996,4.7 C15.3999996,5.9 15.9999996,7.4 15.9999996,9 C15.9999996,10.6 15.3999996,12.1 14.1999996,13.3 C13.7999996,13.7 13.7999996,14.3 14.1999996,14.7 C14.3999996,14.9 14.6999996,15 14.8999996,15 C15.1999996,15 15.3999996,14.9 15.5999996,14.7 C17.0999996,13.2 17.9999996,11.2 17.9999996,9 C17.9999996,6.8 17.0999996,4.8 15.5999996,3.3 L15.5999996,3.3 Z"></path><path d="M11.2819745,5.28197449 C10.9060085,5.65794047 10.9060085,6.22188944 11.2819745,6.59785542 C12.0171538,7.33303477 12.2772954,8.05605449 12.2772954,9.00000021 C12.2772954,9.93588462 11.851678,10.9172014 11.2819745,11.4869049 C10.9060085,11.8628709 10.9060085,12.4268199 11.2819745,12.8027859 C11.4271642,12.9479755 11.9176724,13.0649528 12.2998149,12.9592565 C12.4124479,12.9281035 12.5156669,12.8776063 12.5978555,12.8027859 C13.773371,11.732654 14.1311161,10.1597914 14.1312523,9.00000021 C14.1312723,8.8299555 14.1286311,8.66015647 14.119665,8.4897429 C14.0674781,7.49784946 13.8010171,6.48513613 12.5978554,5.28197449 C12.2218894,4.9060085 11.6579405,4.9060085 11.2819745,5.28197449 Z"></path><path d="M3.78571429,6.00820648 L0.714285714,6.00820648 C0.285714286,6.00820648 0,6.30901277 0,6.76022222 L0,11.2723167 C0,11.7235261 0.285714286,12.0243324 0.714285714,12.0243324 L3.78571429,12.0243324 L7.85714286,15.8819922 C8.35714286,16.1827985 9,15.8819922 9,15.2803796 L9,2.75215925 C9,2.15054666 8.35714286,1.77453879 7.85714286,2.15054666 L3.78571429,6.00820648 Z"></path>`;
|
|
30
|
+
|
|
31
|
+
const icons = {
|
|
32
|
+
airplay,
|
|
33
|
+
"captions-off": captionsOff,
|
|
34
|
+
"captions-on": captionsOn,
|
|
35
|
+
download,
|
|
36
|
+
"enter-fullscreen": enterFullscreen,
|
|
37
|
+
"exit-fullscreen": exitFullscreen,
|
|
38
|
+
"fast-forward": fastForward,
|
|
39
|
+
muted,
|
|
40
|
+
pause,
|
|
41
|
+
"enter-pip": pip,
|
|
42
|
+
"exit-pip": pip,
|
|
43
|
+
play,
|
|
44
|
+
restart,
|
|
45
|
+
rewind,
|
|
46
|
+
settings,
|
|
47
|
+
volume
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { icons };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Icon$24, effect } from './vidstack-BGSTndAW.js';
|
|
2
|
+
import { cloneTemplateContent, createTemplate } from './vidstack-C2US-gSO.js';
|
|
3
|
+
import '@floating-ui/dom';
|
|
4
|
+
|
|
5
|
+
const svgTemplate = /* @__PURE__ */ createTemplate(
|
|
6
|
+
`<svg viewBox="0 0 32 32" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"></svg>`
|
|
7
|
+
);
|
|
8
|
+
function insertContent(container, $state) {
|
|
9
|
+
const icon = cloneTemplateContent(svgTemplate);
|
|
10
|
+
icon.innerHTML = Icon$24;
|
|
11
|
+
container.append(icon);
|
|
12
|
+
const text = document.createElement("span");
|
|
13
|
+
text.classList.add("vds-google-cast-info");
|
|
14
|
+
container.append(text);
|
|
15
|
+
const deviceName = document.createElement("span");
|
|
16
|
+
deviceName.classList.add("vds-google-cast-device-name");
|
|
17
|
+
effect(() => {
|
|
18
|
+
const { remotePlaybackInfo } = $state, info = remotePlaybackInfo();
|
|
19
|
+
if (info?.deviceName) {
|
|
20
|
+
deviceName.textContent = info.deviceName;
|
|
21
|
+
text.append("Google Cast on ", deviceName);
|
|
22
|
+
}
|
|
23
|
+
return () => {
|
|
24
|
+
text.textContent = "";
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { insertContent };
|