stormcloud-video-player 0.8.50 → 0.8.52

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.
@@ -436,6 +436,179 @@ var canPlay = {
436
436
  var import_react2 = require("react");
437
437
  // src/sdk/hlsAdPlayer.ts
438
438
  var import_hls = __toESM(require("hls.js"), 1);
439
+ // src/utils/browserCompat.ts
440
+ function getChromeVersion(ua) {
441
+ var match = ua.match(/Chrome\/(\d+)/);
442
+ return match && match[1] ? parseInt(match[1], 10) : 0;
443
+ }
444
+ function getWebKitVersion(ua) {
445
+ var match = ua.match(/AppleWebKit\/(\d+)/);
446
+ return match && match[1] ? parseInt(match[1], 10) : 0;
447
+ }
448
+ function getPlatform() {
449
+ var _navigator_userAgentData;
450
+ if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
451
+ return navigator.userAgentData.platform;
452
+ }
453
+ var ua = navigator.userAgent;
454
+ if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
455
+ return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
456
+ }
457
+ if (/Win/i.test(ua)) {
458
+ return "Win32";
459
+ }
460
+ if (/Linux/i.test(ua)) {
461
+ return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
462
+ }
463
+ if (/CrOS/i.test(ua)) {
464
+ return "CrOS";
465
+ }
466
+ return navigator.platform || "Unknown";
467
+ }
468
+ function detectBrowser() {
469
+ var ua = navigator.userAgent;
470
+ var platform = getPlatform();
471
+ var name = "Unknown";
472
+ var version = "0";
473
+ var majorVersion = 0;
474
+ var isSmartTV = false;
475
+ var isLegacyTV = false;
476
+ var supportsModernJS = true;
477
+ var webOSVersion;
478
+ var tizenVersion;
479
+ var chromeVersionNum;
480
+ var chromeVersion = getChromeVersion(ua);
481
+ var webkitVersion = getWebKitVersion(ua);
482
+ chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
483
+ if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
484
+ name = "LG WebOS";
485
+ isSmartTV = true;
486
+ var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
487
+ if (!match || !match[1]) {
488
+ match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
489
+ }
490
+ if (match && match[1]) {
491
+ version = match[1];
492
+ var parts = version.split(".");
493
+ majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
494
+ webOSVersion = majorVersion;
495
+ } else if (chromeVersion > 0) {
496
+ if (chromeVersion >= 79) {
497
+ webOSVersion = 6;
498
+ version = "6.0";
499
+ majorVersion = 6;
500
+ } else if (chromeVersion >= 68) {
501
+ webOSVersion = 5;
502
+ version = "5.0";
503
+ majorVersion = 5;
504
+ } else if (chromeVersion >= 53) {
505
+ webOSVersion = 4;
506
+ version = "4.0";
507
+ majorVersion = 4;
508
+ } else if (chromeVersion >= 38) {
509
+ webOSVersion = 3;
510
+ version = "3.0";
511
+ majorVersion = 3;
512
+ } else {
513
+ webOSVersion = 2;
514
+ version = "2.0";
515
+ majorVersion = 2;
516
+ }
517
+ } else {
518
+ version = "Unknown";
519
+ webOSVersion = void 0;
520
+ }
521
+ isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
522
+ } else if (/Tizen/i.test(ua)) {
523
+ name = "Samsung Tizen";
524
+ isSmartTV = true;
525
+ var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
526
+ version = match1 && match1[1] ? match1[1] : "Unknown";
527
+ if (version !== "Unknown") {
528
+ var parts1 = version.split(".");
529
+ majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
530
+ tizenVersion = majorVersion;
531
+ }
532
+ isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
533
+ } else if (/SMART-TV|SmartTV/i.test(ua)) {
534
+ name = "Smart TV";
535
+ isSmartTV = true;
536
+ isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
537
+ } else if (/NetCast/i.test(ua)) {
538
+ name = "LG NetCast";
539
+ isSmartTV = true;
540
+ isLegacyTV = true;
541
+ } else if (/BRAVIA/i.test(ua)) {
542
+ name = "Sony BRAVIA";
543
+ isSmartTV = true;
544
+ isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
545
+ } else {
546
+ if (chromeVersion > 0) {
547
+ name = "Chrome";
548
+ version = chromeVersion.toString();
549
+ majorVersion = chromeVersion;
550
+ if (chromeVersion < 50) {
551
+ supportsModernJS = false;
552
+ }
553
+ }
554
+ if (webkitVersion > 0 && webkitVersion < 600) {
555
+ supportsModernJS = false;
556
+ }
557
+ }
558
+ if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
559
+ supportsModernJS = false;
560
+ }
561
+ if (typeof URLSearchParams === "undefined") {
562
+ supportsModernJS = false;
563
+ }
564
+ return {
565
+ name: name,
566
+ version: version,
567
+ majorVersion: majorVersion,
568
+ isSmartTV: isSmartTV,
569
+ isLegacyTV: isLegacyTV,
570
+ platform: platform,
571
+ supportsModernJS: supportsModernJS,
572
+ webOSVersion: webOSVersion,
573
+ tizenVersion: tizenVersion,
574
+ chromeVersion: chromeVersionNum
575
+ };
576
+ }
577
+ function requiresMediaPipelineResetAfterAds() {
578
+ var _browser_tizenVersion;
579
+ var browser = detectBrowser();
580
+ return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
581
+ }
582
+ function getBrowserConfigOverrides() {
583
+ var browser = detectBrowser();
584
+ var overrides = {};
585
+ if (browser.isSmartTV) {
586
+ overrides.allowNativeHls = true;
587
+ overrides.pauseContentDuringAds = true;
588
+ }
589
+ return overrides;
590
+ }
591
+ function logBrowserInfo() {
592
+ var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
593
+ if (!debug) return;
594
+ var browser = detectBrowser();
595
+ console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
596
+ browser: "".concat(browser.name, " ").concat(browser.version),
597
+ platform: browser.platform,
598
+ isSmartTV: browser.isSmartTV,
599
+ isLegacyTV: browser.isLegacyTV,
600
+ supportsModernJS: browser.supportsModernJS
601
+ }, browser.webOSVersion !== void 0 ? {
602
+ webOSVersion: browser.webOSVersion
603
+ } : {}, browser.tizenVersion !== void 0 ? {
604
+ tizenVersion: browser.tizenVersion
605
+ } : {}, browser.chromeVersion !== void 0 ? {
606
+ chromeVersion: browser.chromeVersion
607
+ } : {}), {
608
+ userAgent: navigator.userAgent
609
+ }));
610
+ }
611
+ // src/sdk/hlsAdPlayer.ts
439
612
  var MAX_VAST_WRAPPER_DEPTH = 5;
