@kkcompany/player 2.25.0-canary.1 → 2.25.0-canary.3
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 +29 -0
- package/dist/core.mjs +7 -9
- package/dist/index.js +3575 -3271
- package/dist/index.mjs +650 -352
- package/dist/modules.mjs +30 -20
- package/dist/plugins.mjs +3 -4
- package/dist/react.mjs +508 -235
- package/package.json +1 -2
package/dist/modules.mjs
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
1
|
import mitt from 'mitt';
|
|
3
2
|
import UAParser from 'ua-parser-js';
|
|
4
3
|
|
|
5
4
|
/* eslint-disable no-param-reassign */
|
|
6
|
-
|
|
7
5
|
const waitMs$1 = time => new Promise(resolve => {
|
|
8
6
|
setTimeout(resolve, time);
|
|
9
7
|
});
|
|
10
8
|
|
|
11
|
-
const handleRequestError = (
|
|
9
|
+
const handleRequestError = (request, {
|
|
12
10
|
onError,
|
|
13
11
|
retryTimes = 0
|
|
14
|
-
}) =>
|
|
15
|
-
retry: () => handleRequestError(
|
|
12
|
+
}) => request().catch(error => onError(error, {
|
|
13
|
+
retry: () => handleRequestError(request, {
|
|
16
14
|
onError,
|
|
17
15
|
retryTimes: retryTimes + 1
|
|
18
16
|
}),
|
|
@@ -67,28 +65,26 @@ const createApi = (config, {
|
|
|
67
65
|
|
|
68
66
|
const request = (url, {
|
|
69
67
|
method
|
|
70
|
-
} = {}) => handleRequestError(
|
|
68
|
+
} = {}) => handleRequestError(() => fetch(`${url}?${new URLSearchParams(params).toString()}`, {
|
|
71
69
|
method,
|
|
72
|
-
headers: getHeaders()
|
|
73
|
-
|
|
74
|
-
}), {
|
|
70
|
+
headers: getHeaders()
|
|
71
|
+
}).then(response => response.json()), {
|
|
75
72
|
onError
|
|
76
|
-
})
|
|
73
|
+
});
|
|
77
74
|
|
|
78
75
|
const sessionRequest = (path, {
|
|
79
76
|
method = 'POST',
|
|
80
77
|
type,
|
|
81
78
|
id,
|
|
82
79
|
token
|
|
83
|
-
}) => handleRequestError(
|
|
80
|
+
}) => handleRequestError(() => fetch(`${host}/sessions/${type}/${id}/playback/${deviceId}/${path}?${new URLSearchParams({ ...params,
|
|
81
|
+
playback_token: token
|
|
82
|
+
}).toString()}`, {
|
|
84
83
|
method,
|
|
85
|
-
headers: getHeaders()
|
|
86
|
-
|
|
87
|
-
playback_token: token
|
|
88
|
-
}
|
|
89
|
-
}), {
|
|
84
|
+
headers: getHeaders()
|
|
85
|
+
}).then(response => response.json()), {
|
|
90
86
|
onError
|
|
91
|
-
})
|
|
87
|
+
});
|
|
92
88
|
|
|
93
89
|
return {
|
|
94
90
|
config,
|
|
@@ -509,12 +505,14 @@ const getSource = (sourceOptions, {
|
|
|
509
505
|
function getVersion() {
|
|
510
506
|
try {
|
|
511
507
|
// eslint-disable-next-line no-undef
|
|
512
|
-
return "2.25.0-canary.
|
|
508
|
+
return "2.25.0-canary.3";
|
|
513
509
|
} catch (e) {
|
|
514
510
|
return undefined;
|
|
515
511
|
}
|
|
516
512
|
}
|
|
517
513
|
|
|
514
|
+
/* eslint-disable no-param-reassign */
|
|
515
|
+
|
|
518
516
|
const matchAll = (input, pattern) => {
|
|
519
517
|
const flags = [pattern.global && 'g', pattern.ignoreCase && 'i', pattern.multiline && 'm'].filter(Boolean).join('');
|
|
520
518
|
const clone = new RegExp(pattern, flags);
|
|
@@ -1394,6 +1392,12 @@ const retrieveModuleConfig = (modulesConfig, query) => {
|
|
|
1394
1392
|
|
|
1395
1393
|
/* eslint-disable camelcase */
|
|
1396
1394
|
const HEARTBEAT_INTERVAL_MS = 10000;
|
|
1395
|
+
//@ts-ignore
|
|
1396
|
+
const axios$1 = {
|
|
1397
|
+
post: (...args) => {
|
|
1398
|
+
console.log(args);
|
|
1399
|
+
}
|
|
1400
|
+
}; // TODO
|
|
1397
1401
|
|
|
1398
1402
|
const eventHeartbeat = ({
|
|
1399
1403
|
token,
|
|
@@ -1426,7 +1430,7 @@ const eventHeartbeat = ({
|
|
|
1426
1430
|
}; // Avoid template literals because the env variable would be replaced in the rollup
|
|
1427
1431
|
|
|
1428
1432
|
await retryWithBackoff$1({
|
|
1429
|
-
fn: () => axios.post(endpoint, payload, {
|
|
1433
|
+
fn: () => axios$1.post(endpoint, payload, {
|
|
1430
1434
|
headers: {
|
|
1431
1435
|
'Kks-Bv-Token': token
|
|
1432
1436
|
}
|
|
@@ -1439,6 +1443,12 @@ var eventHeartbeat$1 = eventHeartbeat;
|
|
|
1439
1443
|
|
|
1440
1444
|
/* eslint-disable camelcase */
|
|
1441
1445
|
|
|
1446
|
+
const axios = {
|
|
1447
|
+
post: (...args) => {
|
|
1448
|
+
console.log(args);
|
|
1449
|
+
}
|
|
1450
|
+
}; // TODO
|
|
1451
|
+
|
|
1442
1452
|
const getDeviceInfo = () => {
|
|
1443
1453
|
const browser = getBrowser();
|
|
1444
1454
|
return {
|
|
@@ -1493,7 +1503,7 @@ const createAnalytics = ({
|
|
|
1493
1503
|
const logTarget = mapLogEvents({
|
|
1494
1504
|
video,
|
|
1495
1505
|
playerName: 'shaka',
|
|
1496
|
-
version: "2.25.0-canary.
|
|
1506
|
+
version: "2.25.0-canary.3"
|
|
1497
1507
|
});
|
|
1498
1508
|
logTarget.all((type, data) => {
|
|
1499
1509
|
const payload = {
|
package/dist/plugins.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import mitt from 'mitt';
|
|
2
|
-
import axios from 'axios';
|
|
3
2
|
import UAParser from 'ua-parser-js';
|
|
4
3
|
|
|
5
4
|
/** @param {string} m3u8Manifest */
|
|
@@ -487,13 +486,13 @@ const snapback = ({
|
|
|
487
486
|
}
|
|
488
487
|
};
|
|
489
488
|
|
|
489
|
+
const axios = () => {};
|
|
490
|
+
|
|
490
491
|
const addFetchPolyfill = () => {
|
|
491
492
|
window.fetch = async (url, {
|
|
492
493
|
method
|
|
493
494
|
} = {}) => {
|
|
494
|
-
const result = await axios(
|
|
495
|
-
method
|
|
496
|
-
});
|
|
495
|
+
const result = await axios();
|
|
497
496
|
return Promise.resolve({
|
|
498
497
|
json: () => result.data
|
|
499
498
|
});
|