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.
@@ -386,6 +386,179 @@ module.exports = __toCommonJS(StormcloudVideoPlayer_exports);
386
386
  var import_react = __toESM(require("react"), 1);
387
387
  // src/sdk/hlsAdPlayer.ts
388
388
  var import_hls = __toESM(require("hls.js"), 1);
389
+ // src/utils/browserCompat.ts
390
+ function getChromeVersion(ua) {
391
+ var match = ua.match(/Chrome\/(\d+)/);
392
+ return match && match[1] ? parseInt(match[1], 10) : 0;
393
+ }
394
+ function getWebKitVersion(ua) {
395
+ var match = ua.match(/AppleWebKit\/(\d+)/);
396
+ return match && match[1] ? parseInt(match[1], 10) : 0;
397
+ }
398
+ function getPlatform() {
399
+ var _navigator_userAgentData;
400
+ if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
401
+ return navigator.userAgentData.platform;
402
+ }
403
+ var ua = navigator.userAgent;
404
+ if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
405
+ return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
406
+ }
407
+ if (/Win/i.test(ua)) {
408
+ return "Win32";
409
+ }
410
+ if (/Linux/i.test(ua)) {
411
+ return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
412
+ }
413
+ if (/CrOS/i.test(ua)) {
414
+ return "CrOS";
415
+ }
416
+ return navigator.platform || "Unknown";
417
+ }
418
+ function detectBrowser() {
419
+ var ua = navigator.userAgent;
420
+ var platform = getPlatform();
421
+ var name = "Unknown";
422
+ var version = "0";
423
+ var majorVersion = 0;
424
+ var isSmartTV = false;
425
+ var isLegacyTV = false;
426
+ var supportsModernJS = true;
427
+ var webOSVersion;
428
+ var tizenVersion;
429
+ var chromeVersionNum;
430
+ var chromeVersion = getChromeVersion(ua);
431
+ var webkitVersion = getWebKitVersion(ua);
432
+ chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
433
+ if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
434
+ name = "LG WebOS";
435
+ isSmartTV = true;
436
+ var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
437
+ if (!match || !match[1]) {
438
+ match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
439
+ }
440
+ if (match && match[1]) {
441
+ version = match[1];
442
+ var parts = version.split(".");
443
+ majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
444
+ webOSVersion = majorVersion;
445
+ } else if (chromeVersion > 0) {
446
+ if (chromeVersion >= 79) {
447
+ webOSVersion = 6;
448
+ version = "6.0";
449
+ majorVersion = 6;
450
+ } else if (chromeVersion >= 68) {
451
+ webOSVersion = 5;
452
+ version = "5.0";
453
+ majorVersion = 5;
454
+ } else if (chromeVersion >= 53) {
455
+ webOSVersion = 4;
456
+ version = "4.0";
457
+ majorVersion = 4;
458
+ } else if (chromeVersion >= 38) {
459
+ webOSVersion = 3;
460
+ version = "3.0";
461
+ majorVersion = 3;
462
+ } else {
463
+ webOSVersion = 2;
464
+ version = "2.0";
465
+ majorVersion = 2;
466
+ }
467
+ } else {
468
+ version = "Unknown";
469
+ webOSVersion = void 0;
470
+ }
471
+ isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
472
+ } else if (/Tizen/i.test(ua)) {
473
+ name = "Samsung Tizen";
474
+ isSmartTV = true;
475
+ var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
476
+ version = match1 && match1[1] ? match1[1] : "Unknown";
477
+ if (version !== "Unknown") {
478
+ var parts1 = version.split(".");
479
+ majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
480
+ tizenVersion = majorVersion;
481
+ }
482
+ isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
483
+ } else if (/SMART-TV|SmartTV/i.test(ua)) {
484
+ name = "Smart TV";
485
+ isSmartTV = true;
486
+ isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
487
+ } else if (/NetCast/i.test(ua)) {
488
+ name = "LG NetCast";
489
+ isSmartTV = true;
490
+ isLegacyTV = true;
491
+ } else if (/BRAVIA/i.test(ua)) {
492
+ name = "Sony BRAVIA";
493
+ isSmartTV = true;
494
+ isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
495
+ } else {
496
+ if (chromeVersion > 0) {
497
+ name = "Chrome";
498
+ version = chromeVersion.toString();
499
+ majorVersion = chromeVersion;
500
+ if (chromeVersion < 50) {
501
+ supportsModernJS = false;
502
+ }
503
+ }
504
+ if (webkitVersion > 0 && webkitVersion < 600) {
505
+ supportsModernJS = false;
506
+ }
507
+ }
508
+ if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
509
+ supportsModernJS = false;
510
+ }
511
+ if (typeof URLSearchParams === "undefined") {
512
+ supportsModernJS = false;
513
+ }
514
+ return {
515
+ name: name,
516
+ version: version,
517
+ majorVersion: majorVersion,
518
+ isSmartTV: isSmartTV,
519
+ isLegacyTV: isLegacyTV,
520
+ platform: platform,
521
+ supportsModernJS: supportsModernJS,
522
+ webOSVersion: webOSVersion,
523
+ tizenVersion: tizenVersion,
524
+ chromeVersion: chromeVersionNum
525
+ };
526
+ }
527
+ function requiresMediaPipelineResetAfterAds() {
528
+ var _browser_tizenVersion;
529
+ var browser = detectBrowser();
530
+ return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
531
+ }
532
+ function getBrowserConfigOverrides() {
533
+ var browser = detectBrowser();
534
+ var overrides = {};
535
+ if (browser.isSmartTV) {
536
+ overrides.allowNativeHls = true;
537
+ overrides.pauseContentDuringAds = true;
538
+ }
539
+ return overrides;
540
+ }
541
+ function logBrowserInfo() {
542
+ var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
543
+ if (!debug) return;
544
+ var browser = detectBrowser();
545
+ console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
546
+ browser: "".concat(browser.name, " ").concat(browser.version),
547
+ platform: browser.platform,
548
+ isSmartTV: browser.isSmartTV,
549
+ isLegacyTV: browser.isLegacyTV,
550
+ supportsModernJS: browser.supportsModernJS
551
+ }, browser.webOSVersion !== void 0 ? {
552
+ webOSVersion: browser.webOSVersion
553
+ } : {}, browser.tizenVersion !== void 0 ? {
554
+ tizenVersion: browser.tizenVersion
555
+ } : {}, browser.chromeVersion !== void 0 ? {
556
+ chromeVersion: browser.chromeVersion
557
+ } : {}), {
558
+ userAgent: navigator.userAgent
559
+ }));
560
+ }
561
+ // src/sdk/hlsAdPlayer.ts
389
562
  var MAX_VAST_WRAPPER_DEPTH = 5;
