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.
@@ -400,6 +400,179 @@ module.exports = __toCommonJS(HlsPlayer_exports);
400
400
  var import_react = require("react");
401
401
  // src/sdk/hlsAdPlayer.ts
402
402
  var import_hls = __toESM(require("hls.js"), 1);
403
+ // src/utils/browserCompat.ts
404
+ function getChromeVersion(ua) {
405
+ var match = ua.match(/Chrome\/(\d+)/);
406
+ return match && match[1] ? parseInt(match[1], 10) : 0;
407
+ }
408
+ function getWebKitVersion(ua) {
409
+ var match = ua.match(/AppleWebKit\/(\d+)/);
410
+ return match && match[1] ? parseInt(match[1], 10) : 0;
411
+ }
412
+ function getPlatform() {
413
+ var _navigator_userAgentData;
414
+ if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
415
+ return navigator.userAgentData.platform;
416
+ }
417
+ var ua = navigator.userAgent;
418
+ if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
419
+ return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
420
+ }
421
+ if (/Win/i.test(ua)) {
422
+ return "Win32";
423
+ }
424
+ if (/Linux/i.test(ua)) {
425
+ return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
426
+ }
427
+ if (/CrOS/i.test(ua)) {
428
+ return "CrOS";
429
+ }
430
+ return navigator.platform || "Unknown";
431
+ }
432
+ function detectBrowser() {
433
+ var ua = navigator.userAgent;
434
+ var platform = getPlatform();
435
+ var name = "Unknown";
436
+ var version = "0";
437
+ var majorVersion = 0;
438
+ var isSmartTV = false;
439
+ var isLegacyTV = false;
440
+ var supportsModernJS = true;
441
+ var webOSVersion;
442
+ var tizenVersion;
443
+ var chromeVersionNum;
444
+ var chromeVersion = getChromeVersion(ua);
445
+ var webkitVersion = getWebKitVersion(ua);
446
+ chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
447
+ if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
448
+ name = "LG WebOS";
449
+ isSmartTV = true;
450
+ var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
451
+ if (!match || !match[1]) {
452
+ match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
453
+ }
454
+ if (match && match[1]) {
455
+ version = match[1];
456
+ var parts = version.split(".");
457
+ majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
458
+ webOSVersion = majorVersion;
459
+ } else if (chromeVersion > 0) {
460
+ if (chromeVersion >= 79) {
461
+ webOSVersion = 6;
462
+ version = "6.0";
463
+ majorVersion = 6;
464
+ } else if (chromeVersion >= 68) {
465
+ webOSVersion = 5;
466
+ version = "5.0";
467
+ majorVersion = 5;
468
+ } else if (chromeVersion >= 53) {
469
+ webOSVersion = 4;
470
+ version = "4.0";
471
+ majorVersion = 4;
472
+ } else if (chromeVersion >= 38) {
473
+ webOSVersion = 3;
474
+ version = "3.0";
475
+ majorVersion = 3;
476
+ } else {
477
+ webOSVersion = 2;
478
+ version = "2.0";
479
+ majorVersion = 2;
480
+ }
481
+ } else {
482
+ version = "Unknown";
483
+ webOSVersion = void 0;
484
+ }
485
+ isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
486
+ } else if (/Tizen/i.test(ua)) {
487
+ name = "Samsung Tizen";
488
+ isSmartTV = true;
489
+ var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
490
+ version = match1 && match1[1] ? match1[1] : "Unknown";
491
+ if (version !== "Unknown") {
492
+ var parts1 = version.split(".");
493
+ majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
494
+ tizenVersion = majorVersion;
495
+ }
496
+ isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
497
+ } else if (/SMART-TV|SmartTV/i.test(ua)) {
498
+ name = "Smart TV";
499
+ isSmartTV = true;
500
+ isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
501
+ } else if (/NetCast/i.test(ua)) {
502
+ name = "LG NetCast";
503
+ isSmartTV = true;
504
+ isLegacyTV = true;
505
+ } else if (/BRAVIA/i.test(ua)) {
506
+ name = "Sony BRAVIA";
507
+ isSmartTV = true;
508
+ isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
509
+ } else {
510
+ if (chromeVersion > 0) {
511
+ name = "Chrome";
512
+ version = chromeVersion.toString();
513
+ majorVersion = chromeVersion;
514
+ if (chromeVersion < 50) {
515
+ supportsModernJS = false;
516
+ }
517
+ }
518
+ if (webkitVersion > 0 && webkitVersion < 600) {
519
+ supportsModernJS = false;
520
+ }
521
+ }
522
+ if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
523
+ supportsModernJS = false;
524
+ }
525
+ if (typeof URLSearchParams === "undefined") {
526
+ supportsModernJS = false;
527
+ }
528
+ return {
529
+ name: name,
530
+ version: version,
531
+ majorVersion: majorVersion,
532
+ isSmartTV: isSmartTV,
533
+ isLegacyTV: isLegacyTV,
534
+ platform: platform,
535
+ supportsModernJS: supportsModernJS,
536
+ webOSVersion: webOSVersion,
537
+ tizenVersion: tizenVersion,
538
+ chromeVersion: chromeVersionNum
539
+ };
540
+ }
541
+ function requiresMediaPipelineResetAfterAds() {
542
+ var _browser_tizenVersion;
543
+ var browser = detectBrowser();
544
+ return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
545
+ }
546
+ function getBrowserConfigOverrides() {
547
+ var browser = detectBrowser();
548
+ var overrides = {};
549
+ if (browser.isSmartTV) {
550
+ overrides.allowNativeHls = true;
551
+ overrides.pauseContentDuringAds = true;
552
+ }
553
+ return overrides;
554
+ }
555
+ function logBrowserInfo() {
556
+ var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
557
+ if (!debug) return;
558
+ var browser = detectBrowser();
559
+ console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
560
+ browser: "".concat(browser.name, " ").concat(browser.version),
561
+ platform: browser.platform,
562
+ isSmartTV: browser.isSmartTV,
563
+ isLegacyTV: browser.isLegacyTV,
564
+ supportsModernJS: browser.supportsModernJS
565
+ }, browser.webOSVersion !== void 0 ? {
566
+ webOSVersion: browser.webOSVersion
567
+ } : {}, browser.tizenVersion !== void 0 ? {
568
+ tizenVersion: browser.tizenVersion
569
+ } : {}, browser.chromeVersion !== void 0 ? {
570
+ chromeVersion: browser.chromeVersion
571
+ } : {}), {
572
+ userAgent: navigator.userAgent
573
+ }));
574
+ }
575
+ // src/sdk/hlsAdPlayer.ts
403
576
  var MAX_VAST_WRAPPER_DEPTH = 5;
