@kkcompany/player 2.25.0-canary.0 → 2.25.0-canary.2

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
@@ -265,15 +265,15 @@ function getDevice() {
265
265
  function getBrowser() {
266
266
  return parser.getBrowser();
267
267
  }
268
+
269
+ const isSafari = () => /^((?!chrome|android|X11|Linux).)*(safari|iPad|iPhone|Version)/i.test(navigator.userAgent);
270
+
268
271
  function needNativeHls() {
269
272
  // Don't let Android phones play HLS, even if some of them report supported
270
273
  // This covers Samsung & OPPO special cases
271
- const isAndroid = /android|X11|Linux/i.test(navigator.userAgent); // canPlayType isn't reliable across all iOS verion / device combinations, so also check user agent
272
-
273
- const isSafari = /^((?!chrome|android|X11|Linux).)*(safari|iPad|iPhone|Version)/i.test(navigator.userAgent); // ref: https://stackoverflow.com/a/12905122/4578017
274
- // none of our supported browsers other than Safari response to this
275
-
276
- return isAndroid || /firefox/i.test(navigator.userAgent) ? '' : isSafari ? 'maybe' : document.createElement('video').canPlayType('application/vnd.apple.mpegURL');
274
+ const isAndroid = /android|X11|Linux/i.test(navigator.userAgent);
275
+ return isAndroid || /firefox/i.test(navigator.userAgent) ? '' : // canPlayType isn't reliable across all iOS verion / device combinations, so also check user agent
276
+ isSafari() ? 'maybe' : document.createElement('video').canPlayType('application/vnd.apple.mpegURL');
277
277
  }
278
278
 
279
279
  const isDesktop = () => !getDevice().type; // TODO solve lint error:
@@ -443,7 +443,7 @@ const getDrmOptions = fallbackDrm => {
443
443
  * @typedef {{hls: string, dash: string}} SourceObjectAlt backward compatiable form
444
444
  *
445
445
  * @param {SourceObject[]|SourceObject|SourceObjectAlt|string} sourceOptions
446
- * @param {{preferManifestType?: ('dash'|'hls')}} options
446
+ * @param {{preferManifestType?: ('dash'|'hls'|'platform')}} options
447
447
  * @return {{src: string, type: string, drm: Object}}
448
448
  */
449
449
 
@@ -486,7 +486,8 @@ const getSource = (sourceOptions, {
486
486
  });
487
487
  }
488
488
 
489
- const matched = sourceOptions.find(source => !preferManifestType || matchType(source, preferManifestType));
489
+ const targetType = preferManifestType !== 'platform' ? preferManifestType : isSafari() ? 'hls' : 'dash';
490
+ const matched = sourceOptions.find(source => matchType(source, targetType));
490
491
  const selected = matched || sourceOptions[0];
491
492
 
492
493
  if (!selected) {
@@ -504,7 +505,7 @@ const getSource = (sourceOptions, {
504
505
  function getVersion() {
505
506
  try {
506
507
  // eslint-disable-next-line no-undef
507
- return "2.25.0-canary.0";
508
+ return "2.25.0-canary.2";
508
509
  } catch (e) {
509
510
  return undefined;
510
511
  }
@@ -1502,7 +1503,7 @@ const createAnalytics = ({
1502
1503
  const logTarget = mapLogEvents({
1503
1504
  video,
1504
1505
  playerName: 'shaka',
1505
- version: "2.25.0-canary.0"
1506
+ version: "2.25.0-canary.2"
1506
1507
  });
1507
1508
  logTarget.all((type, data) => {
1508
1509
  const payload = {