390
563
  function createHlsAdPlayer(contentVideo, options) {
391
564
  var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
@@ -398,6 +571,7 @@ function createHlsAdPlayer(contentVideo, options) {
398
571
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
399
572
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
400
573
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
574
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
401
575
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
402
576
  var adHls;
403
577
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -418,6 +592,7 @@ function createHlsAdPlayer(contentVideo, options) {
418
592
  var lastAdProgressPosition = 0;
419
593
  var sawDecodedVideoFrame = false;
420
594
  var videoFrameCallbackHandle;
595
+ var pendingPlayPromise;
421
596
  var trackingFired = {
422
597
  impression: false,
423
598
  start: false,
@@ -1221,6 +1396,60 @@ function createHlsAdPlayer(contentVideo, options) {
1221
1396
  complete: false
1222
1397
  };
1223
1398
  }
1399
+ function isRvfcSupported(video) {
1400
+ return typeof video.requestVideoFrameCallback === "function";
1401
+ }
1402
+ function settlePendingPlay() {
1403
+ pendingPlayPromise = void 0;
1404
+ }
1405
+ function startAdPlayback(context) {
1406
+ if (!adVideoElement) return;
1407
+ var playPromise = adVideoElement.play();
1408
+ pendingPlayPromise = playPromise;
1409
+ playPromise.catch(function(error) {
1410
+ if (pendingPlayPromise !== playPromise) {
1411
+ return;
1412
+ }
1413
+ console.error("[HlsAdPlayer] Error starting ".concat(context, ":"), error);
1414
+ handleAdError();
1415
+ }).finally(function() {
1416
+ if (pendingPlayPromise === playPromise) {
1417
+ pendingPlayPromise = void 0;
1418
+ }
1419
+ });
1420
+ }
1421
+ function prepareVideoElementForNewSource() {
1422
+ settlePendingPlay();
1423
+ if (adHls) {
1424
+ adHls.destroy();
1425
+ adHls = void 0;
1426
+ }
1427
+ if (!adVideoElement) return;
1428
+ try {
1429
+ adVideoElement.pause();
1430
+ adVideoElement.removeAttribute("src");
1431
+ adVideoElement.load();
1432
+ } catch (error) {
1433
+ console.warn("[HlsAdPlayer] Error preparing ad video for new source:", error);
1434
+ }
1435
+ }
1436
+ function recreateAdVideoElement() {
1437
+ console.log("[HlsAdPlayer] Recreating ad video element (single-decoder platform)");
1438
+ teardownAdEventListeners();
1439
+ prepareVideoElementForNewSource();
1440
+ if (adVideoElement) {
1441
+ try {
1442
+ adVideoElement.remove();
1443
+ } catch (error) {
1444
+ console.warn("[HlsAdPlayer] Error removing ad video element:", error);
1445
+ }
1446
+ }
1447
+ adVideoElement = createAdVideoElement();
1448
+ adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.appendChild(adVideoElement);
1449
+ contentVideo[AD_VIDEO_PROP] = adVideoElement;
1450
+ adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
1451
+ adVideoElement.muted = originalMutedState;
1452
+ }
1224
1453
  function loadCurrentAdMedia() {
1225
1454
  if (!adVideoElement || !currentAd) {
1226
1455
  throw new Error("No ad video element or ad to load");
@@ -1243,10 +1472,7 @@ function createHlsAdPlayer(contentVideo, options) {
1243
1472
  adHls.attachMedia(adVideoElement);
1244
1473
  adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
1245
1474
  console.log("[HlsAdPlayer] HLS manifest parsed, starting playback");
1246
- adVideoElement.play().catch(function(error) {
1247
- console.error("[HlsAdPlayer] Error starting ad playback:", error);
1248
- handleAdError();
1249
- });
1475
+ startAdPlayback("HLS ad playback");
1250
1476
  });
1251
1477
  adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
1252
1478
  console.error("[HlsAdPlayer] HLS error:", data);
@@ -1256,10 +1482,7 @@ function createHlsAdPlayer(contentVideo, options) {
1256
1482
  });
1257
1483
  } else if (isHlsAd && adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
1258
1484
  adVideoElement.src = mediaFile.url;
1259
- adVideoElement.play().catch(function(error) {
1260
- console.error("[HlsAdPlayer] Error starting ad playback:", error);
1261
- handleAdError();
1262
- });
1485
+ startAdPlayback("native HLS ad playback");
1263
1486
  } else if (!isHlsAd && isProgressiveMediaFile(mediaFile)) {
1264
1487
  if (adHls) {
1265
1488
  adHls.destroy();
@@ -1267,10 +1490,7 @@ function createHlsAdPlayer(contentVideo, options) {
1267
1490
  }
1268
1491
  adVideoElement.src = mediaFile.url;
1269
1492
  adVideoElement.load();
1270
- adVideoElement.play().catch(function(error) {
1271
- console.error("[HlsAdPlayer] Error starting progressive ad playback:", error);
1272
- handleAdError();
1273
- });
1493
+ startAdPlayback("progressive ad playback");
1274
1494
  } else {
1275
1495
  throw new Error("Unsupported ad media file type: ".concat(mediaFile.type));
1276
1496
  }
@@ -1287,6 +1507,13 @@ function createHlsAdPlayer(contentVideo, options) {
1287
1507
  trackingFired.impression = true;
1288
1508
  console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
1289
1509
  }
1510
+ clearStallWatchdog();
1511
+ if (requiresMediaPipelineResetAfterAds()) {
1512
+ recreateAdVideoElement();
1513
+ setupAdEventListeners();
1514
+ } else {
1515
+ prepareVideoElementForNewSource();
1516
+ }
1290
1517
  try {
1291
1518
  loadCurrentAdMedia();
1292
1519
  emit("pod_ad_started", {
@@ -1346,6 +1573,12 @@ function createHlsAdPlayer(contentVideo, options) {
1346
1573
  function markFrameCounterReliable() {
1347
1574
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1348
1575
  }
1576
+ function isRvfcReliable() {
1577
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1578
+ }
1579
+ function markRvfcReliable() {
1580
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1581
+ }
1349
1582
  function cancelVideoFrameProbe() {
1350
1583
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1351
1584
  try {
@@ -1365,6 +1598,7 @@ function createHlsAdPlayer(contentVideo, options) {
1365
1598
  videoFrameCallbackHandle = void 0;
1366
1599
  if (!adPlaying) return;
1367
1600
  sawDecodedVideoFrame = true;
1601
+ markRvfcReliable();
1368
1602
  };
1369
1603
  try {
1370
1604
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1389,18 +1623,26 @@ function createHlsAdPlayer(contentVideo, options) {
1389
1623
  noteAdProgress();
1390
1624
  sawDecodedVideoFrame = false;
1391
1625
  startVideoFrameProbe();
1626
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1392
1627
  stallWatchdogId = window.setInterval(function() {
1393
1628
  if (!adPlaying || !adVideoElement) {
1394
1629
  return;
1395
1630
  }
1396
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1631
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1397
1632
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1398
1633
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1399
1634
  sawDecodedVideoFrame = true;
1400
1635
  markFrameCounterReliable();
1401
- } else if (decodedFrames === 0 && adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S && isFrameCounterReliable()) {
1402
- handleVideoDecodeFailure();
1403
- return;
1636
+ } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1637
+ var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1638
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1639
+ handleVideoDecodeFailure();
1640
+ return;
1641
+ }
1642
+ if (decodedFrames === 0 && timeAdvancing && isFrameCounterReliable()) {
1643
+ handleVideoDecodeFailure();
1644
+ return;
1645
+ }
1404
1646
  }
1405
1647
  }
1406
1648
  if (adVideoElement.currentTime > lastAdProgressPosition + 0.05) {
@@ -1417,19 +1659,7 @@ function createHlsAdPlayer(contentVideo, options) {
1417
1659
  }, STALL_CHECK_INTERVAL_MS);
1418
1660
  }
1419
1661
  function releaseAdDecoder() {
1420
- if (adHls) {
1421
- adHls.destroy();
1422
- adHls = void 0;
1423
- }
1424
- if (adVideoElement) {
1425
- try {
1426
- adVideoElement.pause();
1427
- adVideoElement.removeAttribute("src");
1428
- adVideoElement.load();
1429
- } catch (error) {
1430
- console.warn("[HlsAdPlayer] Error releasing ad decoder:", error);
1431
- }
1432
- }
1662
+ prepareVideoElementForNewSource();
1433
1663
  if (adContainerEl) {
1434
1664
  adContainerEl.style.display = "none";
1435
1665
  adContainerEl.style.pointerEvents = "none";
@@ -1806,7 +2036,7 @@ function createHlsAdPlayer(contentVideo, options) {
1806
2036
  }
1807
2037
  },
1808
2038
  hidePlaceholder: function hidePlaceholder() {
1809
- if (adContainerEl) {
2039
+ if (adContainerEl && !adPlaying) {
1810
2040
  adContainerEl.style.display = "none";
1811
2041
  adContainerEl.style.pointerEvents = "none";
1812
2042
  }
@@ -4000,178 +4230,6 @@ function fetchConsentSignals() {
4000
4230
  return signals;
4001
4231
  });
4002
4232
  }
4003
- // src/utils/browserCompat.ts
4004
- function getChromeVersion(ua) {
4005
- var match = ua.match(/Chrome\/(\d+)/);
4006
- return match && match[1] ? parseInt(match[1], 10) : 0;
4007
- }
4008
- function getWebKitVersion(ua) {
4009
- var match = ua.match(/AppleWebKit\/(\d+)/);
4010
- return match && match[1] ? parseInt(match[1], 10) : 0;
4011
- }
4012
- function getPlatform() {
4013
- var _navigator_userAgentData;
4014
- if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
4015
- return navigator.userAgentData.platform;
4016
- }
4017
- var ua = navigator.userAgent;
4018
- if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
4019
- return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
4020
- }
4021
- if (/Win/i.test(ua)) {
4022
- return "Win32";
4023
- }
4024
- if (/Linux/i.test(ua)) {
4025
- return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
4026
- }
4027
- if (/CrOS/i.test(ua)) {
4028
- return "CrOS";
4029
- }
4030
- return navigator.platform || "Unknown";
4031
- }
4032
- function detectBrowser() {
4033
- var ua = navigator.userAgent;
4034
- var platform = getPlatform();
4035
- var name = "Unknown";
4036
- var version = "0";
4037
- var majorVersion = 0;
4038
- var isSmartTV = false;
4039
- var isLegacyTV = false;
4040
- var supportsModernJS = true;
4041
- var webOSVersion;
4042
- var tizenVersion;
4043
- var chromeVersionNum;
4044
- var chromeVersion = getChromeVersion(ua);
4045
- var webkitVersion = getWebKitVersion(ua);
4046
- chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
4047
- if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
4048
- name = "LG WebOS";
4049
- isSmartTV = true;
4050
- var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
4051
- if (!match || !match[1]) {
4052
- match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
4053
- }
4054
- if (match && match[1]) {
4055
- version = match[1];
4056
- var parts = version.split(".");
4057
- majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
4058
- webOSVersion = majorVersion;
4059
- } else if (chromeVersion > 0) {
4060
- if (chromeVersion >= 79) {
4061
- webOSVersion = 6;
4062
- version = "6.0";
4063
- majorVersion = 6;
4064
- } else if (chromeVersion >= 68) {
4065
- webOSVersion = 5;
4066
- version = "5.0";
4067
- majorVersion = 5;
4068
- } else if (chromeVersion >= 53) {
4069
- webOSVersion = 4;
4070
- version = "4.0";
4071
- majorVersion = 4;
4072
- } else if (chromeVersion >= 38) {
4073
- webOSVersion = 3;
4074
- version = "3.0";
4075
- majorVersion = 3;
4076
- } else {
4077
- webOSVersion = 2;
4078
- version = "2.0";
4079
- majorVersion = 2;
4080
- }
4081
- } else {
4082
- version = "Unknown";
4083
- webOSVersion = void 0;
4084
- }
4085
- isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
4086
- } else if (/Tizen/i.test(ua)) {
4087
- name = "Samsung Tizen";
4088
- isSmartTV = true;
4089
- var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
4090
- version = match1 && match1[1] ? match1[1] : "Unknown";
4091
- if (version !== "Unknown") {
4092
- var parts1 = version.split(".");
4093
- majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
4094
- tizenVersion = majorVersion;
4095
- }
4096
- isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
4097
- } else if (/SMART-TV|SmartTV/i.test(ua)) {
4098
- name = "Smart TV";
4099
- isSmartTV = true;
4100
- isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
4101
- } else if (/NetCast/i.test(ua)) {
4102
- name = "LG NetCast";
4103
- isSmartTV = true;
4104
- isLegacyTV = true;
4105
- } else if (/BRAVIA/i.test(ua)) {
4106
- name = "Sony BRAVIA";
4107
- isSmartTV = true;
4108
- isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
4109
- } else {
4110
- if (chromeVersion > 0) {
4111
- name = "Chrome";
4112
- version = chromeVersion.toString();
4113
- majorVersion = chromeVersion;
4114
- if (chromeVersion < 50) {
4115
- supportsModernJS = false;
4116
- }
4117
- }
4118
- if (webkitVersion > 0 && webkitVersion < 600) {
4119
- supportsModernJS = false;
4120
- }
4121
- }
4122
- if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
4123
- supportsModernJS = false;
4124
- }
4125
- if (typeof URLSearchParams === "undefined") {
4126
- supportsModernJS = false;
4127
- }
4128
- return {
4129
- name: name,
4130
- version: version,
4131
- majorVersion: majorVersion,
4132
- isSmartTV: isSmartTV,
4133
- isLegacyTV: isLegacyTV,
4134
- platform: platform,
4135
- supportsModernJS: supportsModernJS,
4136
- webOSVersion: webOSVersion,
4137
- tizenVersion: tizenVersion,
4138
- chromeVersion: chromeVersionNum
4139
- };
4140
- }
4141
- function requiresMediaPipelineResetAfterAds() {
4142
- var _browser_tizenVersion;
4143
- var browser = detectBrowser();
4144
- return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
4145
- }
4146
- function getBrowserConfigOverrides() {
4147
- var browser = detectBrowser();
4148
- var overrides = {};
4149
- if (browser.isSmartTV) {
4150
- overrides.allowNativeHls = true;
4151
- overrides.pauseContentDuringAds = true;
4152
- }
4153
- return overrides;
4154
- }
4155
- function logBrowserInfo() {
4156
- var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
4157
- if (!debug) return;
4158
- var browser = detectBrowser();
4159
- console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
4160
- browser: "".concat(browser.name, " ").concat(browser.version),
4161
- platform: browser.platform,
4162
- isSmartTV: browser.isSmartTV,
4163
- isLegacyTV: browser.isLegacyTV,
4164
- supportsModernJS: browser.supportsModernJS
4165
- }, browser.webOSVersion !== void 0 ? {
4166
- webOSVersion: browser.webOSVersion
4167
- } : {}, browser.tizenVersion !== void 0 ? {
4168
- tizenVersion: browser.tizenVersion
4169
- } : {}, browser.chromeVersion !== void 0 ? {
4170
- chromeVersion: browser.chromeVersion
4171
- } : {}), {
4172
- userAgent: navigator.userAgent
4173
- }));
4174
- }
4175
4233
  // src/player/Scte35Parser.ts
4176
4234
  function parseCueOutDuration(value) {
4177
4235
  var num = parseFloat(value.trim());