@kanorio/elements 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +57 -2
- package/dist/MediaPlayer-MWIDJORE.js +2 -0
- package/dist/MediaPlayer-STITRANS.js +13 -0
- package/dist/PDFViewerFull-HIUSAO57.js +13 -0
- package/dist/PDFViewerFull-L7VMOAMU.js +28062 -0
- package/dist/altcha-DSOKKAAV.js +3153 -0
- package/dist/altcha-FLBUR2LJ.js +4 -0
- package/dist/ar-4CBE4BWH.js +1233 -0
- package/dist/ar-6G7ZVSQ3.js +2 -0
- package/dist/ar-XCPH4WO5.js +98 -0
- package/dist/ar-ZVJL6XGE.js +2 -0
- package/dist/bg-4WPFSAMC.js +2 -0
- package/dist/bg-BKFL64I6.js +98 -0
- package/dist/bg-CB273F4D.js +1233 -0
- package/dist/bg-HCH4LMEX.js +2 -0
- package/dist/bn-HLYDEXHQ.js +1233 -0
- package/dist/bn-HVEVBAGM.js +98 -0
- package/dist/bn-OY7YGJIT.js +2 -0
- package/dist/bn-XX3O4VQB.js +2 -0
- package/dist/chunk-2UBPQBQI.js +1848 -0
- package/dist/chunk-5OB57Z46.js +23620 -0
- package/dist/chunk-6LJZ4HRF.js +1350 -0
- package/dist/chunk-6TUB24LJ.js +415 -0
- package/dist/chunk-74RRJOB4.js +15 -0
- package/dist/chunk-7TNRMVML.js +2 -0
- package/dist/chunk-BH27SBYG.js +2 -0
- package/dist/chunk-BQU7QZGC.js +4 -0
- package/dist/chunk-CHSZMJ5D.js +15103 -0
- package/dist/chunk-DDKQOHPW.js +930 -0
- package/dist/chunk-E5ZVE4VL.js +5 -0
- package/dist/chunk-FGBB7FT5.js +4 -0
- package/dist/chunk-FSH5K5FU.js +57 -0
- package/dist/chunk-G3PMV62Z.js +36 -0
- package/dist/chunk-IUB5YLUU.js +1538 -0
- package/dist/chunk-J7AP6FJF.js +8616 -0
- package/dist/chunk-LKOMEUNH.js +72 -0
- package/dist/chunk-NB57OIQA.js +2 -0
- package/dist/chunk-NLJE74VA.js +2 -0
- package/dist/chunk-NQBPWU5Z.js +15 -0
- package/dist/chunk-OJQYDPRD.js +39 -0
- package/dist/chunk-PDKFEXLU.js +59 -0
- package/dist/chunk-POG53MIA.js +2 -0
- package/dist/chunk-PXABHOW4.js +10871 -0
- package/dist/chunk-QDUG7UMV.js +363 -0
- package/dist/chunk-RFBBAUMM.js +2 -0
- package/dist/chunk-RJTKNOYT.js +67 -0
- package/dist/chunk-VH4656UY.js +2 -0
- package/dist/chunk-XAORGJWX.js +2 -0
- package/dist/chunk-Y77XXKLY.js +1858 -0
- package/dist/cs-EDLILQAV.js +1233 -0
- package/dist/cs-EOBDWVFI.js +2 -0
- package/dist/cs-Q732FDDB.js +98 -0
- package/dist/cs-UO3FC3H4.js +2 -0
- package/dist/da-43RMOYSN.js +98 -0
- package/dist/da-ANHSL3GD.js +2 -0
- package/dist/da-RBW34GCF.js +2 -0
- package/dist/da-SJ7YQT4L.js +1233 -0
- package/dist/de-2D2GW24Z.js +2 -0
- package/dist/de-5WGC4CMF.js +1233 -0
- package/dist/de-CPU2ARG7.js +98 -0
- package/dist/de-GVWNGUWZ.js +2 -0
- package/dist/deliverables-QUJISOBO.js +98 -0
- package/dist/deliverables-Z6ZBT6D3.js +2046 -0
- package/dist/el-FRNBHLQF.js +98 -0
- package/dist/el-HCBWOOCJ.js +1233 -0
- package/dist/el-KK7DBDUW.js +2 -0
- package/dist/el-SK362ZEN.js +2 -0
- package/dist/elements.css +2 -0
- package/dist/en-AU-BQA3DX35.js +1233 -0
- package/dist/en-AU-VZAXNXRA.js +2 -0
- package/dist/en-CA-T2VRZJVQ.js +2 -0
- package/dist/en-CA-ZWY5HD2Z.js +1233 -0
- package/dist/en-GB-CH3IGZSE.js +1233 -0
- package/dist/en-GB-MZQ2MGOR.js +2 -0
- package/dist/en-M24TV37U.js +2 -0
- package/dist/en-OURP64TI.js +2 -0
- package/dist/en-US-VWMNQOMN.js +2 -0
- package/dist/en-US-WJZ2OBFI.js +1233 -0
- package/dist/en-USCPKTM6.js +1233 -0
- package/dist/en-YND44PUO.js +98 -0
- package/dist/errors-7SQHRWKX.js +77 -0
- package/dist/errors-S6NFCUG2.js +2 -0
- package/dist/es-419-EMD4NA5M.js +2 -0
- package/dist/es-419-GPBJSXLV.js +2 -0
- package/dist/es-419-S6IHEZ4E.js +1233 -0
- package/dist/es-419-XPZOWYCA.js +98 -0
- package/dist/es-ES-EGMSPSY2.js +1233 -0
- package/dist/es-ES-U6NF6JHU.js +2 -0
- package/dist/es-es-ILD7QLKC.js +98 -0
- package/dist/es-es-MPX25JA6.js +2 -0
- package/dist/fa-5J3M6LW4.js +2 -0
- package/dist/fa-OC7ZPRF2.js +98 -0
- package/dist/fa-OFIO7IXD.js +1233 -0
- package/dist/fa-ZTPM4LEB.js +2 -0
- package/dist/fi-2V2STXSQ.js +2 -0
- package/dist/fi-7J4LPMG2.js +98 -0
- package/dist/fi-FMEAITYP.js +1233 -0
- package/dist/fi-N3BC4FYB.js +2 -0
- package/dist/fr-CA-IKSBTBHG.js +2 -0
- package/dist/fr-CA-S23ERMPM.js +1233 -0
- package/dist/fr-FR-RRTMSQWD.js +2 -0
- package/dist/fr-FR-SOIXFVK2.js +1233 -0
- package/dist/fr-ca-SUWTTOEW.js +2 -0
- package/dist/fr-ca-UUHAWMHI.js +98 -0
- package/dist/fr-fr-SGQ77PBC.js +98 -0
- package/dist/fr-fr-XE2V7MKM.js +2 -0
- package/dist/gu-RT7GQT5B.js +2 -0
- package/dist/gu-Z2QX2VCX.js +1233 -0
- package/dist/he-27MBDHSP.js +2 -0
- package/dist/he-E7RIZOIT.js +1233 -0
- package/dist/he-QGD477CH.js +98 -0
- package/dist/he-R3UJFF46.js +2 -0
- package/dist/hi-2AVAXR7K.js +1233 -0
- package/dist/hi-6ZBMVMGH.js +2 -0
- package/dist/hi-SGQH4OWG.js +98 -0
- package/dist/hi-XJHFN25N.js +2 -0
- package/dist/hls-C5FWCMHH.js +37426 -0
- package/dist/hls-ZQNRY2TQ.js +45 -0
- package/dist/hu-IOGZTF7L.js +2 -0
- package/dist/hu-KNZXJ7ZI.js +98 -0
- package/dist/hu-ORVGO3ZY.js +1233 -0
- package/dist/hu-PKL3T3JT.js +2 -0
- package/dist/id-FKFVQIN6.js +2 -0
- package/dist/id-JH2DLDBA.js +98 -0
- package/dist/id-TMOJUCBD.js +1233 -0
- package/dist/id-WLBO2VOW.js +2 -0
- package/dist/index.d.ts +2955 -0
- package/dist/index.js +67 -0
- package/dist/it-AGUEDSVA.js +2 -0
- package/dist/it-PJAB5BQB.js +98 -0
- package/dist/it-WF5BTFFJ.js +2 -0
- package/dist/it-YMZRYSIJ.js +1233 -0
- package/dist/ja-2ZVND7MB.js +2 -0
- package/dist/ja-555SY4AF.js +1233 -0
- package/dist/ja-RMBJ7E5Z.js +2 -0
- package/dist/ja-ZKBUQDUT.js +98 -0
- package/dist/kanorio-elements.js +97 -0
- package/dist/km-DF366BBP.js +1233 -0
- package/dist/km-JIUQ7MSM.js +2 -0
- package/dist/kn-KTJPREMQ.js +2 -0
- package/dist/kn-MJKASLJD.js +1233 -0
- package/dist/ko-CGY75OW4.js +2 -0
- package/dist/ko-KECCYX66.js +2 -0
- package/dist/ko-L5735TRU.js +98 -0
- package/dist/ko-S3OTZKIG.js +1233 -0
- package/dist/lo-7R55FKUB.js +1233 -0
- package/dist/lo-DNWTAFYF.js +2 -0
- package/dist/ml-B4BJPFVQ.js +2 -0
- package/dist/ml-FCTNQ4SP.js +1233 -0
- package/dist/mr-FJ4EDO7F.js +2 -0
- package/dist/mr-TZTFABWX.js +2 -0
- package/dist/mr-VZ5Y74YA.js +1233 -0
- package/dist/mr-Y464JCKX.js +98 -0
- package/dist/ms-VCX47GHB.js +2 -0
- package/dist/ms-WAJKD7ZV.js +1233 -0
- package/dist/my-S5L32WDK.js +2 -0
- package/dist/my-T7Y3Y64H.js +1233 -0
- package/dist/nb-53GCFBHF.js +2 -0
- package/dist/nb-IJDALVGX.js +99 -0
- package/dist/nb-LXBBUZUD.js +1233 -0
- package/dist/nb-PWWLEFUC.js +2 -0
- package/dist/ne-F7EEIDMA.js +2 -0
- package/dist/ne-NDLRKG6T.js +1233 -0
- package/dist/nl-262SKC6R.js +98 -0
- package/dist/nl-BE-3KOYUD6Y.js +1233 -0
- package/dist/nl-BE-VZJDK6CH.js +2 -0
- package/dist/nl-NL-3OIKN2DQ.js +2 -0
- package/dist/nl-NL-T7SQOLLA.js +1233 -0
- package/dist/nl-XKCUNU3P.js +2 -0
- package/dist/nn-AHWRAFXZ.js +1233 -0
- package/dist/nn-YH7F7UK3.js +2 -0
- package/dist/pa-HC24FOUI.js +2 -0
- package/dist/pa-J26C5J7M.js +1233 -0
- package/dist/pl-QSTOYTPG.js +1233 -0
- package/dist/pl-T7J6A26Y.js +2 -0
- package/dist/pl-TYHET6JJ.js +2 -0
- package/dist/pl-XDJJ6AUG.js +98 -0
- package/dist/prod-MRWX5W24.js +38 -0
- package/dist/prod-YHXWTKNF.js +2 -0
- package/dist/pt-BR-4QRR4PXU.js +2 -0
- package/dist/pt-BR-7JM75AGX.js +1233 -0
- package/dist/pt-PT-W3WZEROD.js +1233 -0
- package/dist/pt-PT-Z5FI4CLF.js +2 -0
- package/dist/pt-br-2W4P4ZAJ.js +2 -0
- package/dist/pt-br-JP6VI5C5.js +98 -0
- package/dist/pt-pt-22LJFZT5.js +98 -0
- package/dist/pt-pt-HOBFIPWZ.js +2 -0
- package/dist/ro-3KXIEYVK.js +98 -0
- package/dist/ro-3YUPB2TJ.js +1233 -0
- package/dist/ro-JXHNIBOA.js +2 -0
- package/dist/ro-KHPOLQC6.js +2 -0
- package/dist/ru-5ZVLKPFN.js +2 -0
- package/dist/ru-ASND25AB.js +2 -0
- package/dist/ru-ATGZC5LB.js +1233 -0
- package/dist/ru-W44AHOIC.js +98 -0
- package/dist/si-RHXLIDQI.js +1233 -0
- package/dist/si-U3O6NRHE.js +2 -0
- package/dist/srt-parser-6DEDUV5P.js +43 -0
- package/dist/srt-parser-E666S3YO.js +3 -0
- package/dist/ssa-parser-5GJ737XF.js +309 -0
- package/dist/ssa-parser-BR3CTDHR.js +5 -0
- package/dist/sv-5LOOKXJA.js +98 -0
- package/dist/sv-6GKNCPMS.js +2 -0
- package/dist/sv-LL3HMUIA.js +1233 -0
- package/dist/sv-RRJ6LYFT.js +2 -0
- package/dist/sw-HBNHIHPG.js +2 -0
- package/dist/sw-HP7MYGQ5.js +1233 -0
- package/dist/sw-NTSCFQXY.js +2 -0
- package/dist/sw-YIUB7QN3.js +98 -0
- package/dist/ta-4RG3PWN5.js +98 -0
- package/dist/ta-ARSNSDK5.js +2 -0
- package/dist/ta-Q2LBTDH6.js +2 -0
- package/dist/ta-Z5EVUBYF.js +1233 -0
- package/dist/te-FAWIFHVW.js +2 -0
- package/dist/te-FXJYUGGL.js +98 -0
- package/dist/te-GDV3DJFJ.js +1233 -0
- package/dist/te-TIMB7HBY.js +2 -0
- package/dist/th-7CEFYE5H.js +2 -0
- package/dist/th-CFAEFK3E.js +1233 -0
- package/dist/th-KGPTXFIF.js +2 -0
- package/dist/th-TC6J25FB.js +98 -0
- package/dist/tl-2JDK2CBL.js +2 -0
- package/dist/tl-SGZM4XSX.js +1233 -0
- package/dist/tr-27OEWIPE.js +1233 -0
- package/dist/tr-2MEHQO75.js +98 -0
- package/dist/tr-7P2UAX7U.js +2 -0
- package/dist/tr-NKD6C4RY.js +2 -0
- package/dist/uk-CXQISVJP.js +2 -0
- package/dist/uk-EJIGGLKY.js +1233 -0
- package/dist/uk-JCI3UE6Q.js +98 -0
- package/dist/uk-QM5BBWP7.js +2 -0
- package/dist/ur-5EWYHPME.js +1233 -0
- package/dist/ur-IIOUQYSA.js +98 -0
- package/dist/ur-M3QWGAPF.js +2 -0
- package/dist/ur-TLLPXSTM.js +2 -0
- package/dist/vi-AXQYYRD3.js +2 -0
- package/dist/vi-JALLXYS7.js +1233 -0
- package/dist/vi-SS65KZTI.js +2 -0
- package/dist/vi-YQVNQEVG.js +98 -0
- package/dist/vidstack-B9fTkxQO-LJP5ADOO.js +215 -0
- package/dist/vidstack-B9fTkxQO-OCT23G55.js +2 -0
- package/dist/vidstack-BmcqUMKx-A2W3TQB6.js +2 -0
- package/dist/vidstack-BmcqUMKx-G6TB22IC.js +286 -0
- package/dist/vidstack-C0fPJIzs-7AH6MOHO.js +2 -0
- package/dist/vidstack-C0fPJIzs-PNQOR4TK.js +11 -0
- package/dist/vidstack-CHcsWfRV-UAVLHO6N.js +40 -0
- package/dist/vidstack-CHcsWfRV-V52LFHYG.js +2 -0
- package/dist/vidstack-CvezEmSQ-JXKCQ4VQ.js +2 -0
- package/dist/vidstack-CvezEmSQ-R32NZKJ2.js +130 -0
- package/dist/vidstack-D2vrrUMs-7XAY5IBS.js +2 -0
- package/dist/vidstack-D2vrrUMs-FNQR2A5M.js +467 -0
- package/dist/vidstack-Di0HObvT-6ND3AXWZ.js +112 -0
- package/dist/vidstack-Di0HObvT-ZV7XK2OT.js +2 -0
- package/dist/vidstack-DiaLSJYx-H762DXYG.js +2 -0
- package/dist/vidstack-DiaLSJYx-S7DDW2H3.js +380 -0
- package/dist/vidstack-Dy74GavT-EYLL6MEF.js +2 -0
- package/dist/vidstack-Dy74GavT-XNIJ7PF4.js +11 -0
- package/dist/vidstack-GkTzay8D-C7EJKMV4.js +2 -0
- package/dist/vidstack-GkTzay8D-SQU5IF3P.js +482 -0
- package/dist/web-components.d.ts +12 -0
- package/dist/web-components.js +123 -0
- package/dist/worker.js +1 -0
- package/dist/zh-CN-PVVDP25S.js +2 -0
- package/dist/zh-CN-TLPNCXUN.js +1233 -0
- package/dist/zh-HK-GOKVZUJZ.js +1233 -0
- package/dist/zh-HK-Z5B2ANLW.js +2 -0
- package/dist/zh-Hant-2R7T4HJT.js +1233 -0
- package/dist/zh-Hant-MWAFLLDD.js +2 -0
- package/dist/zh-cn-D36OS2SI.js +2 -0
- package/dist/zh-cn-Z5YVUN62.js +98 -0
- package/dist/zh-tw-JWILJCBD.js +2 -0
- package/dist/zh-tw-X7JGMR4G.js +98 -0
- package/package.json +84 -3
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getCastContext,
|
|
4
|
+
getCastErrorMessage,
|
|
5
|
+
getCastFrameworkURL,
|
|
6
|
+
getCastSession,
|
|
7
|
+
getDefaultCastOptions,
|
|
8
|
+
hasLoadedCastFramework,
|
|
9
|
+
isCastAvailable,
|
|
10
|
+
isCastConnected
|
|
11
|
+
} from "./chunk-PDKFEXLU.js";
|
|
12
|
+
import {
|
|
13
|
+
IS_CHROME,
|
|
14
|
+
IS_IOS,
|
|
15
|
+
IS_SERVER,
|
|
16
|
+
canGoogleCastSrc,
|
|
17
|
+
loadScript
|
|
18
|
+
} from "./chunk-2UBPQBQI.js";
|
|
19
|
+
import {
|
|
20
|
+
peek
|
|
21
|
+
} from "./chunk-IUB5YLUU.js";
|
|
22
|
+
import "./chunk-G3PMV62Z.js";
|
|
23
|
+
|
|
24
|
+
// ../../node_modules/.pnpm/@vidstack+react@1.15.6_@types+react@19.2.8_react@19.2.1/node_modules/@vidstack/react/prod/chunks/vidstack-Di0HObvT.js
|
|
25
|
+
var GoogleCastLoader = class {
|
|
26
|
+
name = "google-cast";
|
|
27
|
+
target;
|
|
28
|
+
#player;
|
|
29
|
+
/**
|
|
30
|
+
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastContext}
|
|
31
|
+
*/
|
|
32
|
+
get cast() {
|
|
33
|
+
return getCastContext();
|
|
34
|
+
}
|
|
35
|
+
mediaType() {
|
|
36
|
+
return "video";
|
|
37
|
+
}
|
|
38
|
+
canPlay(src) {
|
|
39
|
+
return IS_CHROME && !IS_IOS && canGoogleCastSrc(src);
|
|
40
|
+
}
|
|
41
|
+
async prompt(ctx) {
|
|
42
|
+
let loadEvent, openEvent, errorEvent;
|
|
43
|
+
try {
|
|
44
|
+
loadEvent = await this.#loadCastFramework(ctx);
|
|
45
|
+
if (!this.#player) {
|
|
46
|
+
this.#player = new cast.framework.RemotePlayer();
|
|
47
|
+
new cast.framework.RemotePlayerController(this.#player);
|
|
48
|
+
}
|
|
49
|
+
openEvent = ctx.player.createEvent("google-cast-prompt-open", { trigger: loadEvent });
|
|
50
|
+
ctx.player.dispatchEvent(openEvent);
|
|
51
|
+
this.#notifyRemoteStateChange(ctx, "connecting", openEvent);
|
|
52
|
+
await this.#showPrompt(peek(ctx.$props.googleCast));
|
|
53
|
+
ctx.$state.remotePlaybackInfo.set({ deviceName: getCastSession()?.getCastDevice().friendlyName });
|
|
54
|
+
if (isCastConnected()) this.#notifyRemoteStateChange(ctx, "connected", openEvent);
|
|
55
|
+
} catch (code) {
|
|
56
|
+
const error = code instanceof Error ? code : this.#createError((code + "").toUpperCase(), "Prompt failed.");
|
|
57
|
+
errorEvent = ctx.player.createEvent("google-cast-prompt-error", {
|
|
58
|
+
detail: error,
|
|
59
|
+
trigger: openEvent ?? loadEvent,
|
|
60
|
+
cancelable: true
|
|
61
|
+
});
|
|
62
|
+
ctx.player.dispatch(errorEvent);
|
|
63
|
+
this.#notifyRemoteStateChange(ctx, isCastConnected() ? "connected" : "disconnected", errorEvent);
|
|
64
|
+
throw error;
|
|
65
|
+
} finally {
|
|
66
|
+
ctx.player.dispatch("google-cast-prompt-close", { trigger: errorEvent ?? openEvent ?? loadEvent });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async load(ctx) {
|
|
70
|
+
if (IS_SERVER) throw Error("[vidstack] can not load google cast provider server-side");
|
|
71
|
+
if (!this.#player) throw Error("[vidstack] google cast player was not initialized");
|
|
72
|
+
return new (await import("./vidstack-D2vrrUMs-FNQR2A5M.js")).GoogleCastProvider(this.#player, ctx);
|
|
73
|
+
}
|
|
74
|
+
async #loadCastFramework(ctx) {
|
|
75
|
+
if (hasLoadedCastFramework()) return;
|
|
76
|
+
const loadStartEvent = ctx.player.createEvent("google-cast-load-start");
|
|
77
|
+
ctx.player.dispatch(loadStartEvent);
|
|
78
|
+
await loadScript(getCastFrameworkURL());
|
|
79
|
+
await customElements.whenDefined("google-cast-launcher");
|
|
80
|
+
const loadedEvent = ctx.player.createEvent("google-cast-loaded", { trigger: loadStartEvent });
|
|
81
|
+
ctx.player.dispatch(loadedEvent);
|
|
82
|
+
if (!isCastAvailable()) throw this.#createError("CAST_NOT_AVAILABLE", "Google Cast not available on this platform.");
|
|
83
|
+
return loadedEvent;
|
|
84
|
+
}
|
|
85
|
+
async #showPrompt(options) {
|
|
86
|
+
this.#setOptions(options);
|
|
87
|
+
const errorCode = await this.cast.requestSession();
|
|
88
|
+
if (errorCode) throw this.#createError(errorCode.toUpperCase(), getCastErrorMessage(errorCode));
|
|
89
|
+
}
|
|
90
|
+
#setOptions(options) {
|
|
91
|
+
this.cast?.setOptions({
|
|
92
|
+
...getDefaultCastOptions(),
|
|
93
|
+
...options
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
#notifyRemoteStateChange(ctx, state, trigger) {
|
|
97
|
+
const detail = {
|
|
98
|
+
type: "google-cast",
|
|
99
|
+
state
|
|
100
|
+
};
|
|
101
|
+
ctx.notify("remote-playback-change", detail, trigger);
|
|
102
|
+
}
|
|
103
|
+
#createError(code, message) {
|
|
104
|
+
const error = Error(message);
|
|
105
|
+
error.code = code;
|
|
106
|
+
return error;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
GoogleCastLoader
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=vidstack-Di0HObvT-6ND3AXWZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{a as h,b as m,c as y,d as s,e as C,f,i as w,j as v}from"./chunk-NB57OIQA.js";import{F as g,J as d,a as l,b as c,d as p}from"./chunk-FGBB7FT5.js";import{b as n}from"./chunk-BH27SBYG.js";import"./chunk-74RRJOB4.js";import"./chunk-RFBBAUMM.js";var k=class{name="google-cast";target;#e;get cast(){return C()}mediaType(){return"video"}canPlay(e){return p&&!c&&g(e)}async prompt(e){let t,a,r;try{t=await this.#r(e),this.#e||(this.#e=new cast.framework.RemotePlayer,new cast.framework.RemotePlayerController(this.#e)),a=e.player.createEvent("google-cast-prompt-open",{trigger:t}),e.player.dispatchEvent(a),this.#t(e,"connecting",a),await this.#o(n(e.$props.googleCast)),e.$state.remotePlaybackInfo.set({deviceName:f()?.getCastDevice().friendlyName}),s()&&this.#t(e,"connected",a)}catch(o){let i=o instanceof Error?o:this.#a((o+"").toUpperCase(),"Prompt failed.");throw r=e.player.createEvent("google-cast-prompt-error",{detail:i,trigger:a??t,cancelable:!0}),e.player.dispatch(r),this.#t(e,s()?"connected":"disconnected",r),i}finally{e.player.dispatch("google-cast-prompt-close",{trigger:r??a??t})}}async load(e){if(l)throw Error("[vidstack] can not load google cast provider server-side");if(!this.#e)throw Error("[vidstack] google cast player was not initialized");return new(await import("./vidstack-D2vrrUMs-7XAY5IBS.js")).GoogleCastProvider(this.#e,e)}async#r(e){if(m())return;let t=e.player.createEvent("google-cast-load-start");e.player.dispatch(t),await d(h()),await customElements.whenDefined("google-cast-launcher");let a=e.player.createEvent("google-cast-loaded",{trigger:t});if(e.player.dispatch(a),!y())throw this.#a("CAST_NOT_AVAILABLE","Google Cast not available on this platform.");return a}async#o(e){this.#s(e);let t=await this.cast.requestSession();if(t)throw this.#a(t.toUpperCase(),v(t))}#s(e){this.cast?.setOptions({...w(),...e})}#t(e,t,a){let r={type:"google-cast",state:t};e.notify("remote-playback-change",r,a)}#a(e,t){let a=Error(t);return a.code=e,a}};export{k as GoogleCastLoader};
|
|
2
|
+
//# sourceMappingURL=vidstack-Di0HObvT-ZV7XK2OT.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{I as m,J as w,M as g,R as x,U as u,Y as L,Z as D,ba as C,ca as I,d as T,m as k}from"./chunk-FGBB7FT5.js";import{C as y,O as b,b as p,n as v,r as l,t as S,v as E,w as d}from"./chunk-BH27SBYG.js";import"./chunk-74RRJOB4.js";import"./chunk-RFBBAUMM.js";var A=t=>b(t),_=class{#e;#t;#i=null;#n=null;config={};#r=new Set;get instance(){return this.#i}constructor(t,i){this.#e=t,this.#t=i}setup(t){let{streamType:i}=this.#t.$state,e=p(i).includes("live"),o=p(i).includes("ll-"),s=this.#i=new t({lowLatencyMode:o,backBufferLength:o?4:e?8:void 0,renderTextTracksNatively:!1,...this.config}),n=c=>(a,h)=>{this.#i===s&&c(a,h)},r=n(this.#h.bind(this));for(let c of Object.values(t.Events))s.on(c,r);s.on(t.Events.ERROR,n(this.#v.bind(this)));for(let c of this.#r)c(s);this.#t.player.dispatch("hls-instance",{detail:s}),s.attachMedia(this.#e),s.on(t.Events.AUDIO_TRACK_SWITCHED,n(this.#l.bind(this))),s.on(t.Events.LEVEL_SWITCHED,n(this.#u.bind(this))),s.on(t.Events.LEVEL_LOADED,n(this.#f.bind(this,s))),s.on(t.Events.LEVEL_UPDATED,n(this.#p.bind(this))),s.on(t.Events.NON_NATIVE_TEXT_TRACKS_FOUND,n(this.#c.bind(this,s))),s.on(t.Events.CUES_PARSED,n(this.#d.bind(this,s))),this.#t.qualities[L.enableAuto]=this.#g.bind(this),y(this.#t.qualities,"change",this.#L.bind(this)),y(this.#t.audioTracks,"change",this.#S.bind(this)),this.#n=E(this.#o.bind(this))}#s(t,i){return new d(A(t),{detail:i})}#o(){if(!this.#t.$state.live())return;let t=new D(this.#a.bind(this));return t.start(),t.stop.bind(t)}#a(){this.#t.$state.liveSyncPosition.set(this.#i?.liveSyncPosition??1/0)}#h(t,i){this.#t.player?.dispatch(this.#s(t,i))}#c(t,i,e){let o=this.#s(i,e),s=-1;for(let n=0;n<e.tracks.length;n++){let r=e.tracks[n],c=r.subtitleTrack??r.closedCaptions,a=new x({id:`hls-${r.kind}-${n}`,src:c?.url,label:r.label,language:c?.lang,kind:r.kind,default:r.default});a[g.readyState]=2,a[g.onModeChange]=()=>{this.#i===t&&(a.mode==="showing"?(t.subtitleTrack=n,s=n):s===n&&(t.subtitleTrack=-1,s=-1))},this.#t.textTracks.add(a,o)}}#d(t,i,e){let o=t.subtitleTrack,s=this.#t.textTracks.getById(`hls-${e.type}-${o}`);if(!s)return;let n=this.#s(i,e);for(let r of e.cues)r.positionAlign="auto",s.addCue(r,n)}#l(t,i){let e=this.#t.audioTracks[i.id];if(e){let o=this.#s(t,i);this.#t.audioTracks[u.select](e,!0,o)}}#u(t,i){let e=this.#t.qualities[i.level];if(e){let o=this.#s(t,i);this.#t.qualities[u.select](e,!0,o)}}#p(t,i){i.details.totalduration>0&&this.#t.$state.inferredLiveDVRWindow.set(i.details.totalduration)}#f(t,i,e){if(this.#t.$state.canPlay())return;let o=t.media;if(!o)return;let{type:s,live:n,totalduration:r,targetduration:c}=e.details,a=this.#s(i,e);this.#t.notify("stream-type-change",n?s==="EVENT"&&Number.isFinite(r)&&c>=10?"live:dvr":"live":"on-demand",a),this.#t.notify("duration-change",r,a),t.currentLevel===-1&&this.#t.qualities[L.setAuto](!0,a);for(let h of t.audioTracks){let f={id:h.id.toString(),label:h.name,language:h.lang||"",kind:"main"};this.#t.audioTracks[u.add](f,a)}for(let h of t.levels){let f={id:h.id?.toString()??h.height+"p",width:h.width,height:h.height,codec:h.codecSet,bitrate:h.bitrate};this.#t.qualities[u.add](f,a)}o.dispatchEvent(new d("canplay",{trigger:a}))}#v(t,i){i.fatal&&(i.type==="mediaError"?this.#i?.recoverMediaError():this.#y(i.error))}#y(t){this.#t.notify("error",{message:t.message,code:1,error:t})}#g(){this.#i&&(this.#i.currentLevel=-1)}#L(){let{qualities:t}=this.#t;!this.#i||t.auto||(this.#i[t.switch+"Level"]=t.selectedIndex,T&&(this.#e.currentTime=this.#e.currentTime))}#S(){let{audioTracks:t}=this.#t;this.#i&&this.#i.audioTrack!==t.selectedIndex&&(this.#i.audioTrack=t.selectedIndex)}onInstance(t){return this.#r.add(t),()=>this.#r.delete(t)}loadSource(t){l(t.src)&&this.#i?.loadSource(t.src)}destroy(){this.#i?.destroy(),this.#i=null,this.#n?.(),this.#n=null}},H=class{#e;#t;#i;constructor(t,i,e){this.#e=t,this.#t=i,this.#i=e,this.#n()}async#n(){let t={onLoadStart:this.#r.bind(this),onLoaded:this.#s.bind(this),onLoadError:this.#o.bind(this)},i=await R(this.#e,t);if(v(i)&&!l(this.#e)&&(i=await $(this.#e,t)),!i)return null;if(!i.isSupported()){let e="[vidstack] `hls.js` is not supported in this environment";return this.#t.player.dispatch(new d("hls-unsupported")),this.#t.notify("error",{message:e,code:4}),null}return i}#r(){this.#t.player.dispatch(new d("hls-lib-load-start"))}#s(t){this.#t.player.dispatch(new d("hls-lib-loaded",{detail:t})),this.#i(t)}#o(t){let i=I(t);this.#t.player.dispatch(new d("hls-lib-load-error",{detail:i})),this.#t.notify("error",{message:i.message,code:4,error:i})}};async function $(t,i={}){if(!v(t)){if(i.onLoadStart?.(),t.prototype&&t.prototype!==Function)return i.onLoaded?.(t),t;try{let e=(await t())?.default;if(e&&e.isSupported)i.onLoaded?.(e);else throw Error("");return e}catch(e){i.onLoadError?.(e)}}}async function R(t,i={}){if(l(t)){i.onLoadStart?.();try{if(await w(t),!S(window.Hls))throw Error("");let e=window.Hls;return i.onLoaded?.(e),e}catch(e){i.onLoadError?.(e)}}}var O="https://cdn.jsdelivr.net",V=class extends C{$$PROVIDER_TYPE="HLS";#e=null;#t=new _(this.video,this.ctx);get ctor(){return this.#e}get instance(){return this.#t.instance}static supported=k();get type(){return"hls"}get canLiveSync(){return!0}#i=`${O}/npm/hls.js@^1.5.0/dist/hls.min.js`;get config(){return this.#t.config}set config(t){this.#t.config=t}get library(){return this.#i}set library(t){this.#i=t}preconnect(){l(this.#i)&&m(this.#i)}setup(){super.setup(),new H(this.#i,this.ctx,t=>{this.#e=t,this.#t.setup(t),this.ctx.notify("provider-setup",this);let i=p(this.ctx.$state.source);i&&this.loadSource(i)})}async loadSource(t,i){if(!l(t.src)){this.removeSource();return}this.media.preload=i||"",this.appendSource(t,"application/x-mpegurl"),this.#t.loadSource(t),this.currentSrc=t}onInstance(t){let i=this.#t.instance;return i&&t(i),this.#t.onInstance(t)}destroy(){this.#t.destroy()}};export{V as HLSProvider};
|
|
2
|
+
//# sourceMappingURL=vidstack-DiaLSJYx-H762DXYG.js.map
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
IS_CHROME,
|
|
4
|
+
ListSymbol,
|
|
5
|
+
QualitySymbol,
|
|
6
|
+
RAFLoop,
|
|
7
|
+
TextTrack,
|
|
8
|
+
TextTrackSymbol,
|
|
9
|
+
VideoProvider,
|
|
10
|
+
coerceToError,
|
|
11
|
+
isHLSSupported,
|
|
12
|
+
loadScript,
|
|
13
|
+
preconnect
|
|
14
|
+
} from "./chunk-2UBPQBQI.js";
|
|
15
|
+
import {
|
|
16
|
+
DOMEvent,
|
|
17
|
+
camelToKebabCase,
|
|
18
|
+
effect,
|
|
19
|
+
isFunction,
|
|
20
|
+
isString,
|
|
21
|
+
isUndefined,
|
|
22
|
+
listenEvent,
|
|
23
|
+
peek
|
|
24
|
+
} from "./chunk-IUB5YLUU.js";
|
|
25
|
+
import "./chunk-G3PMV62Z.js";
|
|
26
|
+
|
|
27
|
+
// ../../node_modules/.pnpm/@vidstack+react@1.15.6_@types+react@19.2.8_react@19.2.1/node_modules/@vidstack/react/prod/chunks/vidstack-DiaLSJYx.js
|
|
28
|
+
var toDOMEventType = (type) => camelToKebabCase(type);
|
|
29
|
+
var HLSController = class {
|
|
30
|
+
#video;
|
|
31
|
+
#ctx;
|
|
32
|
+
#instance = null;
|
|
33
|
+
#stopLiveSync = null;
|
|
34
|
+
config = {};
|
|
35
|
+
#callbacks = /* @__PURE__ */ new Set();
|
|
36
|
+
get instance() {
|
|
37
|
+
return this.#instance;
|
|
38
|
+
}
|
|
39
|
+
constructor(video, ctx) {
|
|
40
|
+
this.#video = video;
|
|
41
|
+
this.#ctx = ctx;
|
|
42
|
+
}
|
|
43
|
+
setup(ctor) {
|
|
44
|
+
const { streamType } = this.#ctx.$state;
|
|
45
|
+
const isLive = peek(streamType).includes("live"), isLiveLowLatency = peek(streamType).includes("ll-");
|
|
46
|
+
const instance = this.#instance = new ctor({
|
|
47
|
+
lowLatencyMode: isLiveLowLatency,
|
|
48
|
+
backBufferLength: isLiveLowLatency ? 4 : isLive ? 8 : void 0,
|
|
49
|
+
renderTextTracksNatively: false,
|
|
50
|
+
...this.config
|
|
51
|
+
});
|
|
52
|
+
const guard = (callback) => (eventType, data) => {
|
|
53
|
+
if (this.#instance !== instance) return;
|
|
54
|
+
callback(eventType, data);
|
|
55
|
+
};
|
|
56
|
+
const dispatcher = guard(this.#dispatchHLSEvent.bind(this));
|
|
57
|
+
for (const event of Object.values(ctor.Events)) instance.on(event, dispatcher);
|
|
58
|
+
instance.on(ctor.Events.ERROR, guard(this.#onError.bind(this)));
|
|
59
|
+
for (const callback of this.#callbacks) callback(instance);
|
|
60
|
+
this.#ctx.player.dispatch("hls-instance", { detail: instance });
|
|
61
|
+
instance.attachMedia(this.#video);
|
|
62
|
+
instance.on(ctor.Events.AUDIO_TRACK_SWITCHED, guard(this.#onAudioSwitch.bind(this)));
|
|
63
|
+
instance.on(ctor.Events.LEVEL_SWITCHED, guard(this.#onLevelSwitched.bind(this)));
|
|
64
|
+
instance.on(ctor.Events.LEVEL_LOADED, guard(this.#onLevelLoaded.bind(this, instance)));
|
|
65
|
+
instance.on(ctor.Events.LEVEL_UPDATED, guard(this.#onLevelUpdated.bind(this)));
|
|
66
|
+
instance.on(ctor.Events.NON_NATIVE_TEXT_TRACKS_FOUND, guard(this.#onTracksFound.bind(this, instance)));
|
|
67
|
+
instance.on(ctor.Events.CUES_PARSED, guard(this.#onCuesParsed.bind(this, instance)));
|
|
68
|
+
this.#ctx.qualities[QualitySymbol.enableAuto] = this.#enableAutoQuality.bind(this);
|
|
69
|
+
listenEvent(this.#ctx.qualities, "change", this.#onUserQualityChange.bind(this));
|
|
70
|
+
listenEvent(this.#ctx.audioTracks, "change", this.#onUserAudioChange.bind(this));
|
|
71
|
+
this.#stopLiveSync = effect(this.#liveSync.bind(this));
|
|
72
|
+
}
|
|
73
|
+
#createDOMEvent(type, data) {
|
|
74
|
+
return new DOMEvent(toDOMEventType(type), { detail: data });
|
|
75
|
+
}
|
|
76
|
+
#liveSync() {
|
|
77
|
+
if (!this.#ctx.$state.live()) return;
|
|
78
|
+
const raf = new RAFLoop(this.#liveSyncPosition.bind(this));
|
|
79
|
+
raf.start();
|
|
80
|
+
return raf.stop.bind(raf);
|
|
81
|
+
}
|
|
82
|
+
#liveSyncPosition() {
|
|
83
|
+
this.#ctx.$state.liveSyncPosition.set(this.#instance?.liveSyncPosition ?? Infinity);
|
|
84
|
+
}
|
|
85
|
+
#dispatchHLSEvent(type, data) {
|
|
86
|
+
this.#ctx.player?.dispatch(this.#createDOMEvent(type, data));
|
|
87
|
+
}
|
|
88
|
+
#onTracksFound(instance, eventType, data) {
|
|
89
|
+
const event = this.#createDOMEvent(eventType, data);
|
|
90
|
+
let currentTrack = -1;
|
|
91
|
+
for (let i = 0; i < data.tracks.length; i++) {
|
|
92
|
+
const nonNativeTrack = data.tracks[i], init = nonNativeTrack.subtitleTrack ?? nonNativeTrack.closedCaptions, track = new TextTrack({
|
|
93
|
+
id: `hls-${nonNativeTrack.kind}-${i}`,
|
|
94
|
+
src: init?.url,
|
|
95
|
+
label: nonNativeTrack.label,
|
|
96
|
+
language: init?.lang,
|
|
97
|
+
kind: nonNativeTrack.kind,
|
|
98
|
+
default: nonNativeTrack.default
|
|
99
|
+
});
|
|
100
|
+
track[TextTrackSymbol.readyState] = 2;
|
|
101
|
+
track[TextTrackSymbol.onModeChange] = () => {
|
|
102
|
+
if (this.#instance !== instance) return;
|
|
103
|
+
if (track.mode === "showing") {
|
|
104
|
+
instance.subtitleTrack = i;
|
|
105
|
+
currentTrack = i;
|
|
106
|
+
} else if (currentTrack === i) {
|
|
107
|
+
instance.subtitleTrack = -1;
|
|
108
|
+
currentTrack = -1;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
this.#ctx.textTracks.add(track, event);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
#onCuesParsed(instance, eventType, data) {
|
|
115
|
+
const index = instance.subtitleTrack, track = this.#ctx.textTracks.getById(`hls-${data.type}-${index}`);
|
|
116
|
+
if (!track) return;
|
|
117
|
+
const event = this.#createDOMEvent(eventType, data);
|
|
118
|
+
for (const cue of data.cues) {
|
|
119
|
+
cue.positionAlign = "auto";
|
|
120
|
+
track.addCue(cue, event);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
#onAudioSwitch(eventType, data) {
|
|
124
|
+
const track = this.#ctx.audioTracks[data.id];
|
|
125
|
+
if (track) {
|
|
126
|
+
const trigger = this.#createDOMEvent(eventType, data);
|
|
127
|
+
this.#ctx.audioTracks[ListSymbol.select](track, true, trigger);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
#onLevelSwitched(eventType, data) {
|
|
131
|
+
const quality = this.#ctx.qualities[data.level];
|
|
132
|
+
if (quality) {
|
|
133
|
+
const trigger = this.#createDOMEvent(eventType, data);
|
|
134
|
+
this.#ctx.qualities[ListSymbol.select](quality, true, trigger);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
#onLevelUpdated(eventType, data) {
|
|
138
|
+
if (data.details.totalduration > 0) this.#ctx.$state.inferredLiveDVRWindow.set(data.details.totalduration);
|
|
139
|
+
}
|
|
140
|
+
#onLevelLoaded(instance, eventType, data) {
|
|
141
|
+
if (this.#ctx.$state.canPlay()) return;
|
|
142
|
+
const media = instance.media;
|
|
143
|
+
if (!media) return;
|
|
144
|
+
const { type, live, totalduration: duration, targetduration } = data.details, trigger = this.#createDOMEvent(eventType, data);
|
|
145
|
+
this.#ctx.notify("stream-type-change", live ? type === "EVENT" && Number.isFinite(duration) && targetduration >= 10 ? "live:dvr" : "live" : "on-demand", trigger);
|
|
146
|
+
this.#ctx.notify("duration-change", duration, trigger);
|
|
147
|
+
if (instance.currentLevel === -1) this.#ctx.qualities[QualitySymbol.setAuto](true, trigger);
|
|
148
|
+
for (const remoteTrack of instance.audioTracks) {
|
|
149
|
+
const localTrack = {
|
|
150
|
+
id: remoteTrack.id.toString(),
|
|
151
|
+
label: remoteTrack.name,
|
|
152
|
+
language: remoteTrack.lang || "",
|
|
153
|
+
kind: "main"
|
|
154
|
+
};
|
|
155
|
+
this.#ctx.audioTracks[ListSymbol.add](localTrack, trigger);
|
|
156
|
+
}
|
|
157
|
+
for (const level of instance.levels) {
|
|
158
|
+
const videoQuality = {
|
|
159
|
+
id: level.id?.toString() ?? level.height + "p",
|
|
160
|
+
width: level.width,
|
|
161
|
+
height: level.height,
|
|
162
|
+
codec: level.codecSet,
|
|
163
|
+
bitrate: level.bitrate
|
|
164
|
+
};
|
|
165
|
+
this.#ctx.qualities[ListSymbol.add](videoQuality, trigger);
|
|
166
|
+
}
|
|
167
|
+
media.dispatchEvent(new DOMEvent("canplay", { trigger }));
|
|
168
|
+
}
|
|
169
|
+
#onError(eventType, data) {
|
|
170
|
+
if (data.fatal) switch (data.type) {
|
|
171
|
+
case "mediaError":
|
|
172
|
+
this.#instance?.recoverMediaError();
|
|
173
|
+
break;
|
|
174
|
+
default:
|
|
175
|
+
this.#onFatalError(data.error);
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
#onFatalError(error) {
|
|
180
|
+
this.#ctx.notify("error", {
|
|
181
|
+
message: error.message,
|
|
182
|
+
code: 1,
|
|
183
|
+
error
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
#enableAutoQuality() {
|
|
187
|
+
if (this.#instance) this.#instance.currentLevel = -1;
|
|
188
|
+
}
|
|
189
|
+
#onUserQualityChange() {
|
|
190
|
+
const { qualities } = this.#ctx;
|
|
191
|
+
if (!this.#instance || qualities.auto) return;
|
|
192
|
+
this.#instance[qualities.switch + "Level"] = qualities.selectedIndex;
|
|
193
|
+
if (IS_CHROME) this.#video.currentTime = this.#video.currentTime;
|
|
194
|
+
}
|
|
195
|
+
#onUserAudioChange() {
|
|
196
|
+
const { audioTracks } = this.#ctx;
|
|
197
|
+
if (this.#instance && this.#instance.audioTrack !== audioTracks.selectedIndex) this.#instance.audioTrack = audioTracks.selectedIndex;
|
|
198
|
+
}
|
|
199
|
+
onInstance(callback) {
|
|
200
|
+
this.#callbacks.add(callback);
|
|
201
|
+
return () => this.#callbacks.delete(callback);
|
|
202
|
+
}
|
|
203
|
+
loadSource(src) {
|
|
204
|
+
if (!isString(src.src)) return;
|
|
205
|
+
this.#instance?.loadSource(src.src);
|
|
206
|
+
}
|
|
207
|
+
destroy() {
|
|
208
|
+
this.#instance?.destroy();
|
|
209
|
+
this.#instance = null;
|
|
210
|
+
this.#stopLiveSync?.();
|
|
211
|
+
this.#stopLiveSync = null;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var HLSLibLoader = class {
|
|
215
|
+
#lib;
|
|
216
|
+
#ctx;
|
|
217
|
+
#callback;
|
|
218
|
+
constructor(lib, ctx, callback) {
|
|
219
|
+
this.#lib = lib;
|
|
220
|
+
this.#ctx = ctx;
|
|
221
|
+
this.#callback = callback;
|
|
222
|
+
this.#startLoading();
|
|
223
|
+
}
|
|
224
|
+
async #startLoading() {
|
|
225
|
+
const callbacks = {
|
|
226
|
+
onLoadStart: this.#onLoadStart.bind(this),
|
|
227
|
+
onLoaded: this.#onLoaded.bind(this),
|
|
228
|
+
onLoadError: this.#onLoadError.bind(this)
|
|
229
|
+
};
|
|
230
|
+
let ctor = await loadHLSScript(this.#lib, callbacks);
|
|
231
|
+
if (isUndefined(ctor) && !isString(this.#lib)) ctor = await importHLS(this.#lib, callbacks);
|
|
232
|
+
if (!ctor) return null;
|
|
233
|
+
if (!ctor.isSupported()) {
|
|
234
|
+
const message = "[vidstack] `hls.js` is not supported in this environment";
|
|
235
|
+
this.#ctx.player.dispatch(new DOMEvent("hls-unsupported"));
|
|
236
|
+
this.#ctx.notify("error", {
|
|
237
|
+
message,
|
|
238
|
+
code: 4
|
|
239
|
+
});
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
return ctor;
|
|
243
|
+
}
|
|
244
|
+
#onLoadStart() {
|
|
245
|
+
this.#ctx.player.dispatch(new DOMEvent("hls-lib-load-start"));
|
|
246
|
+
}
|
|
247
|
+
#onLoaded(ctor) {
|
|
248
|
+
this.#ctx.player.dispatch(new DOMEvent("hls-lib-loaded", { detail: ctor }));
|
|
249
|
+
this.#callback(ctor);
|
|
250
|
+
}
|
|
251
|
+
#onLoadError(e) {
|
|
252
|
+
const error = coerceToError(e);
|
|
253
|
+
this.#ctx.player.dispatch(new DOMEvent("hls-lib-load-error", { detail: error }));
|
|
254
|
+
this.#ctx.notify("error", {
|
|
255
|
+
message: error.message,
|
|
256
|
+
code: 4,
|
|
257
|
+
error
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
async function importHLS(loader, callbacks = {}) {
|
|
262
|
+
if (isUndefined(loader)) return void 0;
|
|
263
|
+
callbacks.onLoadStart?.();
|
|
264
|
+
if (loader.prototype && loader.prototype !== Function) {
|
|
265
|
+
callbacks.onLoaded?.(loader);
|
|
266
|
+
return loader;
|
|
267
|
+
}
|
|
268
|
+
try {
|
|
269
|
+
const ctor = (await loader())?.default;
|
|
270
|
+
if (ctor && !!ctor.isSupported) callbacks.onLoaded?.(ctor);
|
|
271
|
+
else throw Error("");
|
|
272
|
+
return ctor;
|
|
273
|
+
} catch (err) {
|
|
274
|
+
callbacks.onLoadError?.(err);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
async function loadHLSScript(src, callbacks = {}) {
|
|
278
|
+
if (!isString(src)) return void 0;
|
|
279
|
+
callbacks.onLoadStart?.();
|
|
280
|
+
try {
|
|
281
|
+
await loadScript(src);
|
|
282
|
+
if (!isFunction(window.Hls)) throw Error("");
|
|
283
|
+
const ctor = window.Hls;
|
|
284
|
+
callbacks.onLoaded?.(ctor);
|
|
285
|
+
return ctor;
|
|
286
|
+
} catch (err) {
|
|
287
|
+
callbacks.onLoadError?.(err);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
var JS_DELIVR_CDN = "https://cdn.jsdelivr.net";
|
|
291
|
+
var HLSProvider = class extends VideoProvider {
|
|
292
|
+
$$PROVIDER_TYPE = "HLS";
|
|
293
|
+
#ctor = null;
|
|
294
|
+
#controller = new HLSController(this.video, this.ctx);
|
|
295
|
+
/**
|
|
296
|
+
* The `hls.js` constructor.
|
|
297
|
+
*/
|
|
298
|
+
get ctor() {
|
|
299
|
+
return this.#ctor;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* The current `hls.js` instance.
|
|
303
|
+
*/
|
|
304
|
+
get instance() {
|
|
305
|
+
return this.#controller.instance;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Whether `hls.js` is supported in this environment.
|
|
309
|
+
*/
|
|
310
|
+
static supported = isHLSSupported();
|
|
311
|
+
get type() {
|
|
312
|
+
return "hls";
|
|
313
|
+
}
|
|
314
|
+
get canLiveSync() {
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
#library = `${JS_DELIVR_CDN}/npm/hls.js@^1.5.0/dist/hls.min.js`;
|
|
318
|
+
/**
|
|
319
|
+
* The `hls.js` configuration object.
|
|
320
|
+
*
|
|
321
|
+
* @see {@link https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning}
|
|
322
|
+
*/
|
|
323
|
+
get config() {
|
|
324
|
+
return this.#controller.config;
|
|
325
|
+
}
|
|
326
|
+
set config(config) {
|
|
327
|
+
this.#controller.config = config;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* The `hls.js` constructor (supports dynamic imports) or a URL of where it can be found.
|
|
331
|
+
*
|
|
332
|
+
* @defaultValue `https://cdn.jsdelivr.net/npm/hls.js@^1.0.0/dist/hls.min.js`
|
|
333
|
+
*/
|
|
334
|
+
get library() {
|
|
335
|
+
return this.#library;
|
|
336
|
+
}
|
|
337
|
+
set library(library) {
|
|
338
|
+
this.#library = library;
|
|
339
|
+
}
|
|
340
|
+
preconnect() {
|
|
341
|
+
if (!isString(this.#library)) return;
|
|
342
|
+
preconnect(this.#library);
|
|
343
|
+
}
|
|
344
|
+
setup() {
|
|
345
|
+
super.setup();
|
|
346
|
+
new HLSLibLoader(this.#library, this.ctx, (ctor) => {
|
|
347
|
+
this.#ctor = ctor;
|
|
348
|
+
this.#controller.setup(ctor);
|
|
349
|
+
this.ctx.notify("provider-setup", this);
|
|
350
|
+
const src = peek(this.ctx.$state.source);
|
|
351
|
+
if (src) this.loadSource(src);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
async loadSource(src, preload) {
|
|
355
|
+
if (!isString(src.src)) {
|
|
356
|
+
this.removeSource();
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
this.media.preload = preload || "";
|
|
360
|
+
this.appendSource(src, "application/x-mpegurl");
|
|
361
|
+
this.#controller.loadSource(src);
|
|
362
|
+
this.currentSrc = src;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* The given callback is invoked when a new `hls.js` instance is created and right before it's
|
|
366
|
+
* attached to media.
|
|
367
|
+
*/
|
|
368
|
+
onInstance(callback) {
|
|
369
|
+
const instance = this.#controller.instance;
|
|
370
|
+
if (instance) callback(instance);
|
|
371
|
+
return this.#controller.onInstance(callback);
|
|
372
|
+
}
|
|
373
|
+
destroy() {
|
|
374
|
+
this.#controller.destroy();
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
export {
|
|
378
|
+
HLSProvider
|
|
379
|
+
};
|
|
380
|
+
//# sourceMappingURL=vidstack-DiaLSJYx-S7DDW2H3.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{a as T,b as g}from"./chunk-VH4656UY.js";import{a as P}from"./chunk-XAORGJWX.js";import{I as k,R as m,U as h,Y as f,Z as w,o}from"./chunk-FGBB7FT5.js";import{C as v,U as d,b as r,h as p,i as l,r as y,u as b,v as c}from"./chunk-BH27SBYG.js";import"./chunk-74RRJOB4.js";import"./chunk-RFBBAUMM.js";var $=["bufferend","bufferstart","durationchange","ended","enterpictureinpicture","error","fullscreenchange","leavepictureinpicture","loaded","playProgress","loadProgress","pause","play","playbackratechange","qualitychange","seeked","seeking","timeupdate","volumechange","waiting"],R=class extends P{$$PROVIDER_TYPE="VIMEO";scope=p();fullscreen;#e;#s=l("");#i=l(!1);#a=null;#c=null;#d=!1;#n=new o(0,0);#u=new w(this.#C.bind(this));#w=null;#h=null;#o=new Map;#l=null;constructor(e,t){super(e),this.#e=t;let s=this;this.fullscreen={get active(){return s.#d},supported:!0,enter:()=>this.#t("requestFullscreen"),exit:()=>this.#t("exitFullscreen")}}cookies=!1;title=!0;byline=!0;portrait=!0;color="00ADEF";get type(){return"vimeo"}get currentSrc(){return this.#c}get videoId(){return this.#s()}get hash(){return this.#a}get isPro(){return this.#i()}preconnect(){k(this.getOrigin())}setup(){super.setup(),c(this.#P.bind(this)),c(this.#T.bind(this)),c(this.#g.bind(this)),this.#e.notify("provider-setup",this)}destroy(){this.#k(),this.fullscreen=void 0;let e="provider destroyed";for(let t of this.#o.values())for(let{reject:s}of t)s(e);this.#o.clear(),this.#t("destroy")}async play(){return this.#t("play")}async pause(){return this.#t("pause")}setMuted(e){this.#t("setMuted",e)}setCurrentTime(e){this.#t("seekTo",e),this.#e.notify("seeking",e)}setVolume(e){this.#t("setVolume",e),this.#t("setMuted",r(this.#e.$state.muted))}setPlaybackRate(e){this.#t("setPlaybackRate",e)}async loadSource(e){if(!y(e.src)){this.#c=null,this.#a=null,this.#s.set("");return}let{videoId:t,hash:s}=T(e.src);this.#s.set(t??""),this.#a=s??null,this.#c=e}#P(){this.#k();let e=this.#s();if(!e){this.src.set("");return}this.src.set(`${this.getOrigin()}/video/${e}`),this.#e.notify("load-start")}#T(){let e=this.#s();if(!e)return;let t=d(),s=new AbortController;return this.#l=t,g(e,s,this.#a).then(i=>{t.resolve(i)}).catch(i=>{t.reject()}),()=>{t.reject(),s.abort()}}#g(){let e=this.#i(),{$state:t,qualities:s}=this.#e;if(t.canSetPlaybackRate.set(e),s[h.setReadonly](!e),e)return v(s,"change",()=>{if(s.auto)return;let i=s.selected?.id;i&&this.#t("setQuality",i)})}getOrigin(){return"https://player.vimeo.com"}buildParams(){let{keyDisabled:e}=this.#e.$props,{playsInline:t,nativeControls:s}=this.#e.$state,i=s();return{title:this.title,byline:this.byline,color:this.color,portrait:this.portrait,controls:i,h:this.hash,keyboard:i&&!e(),transparent:!0,playsinline:t(),dnt:!this.cookies}}#C(){this.#t("getCurrentTime")}#r=!1;#$(e,t){if(this.#r&&e===0)return;let{realCurrentTime:s,paused:i,bufferedEnd:n,seekableEnd:a,live:u}=this.#e.$state;if(s()===e)return;let C=s();this.#e.notify("time-change",e,t),Math.abs(C-e)>1.5&&(this.#e.notify("seeking",e,t),!i()&&n()<e&&this.#e.notify("waiting",void 0,t)),!u()&&a()-e<.01&&(this.#e.notify("end",void 0,t),this.#r=!0,setTimeout(()=>{this.#r=!1},500))}#V(e,t){this.#e.notify("seeked",e,t)}#E(e){let t=this.#s();this.#l?.promise.then(s=>{if(!s)return;let{title:i,poster:n,duration:a,pro:u}=s;this.#i.set(u),this.#e.notify("title-change",i,e),this.#e.notify("poster-change",n,e),this.#e.notify("duration-change",a,e),this.#f(a,e)}).catch(()=>{t===this.#s()&&(this.#t("getVideoTitle"),this.#t("getDuration"))})}#f(e,t){let{nativeControls:s}=this.#e.$state,i=s();this.#n=new o(0,e);let n={buffered:new o(0,0),seekable:this.#n,duration:e};this.#e.delegate.ready(n,t),i||this.#t("_hideOverlay"),this.#t("getQualities"),this.#t("getChapters")}#I(e,t,s){switch(e){case"getVideoTitle":let i=t;this.#e.notify("title-change",i,s);break;case"getDuration":let n=t;this.#e.$state.canPlay()?this.#e.notify("duration-change",n,s):this.#f(n,s);break;case"getCurrentTime":this.#$(t,s);break;case"getBuffered":b(t)&&t.length&&this.#p(t[t.length-1][1],s);break;case"setMuted":case"getMuted":this.#y(r(this.#e.$state.volume),t,s);break;case"getChapters":this.#L(t);break;case"getQualities":this.#F(t,s);break}this.#m(e)?.resolve()}#M(){for(let e of $)this.#t("addEventListener",e)}#R(e){this.#u.stop(),this.#e.notify("pause",void 0,e)}async#A(e){this.#u.start(),await this.#t("getMuted"),this.#e.notify("play",void 0,e)}#S(e){let{paused:t}=this.#e.$state;!t()&&!this.#r&&this.#e.notify("playing",void 0,e)}#p(e,t){let s={buffered:new o(0,e),seekable:this.#n};this.#e.notify("progress",s,t)}#q(e){this.#e.notify("waiting",void 0,e)}#x(e){let{paused:t}=this.#e.$state;t()||this.#e.notify("playing",void 0,e)}async#Q(e){let{paused:t}=this.#e.$state;t()&&(await this.#t("getMuted"),this.#e.notify("play",void 0,e)),this.#e.notify("waiting",void 0,e)}#y(e,t,s){let i={volume:e,muted:t};this.#e.notify("volume-change",i,s)}#L(e){if(this.#b(),!e.length)return;let t=new m({kind:"chapters",default:!0}),{seekableEnd:s}=this.#e.$state;for(let i=0;i<e.length;i++){let n=e[i],a=e[i+1];t.addCue(new window.VTTCue(n.startTime,a?.startTime??s(),n.title))}this.#h=t,this.#e.textTracks.add(t)}#b(){this.#h&&(this.#e.textTracks.remove(this.#h),this.#h=null)}#F(e,t){this.#e.qualities[f.enableAuto]=e.some(s=>s.id==="auto")?()=>this.#t("setQuality","auto"):void 0;for(let s of e){if(s.id==="auto")continue;let i=+s.id.slice(0,-1);isNaN(i)||this.#e.qualities[h.add]({id:s.id,width:i*(16/9),height:i,codec:"avc1,h.264",bitrate:-1},t)}this.#v(e.find(s=>s.active),t)}#v({id:e}={},t){if(!e)return;let s=e==="auto",i=this.#e.qualities.getById(e);s?(this.#e.qualities[f.setAuto](s,t),this.#e.qualities[h.select](void 0,!0,t)):this.#e.qualities[h.select](i??void 0,!0,t)}#O(e,t,s){switch(e){case"ready":this.#M();break;case"loaded":this.#E(s);break;case"play":this.#A(s);break;case"playProgress":this.#S(s);break;case"pause":this.#R(s);break;case"loadProgress":this.#p(t.seconds,s);break;case"waiting":this.#Q(s);break;case"bufferstart":this.#q(s);break;case"bufferend":this.#x(s);break;case"volumechange":this.#y(t.volume,r(this.#e.$state.muted),s);break;case"durationchange":this.#n=new o(0,t.duration),this.#e.notify("duration-change",t.duration,s);break;case"playbackratechange":this.#e.notify("rate-change",t.playbackRate,s);break;case"qualitychange":this.#v(t,s);break;case"fullscreenchange":this.#d=t.fullscreen,this.#e.notify("fullscreen-change",t.fullscreen,s);break;case"enterpictureinpicture":this.#e.notify("picture-in-picture-change",!0,s);break;case"leavepictureinpicture":this.#e.notify("picture-in-picture-change",!1,s);break;case"ended":this.#e.notify("end",void 0,s);break;case"error":this.#D(t,s);break;case"seek":case"seeked":this.#V(t.seconds,s);break}}#D(e,t){let{message:s,method:i}=e;i==="setPlaybackRate"&&this.#i.set(!1),i&&this.#m(i)?.reject(s)}onMessage(e,t){e.event?this.#O(e.event,e.data,t):e.method&&this.#I(e.method,e.value,t)}onLoad(){}async#t(e,t){let s=d(),i=this.#o.get(e);return i||this.#o.set(e,i=[]),i.push(s),this.postMessage({method:e,value:t}),s.promise}#k(){this.#u.stop(),this.#n=new o(0,0),this.#l=null,this.#w=null,this.#i.set(!1),this.#b()}#m(e){return this.#o.get(e)?.shift()}};export{R as VimeoProvider};
|
|
2
|
+
//# sourceMappingURL=vidstack-GkTzay8D-C7EJKMV4.js.map
|