440
613
  function createHlsAdPlayer(contentVideo, options) {
441
614
  var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
@@ -448,6 +621,7 @@ function createHlsAdPlayer(contentVideo, options) {
448
621
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
449
622
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
450
623
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
624
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
451
625
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
452
626
  var adHls;
453
627
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -468,6 +642,7 @@ function createHlsAdPlayer(contentVideo, options) {
468
642
  var lastAdProgressPosition = 0;
469
643
  var sawDecodedVideoFrame = false;
470
644
  var videoFrameCallbackHandle;
645
+ var pendingPlayPromise;
471
646
  var trackingFired = {
472
647
  impression: false,
473
648
  start: false,
@@ -1271,6 +1446,60 @@ function createHlsAdPlayer(contentVideo, options) {
1271
1446
  complete: false
1272
1447
  };
1273
1448
  }
1449
+ function isRvfcSupported(video) {
1450
+ return typeof video.requestVideoFrameCallback === "function";
1451
+ }
1452
+ function settlePendingPlay() {
1453
+ pendingPlayPromise = void 0;
1454
+ }
1455
+ function startAdPlayback(context) {
1456
+ if (!adVideoElement) return;
1457
+ var playPromise = adVideoElement.play();
1458
+ pendingPlayPromise = playPromise;
1459
+ playPromise.catch(function(error) {
1460
+ if (pendingPlayPromise !== playPromise) {
1461
+ return;
1462
+ }
1463
+ console.error("[HlsAdPlayer] Error starting ".concat(context, ":"), error);
1464
+ handleAdError();
1465
+ }).finally(function() {
1466
+ if (pendingPlayPromise === playPromise) {
1467
+ pendingPlayPromise = void 0;
1468
+ }
1469
+ });
1470
+ }
1471
+ function prepareVideoElementForNewSource() {
1472
+ settlePendingPlay();
1473
+ if (adHls) {
1474
+ adHls.destroy();
1475
+ adHls = void 0;
1476
+ }
1477
+ if (!adVideoElement) return;
1478
+ try {
1479
+ adVideoElement.pause();
1480
+ adVideoElement.removeAttribute("src");
1481
+ adVideoElement.load();
1482
+ } catch (error) {
1483
+ console.warn("[HlsAdPlayer] Error preparing ad video for new source:", error);
1484
+ }
1485
+ }
1486
+ function recreateAdVideoElement() {
1487
+ console.log("[HlsAdPlayer] Recreating ad video element (single-decoder platform)");
1488
+ teardownAdEventListeners();
1489
+ prepareVideoElementForNewSource();
1490
+ if (adVideoElement) {
1491
+ try {
1492
+ adVideoElement.remove();
1493
+ } catch (error) {
1494
+ console.warn("[HlsAdPlayer] Error removing ad video element:", error);
1495
+ }
1496
+ }
1497
+ adVideoElement = createAdVideoElement();
1498
+ adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.appendChild(adVideoElement);
1499
+ contentVideo[AD_VIDEO_PROP] = adVideoElement;
1500
+ adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
1501
+ adVideoElement.muted = originalMutedState;
1502
+ }
1274
1503
  function loadCurrentAdMedia() {
1275
1504
  if (!adVideoElement || !currentAd) {
1276
1505
  throw new Error("No ad video element or ad to load");
@@ -1293,10 +1522,7 @@ function createHlsAdPlayer(contentVideo, options) {
1293
1522
  adHls.attachMedia(adVideoElement);
1294
1523
  adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
1295
1524
  console.log("[HlsAdPlayer] HLS manifest parsed, starting playback");
1296
- adVideoElement.play().catch(function(error) {
1297
- console.error("[HlsAdPlayer] Error starting ad playback:", error);
1298
- handleAdError();
1299
- });
1525
+ startAdPlayback("HLS ad playback");
1300
1526
  });
1301
1527
  adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
1302
1528
  console.error("[HlsAdPlayer] HLS error:", data);
@@ -1306,10 +1532,7 @@ function createHlsAdPlayer(contentVideo, options) {
1306
1532
  });
1307
1533
  } else if (isHlsAd && adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
1308
1534
  adVideoElement.src = mediaFile.url;
1309
- adVideoElement.play().catch(function(error) {
1310
- console.error("[HlsAdPlayer] Error starting ad playback:", error);
1311
- handleAdError();
1312
- });
1535
+ startAdPlayback("native HLS ad playback");
1313
1536
  } else if (!isHlsAd && isProgressiveMediaFile(mediaFile)) {
1314
1537
  if (adHls) {
1315
1538
  adHls.destroy();
@@ -1317,10 +1540,7 @@ function createHlsAdPlayer(contentVideo, options) {
1317
1540
  }
1318
1541
  adVideoElement.src = mediaFile.url;
1319
1542
  adVideoElement.load();
1320
- adVideoElement.play().catch(function(error) {
1321
- console.error("[HlsAdPlayer] Error starting progressive ad playback:", error);
1322
- handleAdError();
1323
- });
1543
+ startAdPlayback("progressive ad playback");
1324
1544
  } else {
1325
1545
  throw new Error("Unsupported ad media file type: ".concat(mediaFile.type));
1326
1546
  }
@@ -1337,6 +1557,13 @@ function createHlsAdPlayer(contentVideo, options) {
1337
1557
  trackingFired.impression = true;
1338
1558
  console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
1339
1559
  }
1560
+ clearStallWatchdog();
1561
+ if (requiresMediaPipelineResetAfterAds()) {
1562
+ recreateAdVideoElement();
1563
+ setupAdEventListeners();
1564
+ } else {
1565
+ prepareVideoElementForNewSource();
1566
+ }
1340
1567
  try {
1341
1568
  loadCurrentAdMedia();
1342
1569
  emit("pod_ad_started", {
@@ -1396,6 +1623,12 @@ function createHlsAdPlayer(contentVideo, options) {
1396
1623
  function markFrameCounterReliable() {
1397
1624
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1398
1625
  }
1626
+ function isRvfcReliable() {
1627
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1628
+ }
1629
+ function markRvfcReliable() {
1630
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1631
+ }
1399
1632
  function cancelVideoFrameProbe() {
1400
1633
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1401
1634
  try {
@@ -1415,6 +1648,7 @@ function createHlsAdPlayer(contentVideo, options) {
1415
1648
  videoFrameCallbackHandle = void 0;
1416
1649
  if (!adPlaying) return;
1417
1650
  sawDecodedVideoFrame = true;
1651
+ markRvfcReliable();
1418
1652
  };
1419
1653
  try {
1420
1654
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1439,18 +1673,26 @@ function createHlsAdPlayer(contentVideo, options) {
1439
1673
  noteAdProgress();
1440
1674
  sawDecodedVideoFrame = false;
1441
1675
  startVideoFrameProbe();
1676
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1442
1677
  stallWatchdogId = window.setInterval(function() {
1443
1678
  if (!adPlaying || !adVideoElement) {
1444
1679
  return;
1445
1680
  }
1446
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1681
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1447
1682
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1448
1683
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1449
1684
  sawDecodedVideoFrame = true;
1450
1685
  markFrameCounterReliable();
1451
- } else if (decodedFrames === 0 && adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S && isFrameCounterReliable()) {
1452
- handleVideoDecodeFailure();
1453
- return;
1686
+ } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1687
+ var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1688
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1689
+ handleVideoDecodeFailure();
1690
+ return;
1691
+ }
1692
+ if (decodedFrames === 0 && timeAdvancing && isFrameCounterReliable()) {
1693
+ handleVideoDecodeFailure();
1694
+ return;
1695
+ }
1454
1696
  }
1455
1697
  }
1456
1698
  if (adVideoElement.currentTime > lastAdProgressPosition + 0.05) {
@@ -1467,19 +1709,7 @@ function createHlsAdPlayer(contentVideo, options) {
1467
1709
  }, STALL_CHECK_INTERVAL_MS);
1468
1710
  }
1469
1711
  function releaseAdDecoder() {
1470
- if (adHls) {
1471
- adHls.destroy();
1472
- adHls = void 0;
1473
- }
1474
- if (adVideoElement) {
1475
- try {
1476
- adVideoElement.pause();
1477
- adVideoElement.removeAttribute("src");
1478
- adVideoElement.load();
1479
- } catch (error) {
1480
- console.warn("[HlsAdPlayer] Error releasing ad decoder:", error);
1481
- }
1482
- }
1712
+ prepareVideoElementForNewSource();
1483
1713
  if (adContainerEl) {
1484
1714
  adContainerEl.style.display = "none";
1485
1715
  adContainerEl.style.pointerEvents = "none";
@@ -1856,7 +2086,7 @@ function createHlsAdPlayer(contentVideo, options) {
1856
2086
  }
1857
2087
  },
1858
2088
  hidePlaceholder: function hidePlaceholder() {
1859
- if (adContainerEl) {
2089
+ if (adContainerEl && !adPlaying) {
1860
2090
  adContainerEl.style.display = "none";
1861
2091
  adContainerEl.style.pointerEvents = "none";
1862
2092
  }
@@ -4050,178 +4280,6 @@ function fetchConsentSignals() {
4050
4280
  return signals;
4051
4281
  });
4052
4282
  }
4053
- // src/utils/browserCompat.ts
4054
- function getChromeVersion(ua) {
4055
- var match = ua.match(/Chrome\/(\d+)/);
4056
- return match && match[1] ? parseInt(match[1], 10) : 0;
4057
- }
4058
- function getWebKitVersion(ua) {
4059
- var match = ua.match(/AppleWebKit\/(\d+)/);
4060
- return match && match[1] ? parseInt(match[1], 10) : 0;
4061
- }
4062
- function getPlatform() {
4063
- var _navigator_userAgentData;
4064
- if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
4065
- return navigator.userAgentData.platform;
4066
- }
4067
- var ua = navigator.userAgent;
4068
- if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
4069
- return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
4070
- }
4071
- if (/Win/i.test(ua)) {
4072
- return "Win32";
4073
- }
4074
- if (/Linux/i.test(ua)) {
4075
- return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
4076
- }
4077
- if (/CrOS/i.test(ua)) {
4078
- return "CrOS";
4079
- }
4080
- return navigator.platform || "Unknown";
4081
- }
4082
- function detectBrowser() {
4083
- var ua = navigator.userAgent;
4084
- var platform = getPlatform();
4085
- var name = "Unknown";
4086
- var version = "0";
4087
- var majorVersion = 0;
4088
- var isSmartTV = false;
4089
- var isLegacyTV = false;
4090
- var supportsModernJS = true;
4091
- var webOSVersion;
4092
- var tizenVersion;
4093
- var chromeVersionNum;
4094
- var chromeVersion = getChromeVersion(ua);
4095
- var webkitVersion = getWebKitVersion(ua);
4096
- chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
4097
- if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
4098
- name = "LG WebOS";
4099
- isSmartTV = true;
4100
- var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
4101
- if (!match || !match[1]) {
4102
- match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
4103
- }
4104
- if (match && match[1]) {
4105
- version = match[1];
4106
- var parts = version.split(".");
4107
- majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
4108
- webOSVersion = majorVersion;
4109
- } else if (chromeVersion > 0) {
4110
- if (chromeVersion >= 79) {
4111
- webOSVersion = 6;
4112
- version = "6.0";
4113
- majorVersion = 6;
4114
- } else if (chromeVersion >= 68) {
4115
- webOSVersion = 5;
4116
- version = "5.0";
4117
- majorVersion = 5;
4118
- } else if (chromeVersion >= 53) {
4119
- webOSVersion = 4;
4120
- version = "4.0";
4121
- majorVersion = 4;
4122
- } else if (chromeVersion >= 38) {
4123
- webOSVersion = 3;
4124
- version = "3.0";
4125
- majorVersion = 3;
4126
- } else {
4127
- webOSVersion = 2;
4128
- version = "2.0";
4129
- majorVersion = 2;
4130
- }
4131
- } else {
4132
- version = "Unknown";
4133
- webOSVersion = void 0;
4134
- }
4135
- isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
4136
- } else if (/Tizen/i.test(ua)) {
4137
- name = "Samsung Tizen";
4138
- isSmartTV = true;
4139
- var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
4140
- version = match1 && match1[1] ? match1[1] : "Unknown";
4141
- if (version !== "Unknown") {
4142
- var parts1 = version.split(".");
4143
- majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
4144
- tizenVersion = majorVersion;
4145
- }
4146
- isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
4147
- } else if (/SMART-TV|SmartTV/i.test(ua)) {
4148
- name = "Smart TV";
4149
- isSmartTV = true;
4150
- isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
4151
- } else if (/NetCast/i.test(ua)) {
4152
- name = "LG NetCast";
4153
- isSmartTV = true;
4154
- isLegacyTV = true;
4155
- } else if (/BRAVIA/i.test(ua)) {
4156
- name = "Sony BRAVIA";
4157
- isSmartTV = true;
4158
- isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
4159
- } else {
4160
- if (chromeVersion > 0) {
4161
- name = "Chrome";
4162
- version = chromeVersion.toString();
4163
- majorVersion = chromeVersion;
4164
- if (chromeVersion < 50) {
4165
- supportsModernJS = false;
4166
- }
4167
- }
4168
- if (webkitVersion > 0 && webkitVersion < 600) {
4169
- supportsModernJS = false;
4170
- }
4171
- }
4172
- if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
4173
- supportsModernJS = false;
4174
- }
4175
- if (typeof URLSearchParams === "undefined") {
4176
- supportsModernJS = false;
4177
- }
4178
- return {
4179
- name: name,
4180
- version: version,
4181
- majorVersion: majorVersion,
4182
- isSmartTV: isSmartTV,
4183
- isLegacyTV: isLegacyTV,
4184
- platform: platform,
4185
- supportsModernJS: supportsModernJS,
4186
- webOSVersion: webOSVersion,
4187
- tizenVersion: tizenVersion,
4188
- chromeVersion: chromeVersionNum
4189
- };
4190
- }
4191
- function requiresMediaPipelineResetAfterAds() {
4192
- var _browser_tizenVersion;
4193
- var browser = detectBrowser();
4194
- return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
4195
- }
4196
- function getBrowserConfigOverrides() {
4197
- var browser = detectBrowser();
4198
- var overrides = {};
4199
- if (browser.isSmartTV) {
4200
- overrides.allowNativeHls = true;
4201
- overrides.pauseContentDuringAds = true;
4202
- }
4203
- return overrides;
4204
- }
4205
- function logBrowserInfo() {
4206
- var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
4207
- if (!debug) return;
4208
- var browser = detectBrowser();
4209
- console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
4210
- browser: "".concat(browser.name, " ").concat(browser.version),
4211
- platform: browser.platform,
4212
- isSmartTV: browser.isSmartTV,
4213
- isLegacyTV: browser.isLegacyTV,
4214
- supportsModernJS: browser.supportsModernJS
4215
- }, browser.webOSVersion !== void 0 ? {
4216
- webOSVersion: browser.webOSVersion
4217
- } : {}, browser.tizenVersion !== void 0 ? {
4218
- tizenVersion: browser.tizenVersion
4219
- } : {}, browser.chromeVersion !== void 0 ? {
4220
- chromeVersion: browser.chromeVersion
4221
- } : {}), {
4222
- userAgent: navigator.userAgent
4223
- }));
4224
- }
4225
4283
  // src/player/Scte35Parser.ts
4226
4284
  function parseCueOutDuration(value) {
4227
4285
  var num = parseFloat(value.trim());