@ix_waterford/lib 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.html +1 -1
- package/dist/index.js +121113 -5092
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/async/reactPlayerDash.js +0 -350
- package/dist/async/reactPlayerDash.js.map +0 -1
- package/dist/async/reactPlayerHls.js +0 -429
- package/dist/async/reactPlayerHls.js.map +0 -1
- package/dist/async/reactPlayerMux.js +0 -16075
- package/dist/async/reactPlayerMux.js.map +0 -1
- package/dist/async/reactPlayerPreview.js +0 -111
- package/dist/async/reactPlayerPreview.js.map +0 -1
- package/dist/async/reactPlayerSpotify.js +0 -518
- package/dist/async/reactPlayerSpotify.js.map +0 -1
- package/dist/async/reactPlayerTiktok.js +0 -488
- package/dist/async/reactPlayerTiktok.js.map +0 -1
- package/dist/async/reactPlayerTwitch.js +0 -586
- package/dist/async/reactPlayerTwitch.js.map +0 -1
- package/dist/async/reactPlayerVimeo.js +0 -4264
- package/dist/async/reactPlayerVimeo.js.map +0 -1
- package/dist/async/reactPlayerWistia.js +0 -767
- package/dist/async/reactPlayerWistia.js.map +0 -1
- package/dist/async/reactPlayerYouTube.js +0 -738
- package/dist/async/reactPlayerYouTube.js.map +0 -1
- package/dist/async/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js +0 -1253
- package/dist/async/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js.map +0 -1
- package/dist/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js +0 -21
- package/dist/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js.map +0 -1
- package/dist/async/vendors-node_modules_hls_js_dist_hls_mjs.js +0 -36691
- package/dist/async/vendors-node_modules_hls_js_dist_hls_mjs.js.map +0 -1
- package/dist/lib-react.js +0 -1462
- package/dist/lib-react.js.map +0 -1
- package/dist/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-5eb95d.js +0 -53062
- package/dist/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-5eb95d.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
(self["webpackChunk_ix_waterford_lib"] = self["webpackChunk_ix_waterford_lib"] || []).push([["reactPlayerDash"], {
|
|
2
|
-
"./node_modules/dash-video-element/dist/dash-video-element.js": (function (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
3
|
-
__webpack_require__.r(__webpack_exports__);
|
|
4
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
-
"default": () => (dash_video_element_default)
|
|
6
|
-
});
|
|
7
|
-
/* import */var custom_media_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/custom-media-element/dist/custom-media-element.js");
|
|
8
|
-
/* import */var media_tracks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/media-tracks/dist/index.js");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class DashVideoElement extends (0,media_tracks__WEBPACK_IMPORTED_MODULE_1__.MediaTracksMixin)(custom_media_element__WEBPACK_IMPORTED_MODULE_0__.CustomVideoElement) {
|
|
12
|
-
static shadowRootOptions = { ...custom_media_element__WEBPACK_IMPORTED_MODULE_0__.CustomVideoElement.shadowRootOptions };
|
|
13
|
-
static getTemplateHTML = (attrs) => {
|
|
14
|
-
const { src, ...rest } = attrs;
|
|
15
|
-
return custom_media_element__WEBPACK_IMPORTED_MODULE_0__.CustomVideoElement.getTemplateHTML(rest);
|
|
16
|
-
};
|
|
17
|
-
#apiInit;
|
|
18
|
-
attributeChangedCallback(attrName, oldValue, newValue) {
|
|
19
|
-
if (attrName !== "src") {
|
|
20
|
-
super.attributeChangedCallback(attrName, oldValue, newValue);
|
|
21
|
-
}
|
|
22
|
-
if (attrName === "src" && oldValue != newValue) {
|
|
23
|
-
this.load();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async _initThumbnails(representation) {
|
|
27
|
-
const generateAllCues = async (totalThumbnails2, thumbnailDuration2) => {
|
|
28
|
-
const promises = [];
|
|
29
|
-
const timescale = representation.timescale || 1;
|
|
30
|
-
const startNumber = representation.startNumber || 1;
|
|
31
|
-
const pto = representation.presentationTimeOffset ? representation.presentationTimeOffset / timescale : 0;
|
|
32
|
-
const tduration = representation.segmentDuration;
|
|
33
|
-
for (let thIndex = 0; thIndex < totalThumbnails2; thIndex++) {
|
|
34
|
-
const startTime = calculateThumbnailStartTime({
|
|
35
|
-
thIndex,
|
|
36
|
-
thduration: thumbnailDuration2,
|
|
37
|
-
ttiles: totalThumbnails2,
|
|
38
|
-
tduration,
|
|
39
|
-
startNumber,
|
|
40
|
-
pto
|
|
41
|
-
});
|
|
42
|
-
const endTime = startTime + thumbnailDuration2;
|
|
43
|
-
const promise = new Promise((resolve, reject) => {
|
|
44
|
-
this.api.provideThumbnail(startTime, ({ url, width, height, x, y }) => {
|
|
45
|
-
try {
|
|
46
|
-
const cue = new VTTCue(
|
|
47
|
-
startTime,
|
|
48
|
-
endTime,
|
|
49
|
-
`${url}#xywh=${x},${y},${width},${height}`
|
|
50
|
-
);
|
|
51
|
-
resolve(cue);
|
|
52
|
-
} catch (err) {
|
|
53
|
-
reject(err);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
promises.push(promise);
|
|
58
|
-
}
|
|
59
|
-
return await Promise.all(promises).catch((e) => console.error("Error processing thumbnails", e));
|
|
60
|
-
};
|
|
61
|
-
const { totalThumbnails, thumbnailDuration } = calculateThumbnailTimes(representation);
|
|
62
|
-
const cues = await generateAllCues(totalThumbnails, thumbnailDuration);
|
|
63
|
-
let track = this.nativeEl.querySelector('track[label="thumbnails"]');
|
|
64
|
-
if (!track) {
|
|
65
|
-
track = createThumbnailTrack();
|
|
66
|
-
this.nativeEl.appendChild(track);
|
|
67
|
-
const vttUrl = cuesToVttBlobUrl(cues);
|
|
68
|
-
track.src = vttUrl;
|
|
69
|
-
track.dispatchEvent(new Event("change"));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async load() {
|
|
73
|
-
if (this.#apiInit) {
|
|
74
|
-
this.api.attachSource(this.src);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
this.#apiInit = true;
|
|
78
|
-
const Dash = await __webpack_require__.e(/* import() */ "vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js").then(__webpack_require__.bind(__webpack_require__, "./node_modules/dashjs/dist/modern/esm/dash.all.min.js"));
|
|
79
|
-
this.api = Dash.MediaPlayer().create();
|
|
80
|
-
this.api.initialize(this.nativeEl, this.src, this.autoplay);
|
|
81
|
-
this.api.on(Dash.MediaPlayer.events.STREAM_INITIALIZED, () => {
|
|
82
|
-
const bitrateList = this.api.getRepresentationsByType("video");
|
|
83
|
-
let videoTrack = this.videoTracks.getTrackById("main");
|
|
84
|
-
if (!videoTrack) {
|
|
85
|
-
videoTrack = this.addVideoTrack("main");
|
|
86
|
-
videoTrack.id = "main";
|
|
87
|
-
videoTrack.selected = true;
|
|
88
|
-
}
|
|
89
|
-
bitrateList.forEach((rep) => {
|
|
90
|
-
const bitrate = rep.bandwidth ?? rep.bitrate ?? (Number.isFinite(rep.bitrateInKbit) ? rep.bitrateInKbit * 1e3 : void 0);
|
|
91
|
-
const rendition = videoTrack.addRendition(rep.id, rep.width, rep.height, rep.mimeType ?? rep.codec, bitrate);
|
|
92
|
-
rendition.id = rep.id;
|
|
93
|
-
});
|
|
94
|
-
this.videoRenditions.addEventListener("change", () => {
|
|
95
|
-
const selected = this.videoRenditions[this.videoRenditions.selectedIndex];
|
|
96
|
-
if (selected == null ? void 0 : selected.id) {
|
|
97
|
-
this.api.updateSettings({ streaming: { abr: { autoSwitchBitrate: { video: false } } } });
|
|
98
|
-
this.api.setRepresentationForTypeById("video", selected.id, true);
|
|
99
|
-
} else {
|
|
100
|
-
this.api.updateSettings({ streaming: { abr: { autoSwitchBitrate: { video: true } } } });
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
if (!this.api.isDynamic()) {
|
|
104
|
-
const imageReps = this.api.getRepresentationsByType("image");
|
|
105
|
-
imageReps.forEach(async (rep, idx) => {
|
|
106
|
-
if (idx > 0) return;
|
|
107
|
-
this._initThumbnails(rep);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function calculateThumbnailTimes(representation) {
|
|
114
|
-
var _a, _b;
|
|
115
|
-
const essentialProp = representation.essentialProperties[0];
|
|
116
|
-
const [htiles, vtiles] = essentialProp.value.split("x").map(Number);
|
|
117
|
-
const ttiles = htiles * vtiles;
|
|
118
|
-
const periodDuration = ((_b = (_a = representation.adaptation) == null ? void 0 : _a.period) == null ? void 0 : _b.duration) || null;
|
|
119
|
-
const tileDuration = representation.segmentDuration;
|
|
120
|
-
const timescale = representation.timescale || 1;
|
|
121
|
-
const tduration = tileDuration / timescale;
|
|
122
|
-
const thduration = tduration / ttiles;
|
|
123
|
-
const totalThumbnails = periodDuration != null ? Math.ceil(periodDuration / thduration) : Math.ceil(tileDuration / thduration);
|
|
124
|
-
return { totalThumbnails, thumbnailDuration: thduration };
|
|
125
|
-
}
|
|
126
|
-
function calculateThumbnailStartTime({ thIndex, tduration, thduration, ttiles, startNumber, pto }) {
|
|
127
|
-
const tnumber = Math.floor(thIndex / ttiles) + startNumber;
|
|
128
|
-
const thnumber = thIndex % ttiles + 1;
|
|
129
|
-
const tileStartTime = (tnumber - 1) * tduration - pto;
|
|
130
|
-
const thumbnailStartTime = (thnumber - 1) * thduration;
|
|
131
|
-
return tileStartTime + thumbnailStartTime;
|
|
132
|
-
}
|
|
133
|
-
function createThumbnailTrack() {
|
|
134
|
-
const track = document.createElement("track");
|
|
135
|
-
track.kind = "metadata";
|
|
136
|
-
track.label = "thumbnails";
|
|
137
|
-
track.srclang = "en";
|
|
138
|
-
track.mode = "hidden";
|
|
139
|
-
track.default = true;
|
|
140
|
-
return track;
|
|
141
|
-
}
|
|
142
|
-
function cuesToVttBlobUrl(cues) {
|
|
143
|
-
let vtt = "WEBVTT\n\n";
|
|
144
|
-
for (const cue of cues) {
|
|
145
|
-
vtt += `${formatTime(cue.startTime)} --> ${formatTime(cue.endTime)}
|
|
146
|
-
`;
|
|
147
|
-
vtt += `${cue.text}
|
|
148
|
-
|
|
149
|
-
`;
|
|
150
|
-
}
|
|
151
|
-
const blob = new Blob([vtt], { type: "text/vtt" });
|
|
152
|
-
return URL.createObjectURL(blob);
|
|
153
|
-
function formatTime(t) {
|
|
154
|
-
const h = String(Math.floor(t / 3600)).padStart(2, "0");
|
|
155
|
-
const m = String(Math.floor(t % 3600 / 60)).padStart(2, "0");
|
|
156
|
-
const s = (t % 60).toFixed(3).padStart(6, "0");
|
|
157
|
-
return `${h}:${m}:${s}`;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (globalThis.customElements && !globalThis.customElements.get("dash-video")) {
|
|
161
|
-
globalThis.customElements.define("dash-video", DashVideoElement);
|
|
162
|
-
}
|
|
163
|
-
var dash_video_element_default = DashVideoElement;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}),
|
|
168
|
-
"./node_modules/dash-video-element/dist/react.js": (function (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
169
|
-
__webpack_require__.r(__webpack_exports__);
|
|
170
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
171
|
-
"default": () => (react_default)
|
|
172
|
-
});
|
|
173
|
-
/* import */var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react");
|
|
174
|
-
/* import */var _dash_video_element_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/dash-video-element/dist/dash-video-element.js");
|
|
175
|
-
"use client";
|
|
176
|
-
|
|
177
|
-
// dist/react.ts
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
// ../../node_modules/ce-la-react/dist/ce-la-react.js
|
|
182
|
-
var reservedReactProps = /* @__PURE__ */ new Set([
|
|
183
|
-
"style",
|
|
184
|
-
"children",
|
|
185
|
-
"ref",
|
|
186
|
-
"key",
|
|
187
|
-
"suppressContentEditableWarning",
|
|
188
|
-
"suppressHydrationWarning",
|
|
189
|
-
"dangerouslySetInnerHTML"
|
|
190
|
-
]);
|
|
191
|
-
var reactPropToAttrNameMap = {
|
|
192
|
-
className: "class",
|
|
193
|
-
htmlFor: "for"
|
|
194
|
-
};
|
|
195
|
-
function defaultToAttributeName(propName) {
|
|
196
|
-
return propName.toLowerCase();
|
|
197
|
-
}
|
|
198
|
-
function defaultToAttributeValue(propValue) {
|
|
199
|
-
if (typeof propValue === "boolean") return propValue ? "" : void 0;
|
|
200
|
-
if (typeof propValue === "function") return void 0;
|
|
201
|
-
if (typeof propValue === "object" && propValue !== null) return void 0;
|
|
202
|
-
return propValue;
|
|
203
|
-
}
|
|
204
|
-
function createComponent({
|
|
205
|
-
react: React2,
|
|
206
|
-
tagName,
|
|
207
|
-
elementClass,
|
|
208
|
-
events,
|
|
209
|
-
displayName,
|
|
210
|
-
defaultProps,
|
|
211
|
-
toAttributeName = defaultToAttributeName,
|
|
212
|
-
toAttributeValue = defaultToAttributeValue
|
|
213
|
-
}) {
|
|
214
|
-
const IS_REACT_19_OR_NEWER = Number.parseInt(React2.version) >= 19;
|
|
215
|
-
const ReactComponent = React2.forwardRef((props, ref) => {
|
|
216
|
-
var _a, _b;
|
|
217
|
-
const elementRef = React2.useRef(null);
|
|
218
|
-
const prevElemPropsRef = React2.useRef(/* @__PURE__ */ new Map());
|
|
219
|
-
const eventProps = {};
|
|
220
|
-
const attrs = {};
|
|
221
|
-
const reactProps = {};
|
|
222
|
-
const elementProps = {};
|
|
223
|
-
for (const [k, v] of Object.entries(props)) {
|
|
224
|
-
if (reservedReactProps.has(k)) {
|
|
225
|
-
reactProps[k] = v;
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
const attrName = toAttributeName(reactPropToAttrNameMap[k] ?? k);
|
|
229
|
-
if (elementClass.prototype && k in elementClass.prototype && !(k in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) && !((_b = elementClass.observedAttributes) == null ? void 0 : _b.some((attr) => attr === attrName))) {
|
|
230
|
-
elementProps[k] = v;
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
|
-
if (k.startsWith("on")) {
|
|
234
|
-
eventProps[k] = v;
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
const attrValue = toAttributeValue(v);
|
|
238
|
-
if (attrName && attrValue != null) {
|
|
239
|
-
attrs[attrName] = String(attrValue);
|
|
240
|
-
if (!IS_REACT_19_OR_NEWER) {
|
|
241
|
-
reactProps[attrName] = attrValue;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
if (attrName && IS_REACT_19_OR_NEWER) {
|
|
245
|
-
const attrValueFromDefault = defaultToAttributeValue(v);
|
|
246
|
-
if (attrValue !== attrValueFromDefault) {
|
|
247
|
-
reactProps[attrName] = attrValue;
|
|
248
|
-
} else {
|
|
249
|
-
reactProps[attrName] = v;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
if (typeof window !== "undefined") {
|
|
254
|
-
for (const propName in eventProps) {
|
|
255
|
-
const callback = eventProps[propName];
|
|
256
|
-
const useCapture = propName.endsWith("Capture");
|
|
257
|
-
const eventName = ((events == null ? void 0 : events[propName]) ?? propName.slice(2).toLowerCase()).slice(
|
|
258
|
-
0,
|
|
259
|
-
useCapture ? -7 : void 0
|
|
260
|
-
);
|
|
261
|
-
React2.useLayoutEffect(() => {
|
|
262
|
-
const eventTarget = elementRef == null ? void 0 : elementRef.current;
|
|
263
|
-
if (!eventTarget || typeof callback !== "function") return;
|
|
264
|
-
eventTarget.addEventListener(eventName, callback, useCapture);
|
|
265
|
-
return () => {
|
|
266
|
-
eventTarget.removeEventListener(eventName, callback, useCapture);
|
|
267
|
-
};
|
|
268
|
-
}, [elementRef == null ? void 0 : elementRef.current, callback]);
|
|
269
|
-
}
|
|
270
|
-
React2.useLayoutEffect(() => {
|
|
271
|
-
if (elementRef.current === null) return;
|
|
272
|
-
const newElemProps = /* @__PURE__ */ new Map();
|
|
273
|
-
for (const key in elementProps) {
|
|
274
|
-
setProperty(elementRef.current, key, elementProps[key]);
|
|
275
|
-
prevElemPropsRef.current.delete(key);
|
|
276
|
-
newElemProps.set(key, elementProps[key]);
|
|
277
|
-
}
|
|
278
|
-
for (const [key, _value] of prevElemPropsRef.current) {
|
|
279
|
-
setProperty(elementRef.current, key, void 0);
|
|
280
|
-
}
|
|
281
|
-
prevElemPropsRef.current = newElemProps;
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
if (typeof window === "undefined" && (elementClass == null ? void 0 : elementClass.getTemplateHTML) && (elementClass == null ? void 0 : elementClass.shadowRootOptions)) {
|
|
285
|
-
const { mode, delegatesFocus } = elementClass.shadowRootOptions;
|
|
286
|
-
const templateShadowRoot = React2.createElement("template", {
|
|
287
|
-
shadowrootmode: mode,
|
|
288
|
-
shadowrootdelegatesfocus: delegatesFocus,
|
|
289
|
-
dangerouslySetInnerHTML: {
|
|
290
|
-
__html: elementClass.getTemplateHTML(attrs, props)
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
reactProps.children = [templateShadowRoot, reactProps.children];
|
|
294
|
-
}
|
|
295
|
-
return React2.createElement(tagName, {
|
|
296
|
-
...defaultProps,
|
|
297
|
-
...reactProps,
|
|
298
|
-
ref: React2.useCallback(
|
|
299
|
-
(node) => {
|
|
300
|
-
elementRef.current = node;
|
|
301
|
-
if (typeof ref === "function") {
|
|
302
|
-
ref(node);
|
|
303
|
-
} else if (ref !== null) {
|
|
304
|
-
ref.current = node;
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
[ref]
|
|
308
|
-
)
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
ReactComponent.displayName = displayName ?? elementClass.name;
|
|
312
|
-
return ReactComponent;
|
|
313
|
-
}
|
|
314
|
-
function setProperty(node, name, value) {
|
|
315
|
-
var _a;
|
|
316
|
-
node[name] = value;
|
|
317
|
-
if (value == null && name in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) {
|
|
318
|
-
node.removeAttribute(name);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// dist/react.ts
|
|
323
|
-
var react_default = createComponent({
|
|
324
|
-
react: react__WEBPACK_IMPORTED_MODULE_0__["default"],
|
|
325
|
-
tagName: "dash-video",
|
|
326
|
-
elementClass: _dash_video_element_js__WEBPACK_IMPORTED_MODULE_1__["default"],
|
|
327
|
-
toAttributeName(propName) {
|
|
328
|
-
if (propName === "muted") return "";
|
|
329
|
-
if (propName === "defaultMuted") return "muted";
|
|
330
|
-
return defaultToAttributeName(propName);
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
/*! Bundled license information:
|
|
335
|
-
|
|
336
|
-
ce-la-react/dist/ce-la-react.js:
|
|
337
|
-
(**
|
|
338
|
-
* @license
|
|
339
|
-
* Copyright 2018 Google LLC
|
|
340
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
341
|
-
*
|
|
342
|
-
* Modified version of `@lit/react` for vanilla custom elements with support for SSR.
|
|
343
|
-
*)
|
|
344
|
-
*/
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}),
|
|
348
|
-
|
|
349
|
-
}])
|
|
350
|
-
//# sourceMappingURL=reactPlayerDash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async/reactPlayerDash.js","sources":["/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/dash-video-element/dist/dash-video-element.js","/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/dash-video-element/dist/react.js"],"sourcesContent":["import { CustomVideoElement } from \"custom-media-element\";\nimport { MediaTracksMixin } from \"media-tracks\";\nclass DashVideoElement extends MediaTracksMixin(CustomVideoElement) {\n static shadowRootOptions = { ...CustomVideoElement.shadowRootOptions };\n static getTemplateHTML = (attrs) => {\n const { src, ...rest } = attrs;\n return CustomVideoElement.getTemplateHTML(rest);\n };\n #apiInit;\n attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName !== \"src\") {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n }\n if (attrName === \"src\" && oldValue != newValue) {\n this.load();\n }\n }\n async _initThumbnails(representation) {\n const generateAllCues = async (totalThumbnails2, thumbnailDuration2) => {\n const promises = [];\n const timescale = representation.timescale || 1;\n const startNumber = representation.startNumber || 1;\n const pto = representation.presentationTimeOffset ? representation.presentationTimeOffset / timescale : 0;\n const tduration = representation.segmentDuration;\n for (let thIndex = 0; thIndex < totalThumbnails2; thIndex++) {\n const startTime = calculateThumbnailStartTime({\n thIndex,\n thduration: thumbnailDuration2,\n ttiles: totalThumbnails2,\n tduration,\n startNumber,\n pto\n });\n const endTime = startTime + thumbnailDuration2;\n const promise = new Promise((resolve, reject) => {\n this.api.provideThumbnail(startTime, ({ url, width, height, x, y }) => {\n try {\n const cue = new VTTCue(\n startTime,\n endTime,\n `${url}#xywh=${x},${y},${width},${height}`\n );\n resolve(cue);\n } catch (err) {\n reject(err);\n }\n });\n });\n promises.push(promise);\n }\n return await Promise.all(promises).catch((e) => console.error(\"Error processing thumbnails\", e));\n };\n const { totalThumbnails, thumbnailDuration } = calculateThumbnailTimes(representation);\n const cues = await generateAllCues(totalThumbnails, thumbnailDuration);\n let track = this.nativeEl.querySelector('track[label=\"thumbnails\"]');\n if (!track) {\n track = createThumbnailTrack();\n this.nativeEl.appendChild(track);\n const vttUrl = cuesToVttBlobUrl(cues);\n track.src = vttUrl;\n track.dispatchEvent(new Event(\"change\"));\n }\n }\n async load() {\n if (this.#apiInit) {\n this.api.attachSource(this.src);\n return;\n }\n this.#apiInit = true;\n const Dash = await import(\"dashjs\");\n this.api = Dash.MediaPlayer().create();\n this.api.initialize(this.nativeEl, this.src, this.autoplay);\n this.api.on(Dash.MediaPlayer.events.STREAM_INITIALIZED, () => {\n const bitrateList = this.api.getRepresentationsByType(\"video\");\n let videoTrack = this.videoTracks.getTrackById(\"main\");\n if (!videoTrack) {\n videoTrack = this.addVideoTrack(\"main\");\n videoTrack.id = \"main\";\n videoTrack.selected = true;\n }\n bitrateList.forEach((rep) => {\n const bitrate = rep.bandwidth ?? rep.bitrate ?? (Number.isFinite(rep.bitrateInKbit) ? rep.bitrateInKbit * 1e3 : void 0);\n const rendition = videoTrack.addRendition(rep.id, rep.width, rep.height, rep.mimeType ?? rep.codec, bitrate);\n rendition.id = rep.id;\n });\n this.videoRenditions.addEventListener(\"change\", () => {\n const selected = this.videoRenditions[this.videoRenditions.selectedIndex];\n if (selected == null ? void 0 : selected.id) {\n this.api.updateSettings({ streaming: { abr: { autoSwitchBitrate: { video: false } } } });\n this.api.setRepresentationForTypeById(\"video\", selected.id, true);\n } else {\n this.api.updateSettings({ streaming: { abr: { autoSwitchBitrate: { video: true } } } });\n }\n });\n if (!this.api.isDynamic()) {\n const imageReps = this.api.getRepresentationsByType(\"image\");\n imageReps.forEach(async (rep, idx) => {\n if (idx > 0) return;\n this._initThumbnails(rep);\n });\n }\n });\n }\n}\nfunction calculateThumbnailTimes(representation) {\n var _a, _b;\n const essentialProp = representation.essentialProperties[0];\n const [htiles, vtiles] = essentialProp.value.split(\"x\").map(Number);\n const ttiles = htiles * vtiles;\n const periodDuration = ((_b = (_a = representation.adaptation) == null ? void 0 : _a.period) == null ? void 0 : _b.duration) || null;\n const tileDuration = representation.segmentDuration;\n const timescale = representation.timescale || 1;\n const tduration = tileDuration / timescale;\n const thduration = tduration / ttiles;\n const totalThumbnails = periodDuration != null ? Math.ceil(periodDuration / thduration) : Math.ceil(tileDuration / thduration);\n return { totalThumbnails, thumbnailDuration: thduration };\n}\nfunction calculateThumbnailStartTime({ thIndex, tduration, thduration, ttiles, startNumber, pto }) {\n const tnumber = Math.floor(thIndex / ttiles) + startNumber;\n const thnumber = thIndex % ttiles + 1;\n const tileStartTime = (tnumber - 1) * tduration - pto;\n const thumbnailStartTime = (thnumber - 1) * thduration;\n return tileStartTime + thumbnailStartTime;\n}\nfunction createThumbnailTrack() {\n const track = document.createElement(\"track\");\n track.kind = \"metadata\";\n track.label = \"thumbnails\";\n track.srclang = \"en\";\n track.mode = \"hidden\";\n track.default = true;\n return track;\n}\nfunction cuesToVttBlobUrl(cues) {\n let vtt = \"WEBVTT\\n\\n\";\n for (const cue of cues) {\n vtt += `${formatTime(cue.startTime)} --> ${formatTime(cue.endTime)}\n`;\n vtt += `${cue.text}\n\n`;\n }\n const blob = new Blob([vtt], { type: \"text/vtt\" });\n return URL.createObjectURL(blob);\n function formatTime(t) {\n const h = String(Math.floor(t / 3600)).padStart(2, \"0\");\n const m = String(Math.floor(t % 3600 / 60)).padStart(2, \"0\");\n const s = (t % 60).toFixed(3).padStart(6, \"0\");\n return `${h}:${m}:${s}`;\n }\n}\nif (globalThis.customElements && !globalThis.customElements.get(\"dash-video\")) {\n globalThis.customElements.define(\"dash-video\", DashVideoElement);\n}\nvar dash_video_element_default = DashVideoElement;\nexport {\n dash_video_element_default as default\n};\n","\"use client\";\n\n// dist/react.ts\nimport React from \"react\";\nimport CustomMediaElement from \"./dash-video-element.js\";\n\n// ../../node_modules/ce-la-react/dist/ce-la-react.js\nvar reservedReactProps = /* @__PURE__ */ new Set([\n \"style\",\n \"children\",\n \"ref\",\n \"key\",\n \"suppressContentEditableWarning\",\n \"suppressHydrationWarning\",\n \"dangerouslySetInnerHTML\"\n]);\nvar reactPropToAttrNameMap = {\n className: \"class\",\n htmlFor: \"for\"\n};\nfunction defaultToAttributeName(propName) {\n return propName.toLowerCase();\n}\nfunction defaultToAttributeValue(propValue) {\n if (typeof propValue === \"boolean\") return propValue ? \"\" : void 0;\n if (typeof propValue === \"function\") return void 0;\n if (typeof propValue === \"object\" && propValue !== null) return void 0;\n return propValue;\n}\nfunction createComponent({\n react: React2,\n tagName,\n elementClass,\n events,\n displayName,\n defaultProps,\n toAttributeName = defaultToAttributeName,\n toAttributeValue = defaultToAttributeValue\n}) {\n const IS_REACT_19_OR_NEWER = Number.parseInt(React2.version) >= 19;\n const ReactComponent = React2.forwardRef((props, ref) => {\n var _a, _b;\n const elementRef = React2.useRef(null);\n const prevElemPropsRef = React2.useRef(/* @__PURE__ */ new Map());\n const eventProps = {};\n const attrs = {};\n const reactProps = {};\n const elementProps = {};\n for (const [k, v] of Object.entries(props)) {\n if (reservedReactProps.has(k)) {\n reactProps[k] = v;\n continue;\n }\n const attrName = toAttributeName(reactPropToAttrNameMap[k] ?? k);\n if (elementClass.prototype && k in elementClass.prototype && !(k in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) && !((_b = elementClass.observedAttributes) == null ? void 0 : _b.some((attr) => attr === attrName))) {\n elementProps[k] = v;\n continue;\n }\n if (k.startsWith(\"on\")) {\n eventProps[k] = v;\n continue;\n }\n const attrValue = toAttributeValue(v);\n if (attrName && attrValue != null) {\n attrs[attrName] = String(attrValue);\n if (!IS_REACT_19_OR_NEWER) {\n reactProps[attrName] = attrValue;\n }\n }\n if (attrName && IS_REACT_19_OR_NEWER) {\n const attrValueFromDefault = defaultToAttributeValue(v);\n if (attrValue !== attrValueFromDefault) {\n reactProps[attrName] = attrValue;\n } else {\n reactProps[attrName] = v;\n }\n }\n }\n if (typeof window !== \"undefined\") {\n for (const propName in eventProps) {\n const callback = eventProps[propName];\n const useCapture = propName.endsWith(\"Capture\");\n const eventName = ((events == null ? void 0 : events[propName]) ?? propName.slice(2).toLowerCase()).slice(\n 0,\n useCapture ? -7 : void 0\n );\n React2.useLayoutEffect(() => {\n const eventTarget = elementRef == null ? void 0 : elementRef.current;\n if (!eventTarget || typeof callback !== \"function\") return;\n eventTarget.addEventListener(eventName, callback, useCapture);\n return () => {\n eventTarget.removeEventListener(eventName, callback, useCapture);\n };\n }, [elementRef == null ? void 0 : elementRef.current, callback]);\n }\n React2.useLayoutEffect(() => {\n if (elementRef.current === null) return;\n const newElemProps = /* @__PURE__ */ new Map();\n for (const key in elementProps) {\n setProperty(elementRef.current, key, elementProps[key]);\n prevElemPropsRef.current.delete(key);\n newElemProps.set(key, elementProps[key]);\n }\n for (const [key, _value] of prevElemPropsRef.current) {\n setProperty(elementRef.current, key, void 0);\n }\n prevElemPropsRef.current = newElemProps;\n });\n }\n if (typeof window === \"undefined\" && (elementClass == null ? void 0 : elementClass.getTemplateHTML) && (elementClass == null ? void 0 : elementClass.shadowRootOptions)) {\n const { mode, delegatesFocus } = elementClass.shadowRootOptions;\n const templateShadowRoot = React2.createElement(\"template\", {\n shadowrootmode: mode,\n shadowrootdelegatesfocus: delegatesFocus,\n dangerouslySetInnerHTML: {\n __html: elementClass.getTemplateHTML(attrs, props)\n }\n });\n reactProps.children = [templateShadowRoot, reactProps.children];\n }\n return React2.createElement(tagName, {\n ...defaultProps,\n ...reactProps,\n ref: React2.useCallback(\n (node) => {\n elementRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref !== null) {\n ref.current = node;\n }\n },\n [ref]\n )\n });\n });\n ReactComponent.displayName = displayName ?? elementClass.name;\n return ReactComponent;\n}\nfunction setProperty(node, name, value) {\n var _a;\n node[name] = value;\n if (value == null && name in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) {\n node.removeAttribute(name);\n }\n}\n\n// dist/react.ts\nvar react_default = createComponent({\n react: React,\n tagName: \"dash-video\",\n elementClass: CustomMediaElement,\n toAttributeName(propName) {\n if (propName === \"muted\") return \"\";\n if (propName === \"defaultMuted\") return \"muted\";\n return defaultToAttributeName(propName);\n }\n});\nexport {\n react_default as default\n};\n/*! Bundled license information:\n\nce-la-react/dist/ce-la-react.js:\n (**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n *\n * Modified version of `@lit/react` for vanilla custom elements with support for SSR.\n *)\n*/\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;;;;;;;;;;;AC7JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|