404
577
  function createHlsAdPlayer(contentVideo, options) {
405
578
  var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
@@ -412,6 +585,7 @@ function createHlsAdPlayer(contentVideo, options) {
412
585
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
413
586
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
414
587
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
588
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
415
589
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
416
590
  var adHls;
417
591
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -432,6 +606,7 @@ function createHlsAdPlayer(contentVideo, options) {
432
606
  var lastAdProgressPosition = 0;
433
607
  var sawDecodedVideoFrame = false;
434
608
  var videoFrameCallbackHandle;
609
+ var pendingPlayPromise;
435
610
  var trackingFired = {
436
611
  impression: false,
437
612
  start: false,
@@ -1235,6 +1410,60 @@ function createHlsAdPlayer(contentVideo, options) {
1235
1410
  complete: false
1236
1411
  };
1237
1412
  }
1413
+ function isRvfcSupported(video) {
1414
+ return typeof video.requestVideoFrameCallback === "function";
1415
+ }
1416
+ function settlePendingPlay() {
1417
+ pendingPlayPromise = void 0;
1418
+ }
1419
+ function startAdPlayback(context) {
1420
+ if (!adVideoElement) return;
1421
+ var playPromise = adVideoElement.play();
1422
+ pendingPlayPromise = playPromise;
1423
+ playPromise.catch(function(error) {
1424
+ if (pendingPlayPromise !== playPromise) {
1425
+ return;
1426
+ }
1427
+ console.error("[HlsAdPlayer] Error starting ".concat(context, ":"), error);
1428
+ handleAdError();
1429
+ }).finally(function() {
1430
+ if (pendingPlayPromise === playPromise) {
1431
+ pendingPlayPromise = void 0;
1432
+ }
1433
+ });
1434
+ }
1435
+ function prepareVideoElementForNewSource() {
1436
+ settlePendingPlay();
1437
+ if (adHls) {
1438
+ adHls.destroy();
1439
+ adHls = void 0;
1440
+ }
1441
+ if (!adVideoElement) return;
1442
+ try {
1443
+ adVideoElement.pause();
1444
+ adVideoElement.removeAttribute("src");
1445
+ adVideoElement.load();
1446
+ } catch (error) {
1447
+ console.warn("[HlsAdPlayer] Error preparing ad video for new source:", error);
1448
+ }
1449
+ }
1450
+ function recreateAdVideoElement() {
1451
+ console.log("[HlsAdPlayer] Recreating ad video element (single-decoder platform)");
1452
+ teardownAdEventListeners();
1453
+ prepareVideoElementForNewSource();
1454
+ if (adVideoElement) {
1455
+ try {
1456
+ adVideoElement.remove();
1457
+ } catch (error) {
1458
+ console.warn("[HlsAdPlayer] Error removing ad video element:", error);
1459
+ }
1460
+ }
1461
+ adVideoElement = createAdVideoElement();
1462
+ adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.appendChild(adVideoElement);
1463
+ contentVideo[AD_VIDEO_PROP] = adVideoElement;
1464
+ adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
1465
+ adVideoElement.muted = originalMutedState;
1466
+ }
1238
1467
  function loadCurrentAdMedia() {
1239
1468
  if (!adVideoElement || !currentAd) {
1240
1469
  throw new Error("No ad video element or ad to load");
@@ -1257,10 +1486,7 @@ function createHlsAdPlayer(contentVideo, options) {
1257
1486
  adHls.attachMedia(adVideoElement);
1258
1487
  adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
1259
1488
  console.log("[HlsAdPlayer] HLS manifest parsed, starting playback");
1260
- adVideoElement.play().catch(function(error) {
1261
- console.error("[HlsAdPlayer] Error starting ad playback:", error);
1262
- handleAdError();
1263
- });
1489
+ startAdPlayback("HLS ad playback");
1264
1490
  });
1265
1491
  adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
1266
1492
  console.error("[HlsAdPlayer] HLS error:", data);
@@ -1270,10 +1496,7 @@ function createHlsAdPlayer(contentVideo, options) {
1270
1496
  });
1271
1497
  } else if (isHlsAd && adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
1272
1498
  adVideoElement.src = mediaFile.url;
1273
- adVideoElement.play().catch(function(error) {
1274
- console.error("[HlsAdPlayer] Error starting ad playback:", error);
1275
- handleAdError();
1276
- });
1499
+ startAdPlayback("native HLS ad playback");
1277
1500
  } else if (!isHlsAd && isProgressiveMediaFile(mediaFile)) {
1278
1501
  if (adHls) {
1279
1502
  adHls.destroy();
@@ -1281,10 +1504,7 @@ function createHlsAdPlayer(contentVideo, options) {
1281
1504
  }
1282
1505
  adVideoElement.src = mediaFile.url;
1283
1506
  adVideoElement.load();
1284
- adVideoElement.play().catch(function(error) {
1285
- console.error("[HlsAdPlayer] Error starting progressive ad playback:", error);
1286
- handleAdError();
1287
- });
1507
+ startAdPlayback("progressive ad playback");
1288
1508
  } else {
1289
1509
  throw new Error("Unsupported ad media file type: ".concat(mediaFile.type));
1290
1510
  }
@@ -1301,6 +1521,13 @@ function createHlsAdPlayer(contentVideo, options) {
1301
1521
  trackingFired.impression = true;
1302
1522
  console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
1303
1523
  }
1524
+ clearStallWatchdog();
1525
+ if (requiresMediaPipelineResetAfterAds()) {
1526
+ recreateAdVideoElement();
1527
+ setupAdEventListeners();
1528
+ } else {
1529
+ prepareVideoElementForNewSource();
1530
+ }
1304
1531
  try {
1305
1532
  loadCurrentAdMedia();
1306
1533
  emit("pod_ad_started", {
@@ -1360,6 +1587,12 @@ function createHlsAdPlayer(contentVideo, options) {
1360
1587
  function markFrameCounterReliable() {
1361
1588
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1362
1589
  }
1590
+ function isRvfcReliable() {
1591
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1592
+ }
1593
+ function markRvfcReliable() {
1594
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1595
+ }
1363
1596
  function cancelVideoFrameProbe() {
1364
1597
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1365
1598
  try {
@@ -1379,6 +1612,7 @@ function createHlsAdPlayer(contentVideo, options) {
1379
1612
  videoFrameCallbackHandle = void 0;
1380
1613
  if (!adPlaying) return;
1381
1614
  sawDecodedVideoFrame = true;
1615
+ markRvfcReliable();
1382
1616
  };
1383
1617
  try {
1384
1618
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1403,18 +1637,26 @@ function createHlsAdPlayer(contentVideo, options) {
1403
1637
  noteAdProgress();
1404
1638
  sawDecodedVideoFrame = false;
1405
1639
  startVideoFrameProbe();
1640
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1406
1641
  stallWatchdogId = window.setInterval(function() {
1407
1642
  if (!adPlaying || !adVideoElement) {
1408
1643
  return;
1409
1644
  }
1410
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1645
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1411
1646
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1412
1647
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1413
1648
  sawDecodedVideoFrame = true;
1414
1649
  markFrameCounterReliable();
1415
- } else if (decodedFrames === 0 && adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S && isFrameCounterReliable()) {
1416
- handleVideoDecodeFailure();
1417
- return;
1650
+ } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1651
+ var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1652
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1653
+ handleVideoDecodeFailure();
1654
+ return;
1655
+ }
1656
+ if (decodedFrames === 0 && timeAdvancing && isFrameCounterReliable()) {
1657
+ handleVideoDecodeFailure();
1658
+ return;
1659
+ }
1418
1660
  }
1419
1661
  }
1420
1662
  if (adVideoElement.currentTime > lastAdProgressPosition + 0.05) {
@@ -1431,19 +1673,7 @@ function createHlsAdPlayer(contentVideo, options) {
1431
1673
  }, STALL_CHECK_INTERVAL_MS);
1432
1674
  }
1433
1675
  function releaseAdDecoder() {
1434
- if (adHls) {
1435
- adHls.destroy();
1436
- adHls = void 0;
1437
- }
1438
- if (adVideoElement) {
1439
- try {
1440
- adVideoElement.pause();
1441
- adVideoElement.removeAttribute("src");
1442
- adVideoElement.load();
1443
- } catch (error) {
1444
- console.warn("[HlsAdPlayer] Error releasing ad decoder:", error);
1445
- }
1446
- }
1676
+ prepareVideoElementForNewSource();
1447
1677
  if (adContainerEl) {
1448
1678
  adContainerEl.style.display = "none";
1449
1679
  adContainerEl.style.pointerEvents = "none";
@@ -1820,7 +2050,7 @@ function createHlsAdPlayer(contentVideo, options) {
1820
2050
  }
1821
2051
  },
1822
2052
  hidePlaceholder: function hidePlaceholder() {
1823
- if (adContainerEl) {
2053
+ if (adContainerEl && !adPlaying) {
1824
2054
  adContainerEl.style.display = "none";
1825
2055
  adContainerEl.style.pointerEvents = "none";
1826
2056
  }
@@ -4014,178 +4244,6 @@ function fetchConsentSignals() {
4014
4244
  return signals;
4015
4245
  });
4016
4246
  }
4017
- // src/utils/browserCompat.ts
4018
- function getChromeVersion(ua) {
4019
- var match = ua.match(/Chrome\/(\d+)/);
4020
- return match && match[1] ? parseInt(match[1], 10) : 0;
4021
- }
4022
- function getWebKitVersion(ua) {
4023
- var match = ua.match(/AppleWebKit\/(\d+)/);
4024
- return match && match[1] ? parseInt(match[1], 10) : 0;
4025
- }
4026
- function getPlatform() {
4027
- var _navigator_userAgentData;
4028
- if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
4029
- return navigator.userAgentData.platform;
4030
- }
4031
- var ua = navigator.userAgent;
4032
- if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
4033
- return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
4034
- }
4035
- if (/Win/i.test(ua)) {
4036
- return "Win32";
4037
- }
4038
- if (/Linux/i.test(ua)) {
4039
- return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
4040
- }
4041
- if (/CrOS/i.test(ua)) {
4042
- return "CrOS";
4043
- }
4044
- return navigator.platform || "Unknown";
4045
- }
4046
- function detectBrowser() {
4047
- var ua = navigator.userAgent;
4048
- var platform = getPlatform();
4049
- var name = "Unknown";
4050
- var version = "0";
4051
- var majorVersion = 0;
4052
- var isSmartTV = false;
4053
- var isLegacyTV = false;
4054
- var supportsModernJS = true;
4055
- var webOSVersion;
4056
- var tizenVersion;
4057
- var chromeVersionNum;
4058
- var chromeVersion = getChromeVersion(ua);
4059
- var webkitVersion = getWebKitVersion(ua);
4060
- chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
4061
- if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
4062
- name = "LG WebOS";
4063
- isSmartTV = true;
4064
- var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
4065
- if (!match || !match[1]) {
4066
- match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
4067
- }
4068
- if (match && match[1]) {
4069
- version = match[1];
4070
- var parts = version.split(".");
4071
- majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
4072
- webOSVersion = majorVersion;
4073
- } else if (chromeVersion > 0) {
4074
- if (chromeVersion >= 79) {
4075
- webOSVersion = 6;
4076
- version = "6.0";
4077
- majorVersion = 6;
4078
- } else if (chromeVersion >= 68) {
4079
- webOSVersion = 5;
4080
- version = "5.0";
4081
- majorVersion = 5;
4082
- } else if (chromeVersion >= 53) {
4083
- webOSVersion = 4;
4084
- version = "4.0";
4085
- majorVersion = 4;
4086
- } else if (chromeVersion >= 38) {
4087
- webOSVersion = 3;
4088
- version = "3.0";
4089
- majorVersion = 3;
4090
- } else {
4091
- webOSVersion = 2;
4092
- version = "2.0";
4093
- majorVersion = 2;
4094
- }
4095
- } else {
4096
- version = "Unknown";
4097
- webOSVersion = void 0;
4098
- }
4099
- isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
4100
- } else if (/Tizen/i.test(ua)) {
4101
- name = "Samsung Tizen";
4102
- isSmartTV = true;
4103
- var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
4104
- version = match1 && match1[1] ? match1[1] : "Unknown";
4105
- if (version !== "Unknown") {
4106
- var parts1 = version.split(".");
4107
- majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
4108
- tizenVersion = majorVersion;
4109
- }
4110
- isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
4111
- } else if (/SMART-TV|SmartTV/i.test(ua)) {
4112
- name = "Smart TV";
4113
- isSmartTV = true;
4114
- isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
4115
- } else if (/NetCast/i.test(ua)) {
4116
- name = "LG NetCast";
4117
- isSmartTV = true;
4118
- isLegacyTV = true;
4119
- } else if (/BRAVIA/i.test(ua)) {
4120
- name = "Sony BRAVIA";
4121
- isSmartTV = true;
4122
- isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
4123
- } else {
4124
- if (chromeVersion > 0) {
4125
- name = "Chrome";
4126
- version = chromeVersion.toString();
4127
- majorVersion = chromeVersion;
4128
- if (chromeVersion < 50) {
4129
- supportsModernJS = false;
4130
- }
4131
- }
4132
- if (webkitVersion > 0 && webkitVersion < 600) {
4133
- supportsModernJS = false;
4134
- }
4135
- }
4136
- if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
4137
- supportsModernJS = false;
4138
- }
4139
- if (typeof URLSearchParams === "undefined") {
4140
- supportsModernJS = false;
4141
- }
4142
- return {
4143
- name: name,
4144
- version: version,
4145
- majorVersion: majorVersion,
4146
- isSmartTV: isSmartTV,
4147
- isLegacyTV: isLegacyTV,
4148
- platform: platform,
4149
- supportsModernJS: supportsModernJS,
4150
- webOSVersion: webOSVersion,
4151
- tizenVersion: tizenVersion,
4152
- chromeVersion: chromeVersionNum
4153
- };
4154
- }
4155
- function requiresMediaPipelineResetAfterAds() {
4156
- var _browser_tizenVersion;
4157
- var browser = detectBrowser();
4158
- return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
4159
- }
4160
- function getBrowserConfigOverrides() {
4161
- var browser = detectBrowser();
4162
- var overrides = {};
4163
- if (browser.isSmartTV) {
4164
- overrides.allowNativeHls = true;
4165
- overrides.pauseContentDuringAds = true;
4166
- }
4167
- return overrides;
4168
- }
4169
- function logBrowserInfo() {
4170
- var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
4171
- if (!debug) return;
4172
- var browser = detectBrowser();
4173
- console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
4174
- browser: "".concat(browser.name, " ").concat(browser.version),
4175
- platform: browser.platform,
4176
- isSmartTV: browser.isSmartTV,
4177
- isLegacyTV: browser.isLegacyTV,
4178
- supportsModernJS: browser.supportsModernJS
4179
- }, browser.webOSVersion !== void 0 ? {
4180
- webOSVersion: browser.webOSVersion
4181
- } : {}, browser.tizenVersion !== void 0 ? {
4182
- tizenVersion: browser.tizenVersion
4183
- } : {}, browser.chromeVersion !== void 0 ? {
4184
- chromeVersion: browser.chromeVersion
4185
- } : {}), {
4186
- userAgent: navigator.userAgent
4187
- }));
4188
- }
4189
4247
  // src/player/Scte35Parser.ts
4190
4248
  function parseCueOutDuration(value) {
4191
4249
  var num = parseFloat(value.trim());