@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/dist/modules.mjs CHANGED
@@ -269,28 +269,15 @@ function getDevice() {
269
269
  function getBrowser() {
270
270
  return parser.getBrowser();
271
271
  }
272
+
273
+ const isSafari = () => /^((?!chrome|android|X11|Linux).)*(safari|iPad|iPhone|Version)/i.test(navigator.userAgent);
274
+
272
275
  function needNativeHls() {
273
276
  // Don't let Android phones play HLS, even if some of them report supported
274
277
  // This covers Samsung & OPPO special cases
275
- const isAndroid = /android|X11|Linux/i.test(navigator.userAgent); // canPlayType isn't reliable across all iOS verion / device combinations, so also check user agent
276
-
277
- const isSafari = /^((?!chrome|android|X11|Linux).)*(safari|iPad|iPhone|Version)/i.test(navigator.userAgent); // ref: https://stackoverflow.com/a/12905122/4578017
278
- // none of our supported browsers other than Safari response to this
279
-
280
- const isFirefox = /firefox/i.test(navigator.userAgent);
281
- const isEdge = /edg/i.test(navigator.userAgent);
282
- const isChrome = /chrome/i.test(navigator.userAgent) && !isEdge; // ref: https://stackoverflow.com/a/12905122/4578017
283
- // none of our supported browsers other than Safari response to this
284
-
285
- if (isAndroid || isFirefox || isEdge || isChrome) {
286
- return "";
287
- }
288
-
289
- if (isSafari) {
290
- return 'maybe';
291
- }
292
-
293
- return document.createElement('video').canPlayType('application/vnd.apple.mpegURL');
278
+ const isAndroid = /android|X11|Linux/i.test(navigator.userAgent);
279
+ return isAndroid || /firefox/i.test(navigator.userAgent) ? '' : // canPlayType isn't reliable across all iOS verion / device combinations, so also check user agent
280
+ isSafari() ? 'maybe' : document.createElement('video').canPlayType('application/vnd.apple.mpegURL');
294
281
  }
295
282
 
296
283
  const isDesktop = () => !getDevice().type; // TODO solve lint error:
@@ -460,7 +447,7 @@ const getDrmOptions = fallbackDrm => {
460
447
  * @typedef {{hls: string, dash: string}} SourceObjectAlt backward compatiable form
461
448
  *
462
449
  * @param {SourceObject[]|SourceObject|SourceObjectAlt|string} sourceOptions
463
- * @param {{preferManifestType?: ('dash'|'hls')}} options
450
+ * @param {{preferManifestType?: ('dash'|'hls'|'platform')}} options
464
451
  * @return {{src: string, type: string, drm: Object}}
465
452
  */
466
453
 
@@ -503,7 +490,8 @@ const getSource = (sourceOptions, {
503
490
  });
504
491
  }
505
492
 
506
- const matched = sourceOptions.find(source => !preferManifestType || matchType(source, preferManifestType));
493
+ const targetType = preferManifestType !== 'platform' ? preferManifestType : isSafari() ? 'hls' : 'dash';
494
+ const matched = sourceOptions.find(source => matchType(source, targetType));
507
495
  const selected = matched || sourceOptions[0];
508
496
 
509
497
  if (!selected) {
@@ -521,7 +509,7 @@ const getSource = (sourceOptions, {
521
509
  function getVersion() {
522
510
  try {
523
511
  // eslint-disable-next-line no-undef
524
- return "2.9.444";
512
+ return "2.25.0-canary.1";
525
513
  } catch (e) {
526
514
  return undefined;
527
515
  }
@@ -1505,7 +1493,7 @@ const createAnalytics = ({
1505
1493
  const logTarget = mapLogEvents({
1506
1494
  video,
1507
1495
  playerName: 'shaka',
1508
- version: "2.9.444"
1496
+ version: "2.25.0-canary.1"
1509
1497
  });
1510
1498
  logTarget.all((type, data) => {
1511
1499
  const payload = {