@kkcompany/player 2.25.0-canary.24 → 2.25.0-canary.26
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/CHANGELOG.md +2 -0
- package/dist/StallReload-BFlQRphx.mjs +717 -0
- package/dist/Video-CMbK-cxg.mjs +120 -0
- package/dist/adaptation-BcTsh-wx.mjs +74 -0
- package/dist/api-2BOrEA5d.mjs +1057 -0
- package/dist/debugUtil-IF7p5TSI.mjs +23 -0
- package/dist/events-B3vI3Srm.mjs +16 -0
- package/dist/fixDashManifest-CJ63KKaA.mjs +56 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +3 -10153
- package/dist/loadPlayer-CQdGA3Te.mjs +1560 -0
- package/dist/loadScript-Ct19kU9g.mjs +13 -0
- package/dist/mediaBindings-CoY60lQw.mjs +542 -0
- package/dist/modules.d.mts +51 -0
- package/dist/modules.mjs +631 -2201
- package/dist/playerCore/index.d.mts +3 -0
- package/dist/playerCore/index.mjs +4 -0
- package/dist/plugins/index.d.mts +2 -0
- package/dist/plugins/index.mjs +3 -0
- package/dist/reactEntry.d.mts +20 -0
- package/dist/reactEntry.mjs +6833 -0
- package/dist/util-B2YBSBjR.mjs +29 -0
- package/package.json +24 -19
- package/dist/core.mjs +0 -3075
- package/dist/index.d.ts +0 -18
- package/dist/index.js +0 -20943
- package/dist/modules.d.ts +0 -89
- package/dist/plugins.d.ts +0 -5
- package/dist/plugins.mjs +0 -1105
- package/dist/react.d.ts +0 -178
- package/dist/react.mjs +0 -13066
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/util/debugUtil.js
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {{
|
|
4
|
+
* DRM_PROTAL_URL?: string
|
|
5
|
+
* }} debugOption
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @type {debugOption}
|
|
9
|
+
*/
|
|
10
|
+
const DEBUG_OPTIONS = { DRM_PROTAL_URL: typeof window !== "undefined" ? window?.localStorage?.DRM_PROTAL_URL : "" };
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {debugOption} options
|
|
14
|
+
*/
|
|
15
|
+
function setupDebugOption(options = {}) {
|
|
16
|
+
Object.assign(DEBUG_OPTIONS, options);
|
|
17
|
+
}
|
|
18
|
+
const setupLicenseServerOverride = () => {
|
|
19
|
+
if (localStorage?.DRM_PROTAL_URL) setupDebugOption({ DRM_PROTAL_URL: localStorage.DRM_PROTAL_URL });
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { setupDebugOption as n, setupLicenseServerOverride as r, DEBUG_OPTIONS as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/playerCore/events.js
|
|
2
|
+
const pipeEvents = (source, target, types) => {
|
|
3
|
+
const registered = types.map((name) => {
|
|
4
|
+
const pipe = (event) => target.emit(name, event);
|
|
5
|
+
source.addEventListener(name, pipe);
|
|
6
|
+
return () => source.removeEventListener(name, pipe);
|
|
7
|
+
});
|
|
8
|
+
return () => [].concat(...registered).forEach((removeListener) => removeListener());
|
|
9
|
+
};
|
|
10
|
+
const linkPluginEvents = (plugins, handlers) => {
|
|
11
|
+
const registered = plugins.map((plugin) => Object.entries(handlers).map(([eventName, handler]) => plugin.on?.(eventName, (event) => handler(event, plugin))));
|
|
12
|
+
return () => [].concat(...registered).forEach((removeListener) => removeListener?.());
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { pipeEvents as n, linkPluginEvents as t };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/plugins/shaka/fixDashManifest.js
|
|
2
|
+
/**
|
|
3
|
+
* Parses an XML duration string.
|
|
4
|
+
* Negative values are not supported. Years and months are treated as exactly
|
|
5
|
+
* 365 and 30 days respectively.
|
|
6
|
+
* @param {string} durationString The duration string, e.g., "PT1H3M43.2S",
|
|
7
|
+
* which means 1 hour, 3 minutes, and 43.2 seconds.
|
|
8
|
+
* @return {?number} The parsed duration in seconds on success; otherwise,
|
|
9
|
+
* return null.
|
|
10
|
+
* @see {@link http://www.datypic.com/sc/xsd/t-xsd_duration.html}
|
|
11
|
+
*/
|
|
12
|
+
const parseDuration = (durationString) => {
|
|
13
|
+
if (!durationString) return null;
|
|
14
|
+
const matches = new RegExp("^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$").exec(durationString);
|
|
15
|
+
if (!matches) {
|
|
16
|
+
console.warning("Invalid duration string:", durationString);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const years = Number(matches[1] || null);
|
|
20
|
+
const months = Number(matches[2] || null);
|
|
21
|
+
const days = Number(matches[3] || null);
|
|
22
|
+
const hours = Number(matches[4] || null);
|
|
23
|
+
const minutes = Number(matches[5] || null);
|
|
24
|
+
const seconds = Number(matches[6] || null);
|
|
25
|
+
const d = 3600 * 24 * 365 * years + 3600 * 24 * 30 * months + 3600 * 24 * days + 3600 * hours + 60 * minutes + seconds;
|
|
26
|
+
return Number.isFinite(d) ? d : null;
|
|
27
|
+
};
|
|
28
|
+
const normalize = (doc, template, period) => {
|
|
29
|
+
const segmentDuration = parseFloat(template.getAttribute("duration"), 10);
|
|
30
|
+
if (!segmentDuration) return;
|
|
31
|
+
const timescale = parseFloat(template.getAttribute("timescale"), 10);
|
|
32
|
+
const periodDuration = parseDuration(period.getAttribute("duration"));
|
|
33
|
+
const item = doc.createElement("S");
|
|
34
|
+
item.setAttribute("d", segmentDuration);
|
|
35
|
+
item.setAttribute("r", Math.ceil(periodDuration * timescale / segmentDuration) - 1);
|
|
36
|
+
const timeline = doc.createElement("SegmentTimeline");
|
|
37
|
+
timeline.appendChild(item);
|
|
38
|
+
template.appendChild(timeline);
|
|
39
|
+
template.removeAttribute("duration");
|
|
40
|
+
};
|
|
41
|
+
const fixDashManifest = (data, { minTimeShiftBufferDepth } = {}) => {
|
|
42
|
+
const doc = new DOMParser().parseFromString(data, "text/xml");
|
|
43
|
+
const root = doc.children[0];
|
|
44
|
+
if (root.getAttribute("type") === "dynamic") {
|
|
45
|
+
if (root.getAttribute("timeShiftBufferDepth") < minTimeShiftBufferDepth) root.setAttribute("timeShiftBufferDepth", minTimeShiftBufferDepth);
|
|
46
|
+
} else if (root.hasAttribute("timeShiftBufferDepth")) root.removeAttribute("timeShiftBufferDepth");
|
|
47
|
+
if (doc.querySelectorAll("Period").length > 1) Array.from(doc.querySelectorAll("Period")).forEach((period) => {
|
|
48
|
+
Array.from(period.querySelectorAll("SegmentTemplate")).forEach((template) => normalize(doc, template, period));
|
|
49
|
+
});
|
|
50
|
+
window.manifestDoc = doc;
|
|
51
|
+
return new XMLSerializer().serializeToString(doc);
|
|
52
|
+
};
|
|
53
|
+
var fixDashManifest_default = fixDashManifest;
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { fixDashManifest_default as t };
|
package/dist/index.d.mts
ADDED