@kkcompany/player 2.9.444 → 2.25.0-canary.1

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 CHANGED
@@ -2,6 +2,45 @@
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.1](https://gitlab.kkinternal.com/playback/web-playcraft/compare/v2.9.20...v2.25.0-canary.1) (2025-11-21)
6
+
7
+
8
+ ### Features
9
+
10
+ * add support of external text track / subtitle ([2d2aa9f](https://gitlab.kkinternal.com/playback/web-playcraft/commit/2d2aa9f8b624749795b76f80551dbeca40359a79))
11
+ * **text:** add style for shaka player text display container ([39e62ec](https://gitlab.kkinternal.com/playback/web-playcraft/commit/39e62eccf99f394d12d682cd3b4a1a5ad1a398b3))
12
+ * **text:** patch vertical text display style ([7725796](https://gitlab.kkinternal.com/playback/web-playcraft/commit/7725796e0d5ef77a6728c88296519eb809f090c5))
13
+ * **text:** remove extra styles from ruby/rt to display properly ([4c77c61](https://gitlab.kkinternal.com/playback/web-playcraft/commit/4c77c61436a28fbdcc69e2bde0cd670681f7fadb))
14
+ * add castMedia export with error handling added ([82aa0b6](https://gitlab.kkinternal.com/playback/web-playcraft/commit/82aa0b608aad2f2e5c638b20ca3254298ec77291))
15
+ * basic HLS on MSE ([b02c6f0](https://gitlab.kkinternal.com/playback/web-playcraft/commit/b02c6f0f44a89000aed9f279c1715bb4d0d115dc))
16
+ * enable Shaka player built-in text/subtitle display ([47375d6](https://gitlab.kkinternal.com/playback/web-playcraft/commit/47375d639a94df07e0919a79560f0202540f46fa))
17
+ * expose audio track info ([87426d7](https://gitlab.kkinternal.com/playback/web-playcraft/commit/87426d710262baaa347e07ef7c21cd129671d834))
18
+ * give subtitle a bottom magin while controller is hidden ([6444f6a](https://gitlab.kkinternal.com/playback/web-playcraft/commit/6444f6a5bfe9ed6a040c78e8317a67bcf136fa41))
19
+ * select preferred text track after switching video ([e380825](https://gitlab.kkinternal.com/playback/web-playcraft/commit/e3808255ced22c7bdbe3ace169e33b1c9b9b176b))
20
+ * **cast:** add CastSessionControl for non-context integration ([4749ec0](https://gitlab.kkinternal.com/playback/web-playcraft/commit/4749ec0d62771bc73abcf231fc6e58672508e1b5))
21
+ * **premium:** add cast prop for non-context integration ([7a3307f](https://gitlab.kkinternal.com/playback/web-playcraft/commit/7a3307f35c691b77d83b6181670fb76f21187476))
22
+ * upgrade shaka-player and limit version range to 4.15.x ([48c5ec8](https://gitlab.kkinternal.com/playback/web-playcraft/commit/48c5ec81bd8adec74b8415cf101e12617c1d1f07))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * cursh while using quilty setting ([2389954](https://gitlab.kkinternal.com/playback/web-playcraft/commit/2389954551de8fc1dde4a62b70c7075bebf929dd))
28
+ * detect Safari 18 ([981efde](https://gitlab.kkinternal.com/playback/web-playcraft/commit/981efde96791bd93b47b69ca9d4ede32be8bcc0e))
29
+ * format subtitle label only if it exists ([c88fb03](https://gitlab.kkinternal.com/playback/web-playcraft/commit/c88fb033a84126cfc86f6a6ba3b59ab5a745bd48))
30
+ * handle audio tracks with same language code ([d9de3fe](https://gitlab.kkinternal.com/playback/web-playcraft/commit/d9de3fefeda9fcaa7359bcc80ef94ea2dbfa65e0))
31
+ * inconsistent subtitle size on newer MacOS + Chrome ([49008dc](https://gitlab.kkinternal.com/playback/web-playcraft/commit/49008dcde8b1df2dc54f2ea0b0de60568e70151e))
32
+ * initial subtitle on safari ([564c9e5](https://gitlab.kkinternal.com/playback/web-playcraft/commit/564c9e59495f81829074031173e747ee056b39c1))
33
+ * listen to visibility change only in iOS device ([01e0e18](https://gitlab.kkinternal.com/playback/web-playcraft/commit/01e0e18ea011bb10abd6af0ac20e03385171a674))
34
+ * load sender framework only while the application id exists ([0b0caa9](https://gitlab.kkinternal.com/playback/web-playcraft/commit/0b0caa9e1546af4e2bb5ad6fbed1170dcfe460bd))
35
+ * maintain text track / subtitle setting after Safari quality switch ([74837cc](https://gitlab.kkinternal.com/playback/web-playcraft/commit/74837cc7ec3c7ec7d93f46d37e73e00810878985))
36
+ * match subtitle value as off while subtitle is undefined ([4f8ebd2](https://gitlab.kkinternal.com/playback/web-playcraft/commit/4f8ebd2bfbde374215ec08ff4e3594c78f382799))
37
+ * select DASH/HLS base on DRM key system availablity ([623e1e2](https://gitlab.kkinternal.com/playback/web-playcraft/commit/623e1e2ca77b7313e1ec845b391e4c92166686b8))
38
+ * turn off subtitles when starting playback in iOS browsers ([9afbbf1](https://gitlab.kkinternal.com/playback/web-playcraft/commit/9afbbf1516b0007435153311418c1afc2bcba3df))
39
+ * **core:** provide audio tracks without duplicate variantTracks ([799525d](https://gitlab.kkinternal.com/playback/web-playcraft/commit/799525d8b2e7af4417849ac6517ba194644dd720))
40
+ * should use track.label instead of .name ([249b606](https://gitlab.kkinternal.com/playback/web-playcraft/commit/249b6064d8ed444917aaa0d0465269f7610f111d))
41
+ * use text tracks only if have valid language ([b126b7c](https://gitlab.kkinternal.com/playback/web-playcraft/commit/b126b7c545a0782e19d91fa2a72030ab5acdb7f2))
42
+ * workaround for Safari text track on by default ([c4282d8](https://gitlab.kkinternal.com/playback/web-playcraft/commit/c4282d84dff31ad5a92ab58a195c9b77994064e7))
43
+
5
44
  ### [2.9.20](https://gitlab.kkinternal.com/playback/web-playcraft/compare/v2.9.19...v2.9.20) (2025-09-10)
6
45
 
7
46
 
package/dist/core.mjs CHANGED
@@ -2,28 +2,15 @@ import UAParser from 'ua-parser-js';
2
2
 
3
3
  /* eslint-disable no-plusplus */
4
4
  new UAParser();
5
+
6
+ const isSafari = () => /^((?!chrome|android|X11|Linux).)*(safari|iPad|iPhone|Version)/i.test(navigator.userAgent);
7
+
5
8
  function needNativeHls() {
6
9
  // Don't let Android phones play HLS, even if some of them report supported
7
10
  // This covers Samsung & OPPO special cases
8
- const isAndroid = /android|X11|Linux/i.test(navigator.userAgent); // canPlayType isn't reliable across all iOS verion / device combinations, so also check user agent
9
-
10
- const isSafari = /^((?!chrome|android|X11|Linux).)*(safari|iPad|iPhone|Version)/i.test(navigator.userAgent); // ref: https://stackoverflow.com/a/12905122/4578017
11
- // none of our supported browsers other than Safari response to this
12
-
13
- const isFirefox = /firefox/i.test(navigator.userAgent);
14
- const isEdge = /edg/i.test(navigator.userAgent);
15
- const isChrome = /chrome/i.test(navigator.userAgent) && !isEdge; // ref: https://stackoverflow.com/a/12905122/4578017
16
- // none of our supported browsers other than Safari response to this
17
-
18
- if (isAndroid || isFirefox || isEdge || isChrome) {
19
- return "";
20
- }
21
-
22
- if (isSafari) {
23
- return 'maybe';
24
- }
25
-
26
- return document.createElement('video').canPlayType('application/vnd.apple.mpegURL');
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');
27
14
  }
28
15
  // navigator.maxTouchPoints() is not supported in Safari 11, iOS Safari 11.0-11.2 compat/compat
29
16
 
@@ -58,7 +45,7 @@ const waitFor = (check, handler) => {
58
45
  function getVersion() {
59
46
  try {
60
47
  // eslint-disable-next-line no-undef
61
- return "2.9.444";
48
+ return "2.25.0-canary.1";
62
49
  } catch (e) {
63
50
  return undefined;
64
51
  }
@@ -1688,7 +1675,7 @@ const loadShaka = async (videoElement, config = {}, options = {}) => {
1688
1675
  // See: https://github.com/shaka-project/shaka-player/issues/3526
1689
1676
  safeSeekOffset: 0,
1690
1677
  rebufferingGoal: 0,
1691
- ...(needNativeHls() && {
1678
+ ...(isSafari() && {
1692
1679
  preferNativeHls: true
1693
1680
  }),
1694
1681
  ...config.streaming
@@ -1780,7 +1767,7 @@ const loadShaka = async (videoElement, config = {}, options = {}) => {
1780
1767
  responseHandlers: [rewriteDashManifest]
1781
1768
  };
1782
1769
 
1783
- if (needNativeHls()) {
1770
+ if (isSafari()) {
1784
1771
  setupKKFariplay(player, extensionOptions);
1785
1772
  }
1786
1773
 
@@ -1925,7 +1912,7 @@ const getDrmOptions$1 = fallbackDrm => {
1925
1912
  * @typedef {{hls: string, dash: string}} SourceObjectAlt backward compatiable form
1926
1913
  *
1927
1914
  * @param {SourceObject[]|SourceObject|SourceObjectAlt|string} sourceOptions
1928
- * @param {{preferManifestType?: ('dash'|'hls')}} options
1915
+ * @param {{preferManifestType?: ('dash'|'hls'|'platform')}} options
1929
1916
  * @return {{src: string, type: string, drm: Object}}
1930
1917
  */
1931
1918
 
@@ -1968,7 +1955,8 @@ const getSource = (sourceOptions, {
1968
1955
  });
1969
1956
  }
1970
1957
 
1971
- const matched = sourceOptions.find(source => !preferManifestType || matchType(source, preferManifestType));
1958
+ const targetType = preferManifestType !== 'platform' ? preferManifestType : isSafari() ? 'hls' : 'dash';
1959
+ const matched = sourceOptions.find(source => matchType(source, targetType));
1972
1960
  const selected = matched || sourceOptions[0];
1973
1961
 
1974
1962
  if (!selected) {
@@ -2304,9 +2292,8 @@ const load = async (media, {
2304
2292
  startTime,
2305
2293
  plugins = []
2306
2294
  }, source) => {
2307
- const preferManifestType = needNativeHls() ? 'hls' : 'dash';
2308
2295
  const preferred = getSource(source, {
2309
- preferManifestType
2296
+ preferManifestType: 'platform'
2310
2297
  }); // There's no use case that changing DRM options without changing manifest URL, just skip
2311
2298
 
2312
2299
  if (player.lastSrc === (preferred === null || preferred === void 0 ? void 0 : preferred.src)) {
@@ -2326,7 +2313,7 @@ const load = async (media, {
2326
2313
  player,
2327
2314
  source: currentSource,
2328
2315
  startTime,
2329
- streamFormat: preferManifestType,
2316
+ streamFormat: source.type,
2330
2317
  reload: async () => {
2331
2318
  // Bitmovin unexpectedly restores muted state, so save to restore
2332
2319
  const restoreMuted = player.isMuted && {