@kkcompany/player 2.25.0-canary.7 → 2.25.0-canary.9
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 +10 -0
- package/dist/core.mjs +2 -90
- package/dist/index.js +8446 -8523
- package/dist/index.mjs +86 -158
- package/dist/modules.mjs +117 -117
- package/dist/react.mjs +86 -158
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.25.0-canary.9](https://gitlab.kkinternal.com/playback/web-playcraft/compare/v2.25.0-canary.8...v2.25.0-canary.9) (2025-12-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **premium:** enable audio/text track control ([41d7dd3](https://gitlab.kkinternal.com/playback/web-playcraft/commit/41d7dd3776ab1b5e82b4612605394bb98e22e3b0))
|
|
11
|
+
* subtitle off option is changed to 'none' ([029a41a](https://gitlab.kkinternal.com/playback/web-playcraft/commit/029a41a6e6f69847c01665ca4bd31f9ef77073a7))
|
|
12
|
+
|
|
13
|
+
## [2.25.0-canary.8](https://gitlab.kkinternal.com/playback/web-playcraft/compare/v2.25.0-canary.7...v2.25.0-canary.8) (2025-11-28)
|
|
14
|
+
|
|
5
15
|
## [2.25.0-canary.7](https://gitlab.kkinternal.com/playback/web-playcraft/compare/v2.25.0-canary.6...v2.25.0-canary.7) (2025-11-28)
|
|
6
16
|
|
|
7
17
|
## [2.25.0-canary.6](https://gitlab.kkinternal.com/playback/web-playcraft/compare/v2.25.0-canary.5...v2.25.0-canary.6) (2025-11-28)
|
package/dist/core.mjs
CHANGED
|
@@ -4,14 +4,6 @@ import UAParser from 'ua-parser-js';
|
|
|
4
4
|
new UAParser();
|
|
5
5
|
|
|
6
6
|
const isSafari = () => /^((?!chrome|android|X11|Linux).)*(safari|iPad|iPhone|Version)/i.test(navigator.userAgent);
|
|
7
|
-
|
|
8
|
-
function needNativeHls() {
|
|
9
|
-
// Don't let Android phones play HLS, even if some of them report supported
|
|
10
|
-
// This covers Samsung & OPPO special cases
|
|
11
|
-
const isAndroid = /android|X11|Linux/i.test(navigator.userAgent);
|
|
12
|
-
return isAndroid || /firefox/i.test(navigator.userAgent) ? '' : // canPlayType isn't reliable across all iOS verion / device combinations, so also check user agent
|
|
13
|
-
isSafari() ? 'maybe' : document.createElement('video').canPlayType('application/vnd.apple.mpegURL');
|
|
14
|
-
}
|
|
15
7
|
// navigator.maxTouchPoints() is not supported in Safari 11, iOS Safari 11.0-11.2 compat/compat
|
|
16
8
|
|
|
17
9
|
|
|
@@ -45,7 +37,7 @@ const waitFor = (check, handler) => {
|
|
|
45
37
|
function getVersion() {
|
|
46
38
|
try {
|
|
47
39
|
// eslint-disable-next-line no-undef
|
|
48
|
-
return "2.25.0-canary.
|
|
40
|
+
return "2.25.0-canary.9";
|
|
49
41
|
} catch (e) {
|
|
50
42
|
return undefined;
|
|
51
43
|
}
|
|
@@ -1837,38 +1829,6 @@ const loadShaka = async (videoElement, config = {}, options = {}) => {
|
|
|
1837
1829
|
return player;
|
|
1838
1830
|
};
|
|
1839
1831
|
|
|
1840
|
-
const timeoutError = () => new Error('request timeout');
|
|
1841
|
-
/**
|
|
1842
|
-
* @param {URL|RequestInfo} url
|
|
1843
|
-
* @param {RequestInit} options
|
|
1844
|
-
* @param {{responseType: 'json'|'text'}}
|
|
1845
|
-
*/
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
const retryRequest = (url, options = {}, {
|
|
1849
|
-
responseType = 'json',
|
|
1850
|
-
timeout = 6,
|
|
1851
|
-
retryTimes = 6
|
|
1852
|
-
} = {}) => new Promise((resolve, reject) => {
|
|
1853
|
-
setTimeout(() => reject(timeoutError()), timeout * 1000);
|
|
1854
|
-
fetch(url, options).then(response => {
|
|
1855
|
-
var _response$responseTyp;
|
|
1856
|
-
|
|
1857
|
-
return resolve(((_response$responseTyp = response[responseType]) === null || _response$responseTyp === void 0 ? void 0 : _response$responseTyp.call(response)) || response);
|
|
1858
|
-
}).catch(reject);
|
|
1859
|
-
}).catch(error => {
|
|
1860
|
-
console.log(error);
|
|
1861
|
-
|
|
1862
|
-
if (retryTimes > 0) {
|
|
1863
|
-
return retryRequest(url, options, {
|
|
1864
|
-
timeout,
|
|
1865
|
-
retryTimes: retryTimes - 1
|
|
1866
|
-
});
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
return error;
|
|
1870
|
-
});
|
|
1871
|
-
|
|
1872
1832
|
const protocolExtensions = {
|
|
1873
1833
|
hls: 'm3u8',
|
|
1874
1834
|
dash: 'mpd'
|
|
@@ -2021,34 +1981,6 @@ const getDrmOptions = source => {
|
|
|
2021
1981
|
}];
|
|
2022
1982
|
};
|
|
2023
1983
|
|
|
2024
|
-
/* eslint-disable no-param-reassign */
|
|
2025
|
-
|
|
2026
|
-
const matchAll = (input, pattern) => {
|
|
2027
|
-
const flags = [pattern.global && 'g', pattern.ignoreCase && 'i', pattern.multiline && 'm'].filter(Boolean).join('');
|
|
2028
|
-
const clone = new RegExp(pattern, flags);
|
|
2029
|
-
return Array.from(function* () {
|
|
2030
|
-
let matched = true;
|
|
2031
|
-
|
|
2032
|
-
while (1) {
|
|
2033
|
-
matched = clone.exec(input);
|
|
2034
|
-
|
|
2035
|
-
if (!matched) {
|
|
2036
|
-
return;
|
|
2037
|
-
}
|
|
2038
|
-
|
|
2039
|
-
yield matched;
|
|
2040
|
-
}
|
|
2041
|
-
}());
|
|
2042
|
-
};
|
|
2043
|
-
|
|
2044
|
-
const getHlsQualityOptions = manifest => {
|
|
2045
|
-
const resolutionList = matchAll(manifest, /RESOLUTION=\d+x(\d+)/g);
|
|
2046
|
-
return Array.from(new Set(resolutionList.map(([, height]) => ({
|
|
2047
|
-
height: +height
|
|
2048
|
-
})))).sort((a, b) => b.height - a.height);
|
|
2049
|
-
};
|
|
2050
|
-
// for unit test
|
|
2051
|
-
|
|
2052
1984
|
/* eslint-disable no-param-reassign */
|
|
2053
1985
|
// when the gap is small enough, we consider it is on edge.
|
|
2054
1986
|
// The magic number 10s comes from observation of YouTube
|
|
@@ -2218,22 +2150,6 @@ const subscribePlaybackState = (media, updateState, {
|
|
|
2218
2150
|
return () => registered.forEach(off => off());
|
|
2219
2151
|
};
|
|
2220
2152
|
|
|
2221
|
-
const tryPatchHlsVideoQualities = async (player, hlsUrl) => {
|
|
2222
|
-
if (/(^data)|(mp4$)/.test(hlsUrl)) {
|
|
2223
|
-
return;
|
|
2224
|
-
} // filtered manifest comes with data URI and should be ignored
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
const manifest = await retryRequest(hlsUrl, {}, {
|
|
2228
|
-
responseType: 'text'
|
|
2229
|
-
}).catch(e => console.warn('Failed to get HLS video qualities', e));
|
|
2230
|
-
const videoQualities = getHlsQualityOptions(manifest);
|
|
2231
|
-
|
|
2232
|
-
if (videoQualities) {
|
|
2233
|
-
player.getVariantTracks = () => videoQualities;
|
|
2234
|
-
}
|
|
2235
|
-
};
|
|
2236
|
-
|
|
2237
2153
|
const seek = async (media, {
|
|
2238
2154
|
player,
|
|
2239
2155
|
plugins = []
|
|
@@ -2383,10 +2299,6 @@ const load = async (media, {
|
|
|
2383
2299
|
loadStartTime = merged.startTime;
|
|
2384
2300
|
}
|
|
2385
2301
|
|
|
2386
|
-
if (needNativeHls() && merged.type === 'application/x-mpegurl') {
|
|
2387
|
-
await tryPatchHlsVideoQualities(player, merged.src);
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
2302
|
return player.unload().then(() => player.load(merged.src, loadStartTime, merged.type)).then(loadResult => {
|
|
2391
2303
|
getSourceText(source).forEach(({
|
|
2392
2304
|
src,
|
|
@@ -2458,7 +2370,7 @@ const loadPlayer = async (videoElement, {
|
|
|
2458
2370
|
// TODO unsubscribe to release the video element
|
|
2459
2371
|
// when resuming from background, video may play without no media events
|
|
2460
2372
|
// on some iOS devices, pause again to workaround
|
|
2461
|
-
if (
|
|
2373
|
+
if (isIOS()) {
|
|
2462
2374
|
on(document, 'visibilitychange', () => setTimeout(() => videoElement.pause(), 50));
|
|
2463
2375
|
}
|
|
2464
2376
|
|