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.
@@ -349,6 +349,179 @@ __export(StormcloudVideoPlayer_exports, {
349
349
  module.exports = __toCommonJS(StormcloudVideoPlayer_exports);
350
350
  // src/sdk/hlsAdPlayer.ts
351
351
  var import_hls = __toESM(require("hls.js"), 1);
352
+ // src/utils/browserCompat.ts
353
+ function getChromeVersion(ua) {
354
+ var match = ua.match(/Chrome\/(\d+)/);
355
+ return match && match[1] ? parseInt(match[1], 10) : 0;
356
+ }
357
+ function getWebKitVersion(ua) {
358
+ var match = ua.match(/AppleWebKit\/(\d+)/);
359
+ return match && match[1] ? parseInt(match[1], 10) : 0;
360
+ }
361
+ function getPlatform() {
362
+ var _navigator_userAgentData;
363
+ if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
364
+ return navigator.userAgentData.platform;
365
+ }
366
+ var ua = navigator.userAgent;
367
+ if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
368
+ return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
369
+ }
370
+ if (/Win/i.test(ua)) {
371
+ return "Win32";
372
+ }
373
+ if (/Linux/i.test(ua)) {
374
+ return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
375
+ }
376
+ if (/CrOS/i.test(ua)) {
377
+ return "CrOS";
378
+ }
379
+ return navigator.platform || "Unknown";
380
+ }
381
+ function detectBrowser() {
382
+ var ua = navigator.userAgent;
383
+ var platform = getPlatform();
384
+ var name = "Unknown";
385
+ var version = "0";
386
+ var majorVersion = 0;
387
+ var isSmartTV = false;
388
+ var isLegacyTV = false;
389
+ var supportsModernJS = true;
390
+ var webOSVersion;
391
+ var tizenVersion;
392
+ var chromeVersionNum;
393
+ var chromeVersion = getChromeVersion(ua);
394
+ var webkitVersion = getWebKitVersion(ua);
395
+ chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
396
+ if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
397
+ name = "LG WebOS";
398
+ isSmartTV = true;
399
+ var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
400
+ if (!match || !match[1]) {
401
+ match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
402
+ }
403
+ if (match && match[1]) {
404
+ version = match[1];
405
+ var parts = version.split(".");
406
+ majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
407
+ webOSVersion = majorVersion;
408
+ } else if (chromeVersion > 0) {
409
+ if (chromeVersion >= 79) {
410
+ webOSVersion = 6;
411
+ version = "6.0";
412
+ majorVersion = 6;
413
+ } else if (chromeVersion >= 68) {
414
+ webOSVersion = 5;
415
+ version = "5.0";
416
+ majorVersion = 5;
417
+ } else if (chromeVersion >= 53) {
418
+ webOSVersion = 4;
419
+ version = "4.0";
420
+ majorVersion = 4;
421
+ } else if (chromeVersion >= 38) {
422
+ webOSVersion = 3;
423
+ version = "3.0";
424
+ majorVersion = 3;
425
+ } else {
426
+ webOSVersion = 2;
427
+ version = "2.0";
428
+ majorVersion = 2;
429
+ }
430
+ } else {
431
+ version = "Unknown";
432
+ webOSVersion = void 0;
433
+ }
434
+ isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
435
+ } else if (/Tizen/i.test(ua)) {
436
+ name = "Samsung Tizen";
437
+ isSmartTV = true;
438
+ var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
439
+ version = match1 && match1[1] ? match1[1] : "Unknown";
440
+ if (version !== "Unknown") {
441
+ var parts1 = version.split(".");
442
+ majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
443
+ tizenVersion = majorVersion;
444
+ }
445
+ isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
446
+ } else if (/SMART-TV|SmartTV/i.test(ua)) {
447
+ name = "Smart TV";
448
+ isSmartTV = true;
449
+ isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
450
+ } else if (/NetCast/i.test(ua)) {
451
+ name = "LG NetCast";
452
+ isSmartTV = true;
453
+ isLegacyTV = true;
454
+ } else if (/BRAVIA/i.test(ua)) {
455
+ name = "Sony BRAVIA";
456
+ isSmartTV = true;
457
+ isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
458
+ } else {
459
+ if (chromeVersion > 0) {
460
+ name = "Chrome";
461
+ version = chromeVersion.toString();
462
+ majorVersion = chromeVersion;
463
+ if (chromeVersion < 50) {
464
+ supportsModernJS = false;
465
+ }
466
+ }
467
+ if (webkitVersion > 0 && webkitVersion < 600) {
468
+ supportsModernJS = false;
469
+ }
470
+ }
471
+ if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
472
+ supportsModernJS = false;
473
+ }
474
+ if (typeof URLSearchParams === "undefined") {
475
+ supportsModernJS = false;
476
+ }
477
+ return {
478
+ name: name,
479
+ version: version,
480
+ majorVersion: majorVersion,
481
+ isSmartTV: isSmartTV,
482
+ isLegacyTV: isLegacyTV,
483
+ platform: platform,
484
+ supportsModernJS: supportsModernJS,
485
+ webOSVersion: webOSVersion,
486
+ tizenVersion: tizenVersion,
487
+ chromeVersion: chromeVersionNum
488
+ };
489
+ }
490
+ function requiresMediaPipelineResetAfterAds() {
491
+ var _browser_tizenVersion;
492
+ var browser = detectBrowser();
493
+ return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
494
+ }
495
+ function getBrowserConfigOverrides() {
496
+ var browser = detectBrowser();
497
+ var overrides = {};
498
+ if (browser.isSmartTV) {
499
+ overrides.allowNativeHls = true;
500
+ overrides.pauseContentDuringAds = true;
501
+ }
502
+ return overrides;
503
+ }
504
+ function logBrowserInfo() {
505
+ var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
506
+ if (!debug) return;
507
+ var browser = detectBrowser();
508
+ console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
509
+ browser: "".concat(browser.name, " ").concat(browser.version),
510
+ platform: browser.platform,
511
+ isSmartTV: browser.isSmartTV,
512
+ isLegacyTV: browser.isLegacyTV,
513
+ supportsModernJS: browser.supportsModernJS
514
+ }, browser.webOSVersion !== void 0 ? {
515
+ webOSVersion: browser.webOSVersion
516
+ } : {}, browser.tizenVersion !== void 0 ? {
517
+ tizenVersion: browser.tizenVersion
518
+ } : {}, browser.chromeVersion !== void 0 ? {
519
+ chromeVersion: browser.chromeVersion
520
+ } : {}), {
521
+ userAgent: navigator.userAgent
522
+ }));
523
+ }
524
+ // src/sdk/hlsAdPlayer.ts
352
525
  var MAX_VAST_WRAPPER_DEPTH = 5;
353
526
  function createHlsAdPlayer(contentVideo, options) {
354
527
  var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
@@ -361,6 +534,7 @@ function createHlsAdPlayer(contentVideo, options) {
361
534
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
362
535
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
363
536
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
537
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
364
538
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
365
539
  var adHls;
366
540
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -381,6 +555,7 @@ function createHlsAdPlayer(contentVideo, options) {
381
555
  var lastAdProgressPosition = 0;
382
556
  var sawDecodedVideoFrame = false;
383
557
  var videoFrameCallbackHandle;
558
+ var pendingPlayPromise;
384
559
  var trackingFired = {
385
560
  impression: false,
386
561
  start: false,
@@ -1184,6 +1359,60 @@ function createHlsAdPlayer(contentVideo, options) {
1184
1359
  complete: false
1185
1360
  };
1186
1361
  }
1362
+ function isRvfcSupported(video) {
1363
+ return typeof video.requestVideoFrameCallback === "function";
1364
+ }
1365
+ function settlePendingPlay() {
1366
+ pendingPlayPromise = void 0;
1367
+ }
1368
+ function startAdPlayback(context) {
1369
+ if (!adVideoElement) return;
1370
+ var playPromise = adVideoElement.play();
1371
+ pendingPlayPromise = playPromise;
1372
+ playPromise.catch(function(error) {
1373
+ if (pendingPlayPromise !== playPromise) {
1374
+ return;
1375
+ }
1376
+ console.error("[HlsAdPlayer] Error starting ".concat(context, ":"), error);
1377
+ handleAdError();
1378
+ }).finally(function() {
1379
+ if (pendingPlayPromise === playPromise) {
1380
+ pendingPlayPromise = void 0;
1381
+ }
1382
+ });
1383
+ }
1384
+ function prepareVideoElementForNewSource() {
1385
+ settlePendingPlay();
1386
+ if (adHls) {
1387
+ adHls.destroy();
1388
+ adHls = void 0;
1389
+ }
1390
+ if (!adVideoElement) return;
1391
+ try {
1392
+ adVideoElement.pause();
1393
+ adVideoElement.removeAttribute("src");
1394
+ adVideoElement.load();
1395
+ } catch (error) {
1396
+ console.warn("[HlsAdPlayer] Error preparing ad video for new source:", error);
1397
+ }
1398
+ }
1399
+ function recreateAdVideoElement() {
1400
+ console.log("[HlsAdPlayer] Recreating ad video element (single-decoder platform)");
1401
+ teardownAdEventListeners();
1402
+ prepareVideoElementForNewSource();
1403
+ if (adVideoElement) {
1404
+ try {
1405
+ adVideoElement.remove();
1406
+ } catch (error) {
1407
+ console.warn("[HlsAdPlayer] Error removing ad video element:", error);
1408
+ }
1409
+ }
1410
+ adVideoElement = createAdVideoElement();
1411
+ adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.appendChild(adVideoElement);
1412
+ contentVideo[AD_VIDEO_PROP] = adVideoElement;
1413
+ adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
1414
+ adVideoElement.muted = originalMutedState;
1415
+ }
1187
1416
  function loadCurrentAdMedia() {
1188
1417
  if (!adVideoElement || !currentAd) {
1189
1418
  throw new Error("No ad video element or ad to load");
@@ -1206,10 +1435,7 @@ function createHlsAdPlayer(contentVideo, options) {
1206
1435
  adHls.attachMedia(adVideoElement);
1207
1436
  adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
1208
1437
  console.log("[HlsAdPlayer] HLS manifest parsed, starting playback");
1209
- adVideoElement.play().catch(function(error) {
1210
- console.error("[HlsAdPlayer] Error starting ad playback:", error);
1211
- handleAdError();
1212
- });
1438
+ startAdPlayback("HLS ad playback");
1213
1439
  });
1214
1440
  adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
1215
1441
  console.error("[HlsAdPlayer] HLS error:", data);
@@ -1219,10 +1445,7 @@ function createHlsAdPlayer(contentVideo, options) {
1219
1445
  });
1220
1446
  } else if (isHlsAd && adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
1221
1447
  adVideoElement.src = mediaFile.url;
1222
- adVideoElement.play().catch(function(error) {
1223
- console.error("[HlsAdPlayer] Error starting ad playback:", error);
1224
- handleAdError();
1225
- });
1448
+ startAdPlayback("native HLS ad playback");
1226
1449
  } else if (!isHlsAd && isProgressiveMediaFile(mediaFile)) {
1227
1450
  if (adHls) {
1228
1451
  adHls.destroy();
@@ -1230,10 +1453,7 @@ function createHlsAdPlayer(contentVideo, options) {
1230
1453
  }
1231
1454
  adVideoElement.src = mediaFile.url;
1232
1455
  adVideoElement.load();
1233
- adVideoElement.play().catch(function(error) {
1234
- console.error("[HlsAdPlayer] Error starting progressive ad playback:", error);
1235
- handleAdError();
1236
- });
1456
+ startAdPlayback("progressive ad playback");
1237
1457
  } else {
1238
1458
  throw new Error("Unsupported ad media file type: ".concat(mediaFile.type));
1239
1459
  }
@@ -1250,6 +1470,13 @@ function createHlsAdPlayer(contentVideo, options) {
1250
1470
  trackingFired.impression = true;
1251
1471
  console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
1252
1472
  }
1473
+ clearStallWatchdog();
1474
+ if (requiresMediaPipelineResetAfterAds()) {
1475
+ recreateAdVideoElement();
1476
+ setupAdEventListeners();
1477
+ } else {
1478
+ prepareVideoElementForNewSource();
1479
+ }
1253
1480
  try {
1254
1481
  loadCurrentAdMedia();
1255
1482
  emit("pod_ad_started", {
@@ -1309,6 +1536,12 @@ function createHlsAdPlayer(contentVideo, options) {
1309
1536
  function markFrameCounterReliable() {
1310
1537
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1311
1538
  }
1539
+ function isRvfcReliable() {
1540
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1541
+ }
1542
+ function markRvfcReliable() {
1543
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1544
+ }
1312
1545
  function cancelVideoFrameProbe() {
1313
1546
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1314
1547
  try {
@@ -1328,6 +1561,7 @@ function createHlsAdPlayer(contentVideo, options) {
1328
1561
  videoFrameCallbackHandle = void 0;
1329
1562
  if (!adPlaying) return;
1330
1563
  sawDecodedVideoFrame = true;
1564
+ markRvfcReliable();
1331
1565
  };
1332
1566
  try {
1333
1567
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1352,18 +1586,26 @@ function createHlsAdPlayer(contentVideo, options) {
1352
1586
  noteAdProgress();
1353
1587
  sawDecodedVideoFrame = false;
1354
1588
  startVideoFrameProbe();
1589
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1355
1590
  stallWatchdogId = window.setInterval(function() {
1356
1591
  if (!adPlaying || !adVideoElement) {
1357
1592
  return;
1358
1593
  }
1359
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1594
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1360
1595
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1361
1596
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1362
1597
  sawDecodedVideoFrame = true;
1363
1598
  markFrameCounterReliable();
1364
- } else if (decodedFrames === 0 && adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S && isFrameCounterReliable()) {
1365
- handleVideoDecodeFailure();
1366
- return;
1599
+ } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1600
+ var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1601
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1602
+ handleVideoDecodeFailure();
1603
+ return;
1604
+ }
1605
+ if (decodedFrames === 0 && timeAdvancing && isFrameCounterReliable()) {
1606
+ handleVideoDecodeFailure();
1607
+ return;
1608
+ }
1367
1609
  }
1368
1610
  }
1369
1611
  if (adVideoElement.currentTime > lastAdProgressPosition + 0.05) {
@@ -1380,19 +1622,7 @@ function createHlsAdPlayer(contentVideo, options) {
1380
1622
  }, STALL_CHECK_INTERVAL_MS);
1381
1623
  }
1382
1624
  function releaseAdDecoder() {
1383
- if (adHls) {
1384
- adHls.destroy();
1385
- adHls = void 0;
1386
- }
1387
- if (adVideoElement) {
1388
- try {
1389
- adVideoElement.pause();
1390
- adVideoElement.removeAttribute("src");
1391
- adVideoElement.load();
1392
- } catch (error) {
1393
- console.warn("[HlsAdPlayer] Error releasing ad decoder:", error);
1394
- }
1395
- }
1625
+ prepareVideoElementForNewSource();
1396
1626
  if (adContainerEl) {
1397
1627
  adContainerEl.style.display = "none";
1398
1628
  adContainerEl.style.pointerEvents = "none";
@@ -1769,7 +1999,7 @@ function createHlsAdPlayer(contentVideo, options) {
1769
1999
  }
1770
2000
  },
1771
2001
  hidePlaceholder: function hidePlaceholder() {
1772
- if (adContainerEl) {
2002
+ if (adContainerEl && !adPlaying) {
1773
2003
  adContainerEl.style.display = "none";
1774
2004
  adContainerEl.style.pointerEvents = "none";
1775
2005
  }
@@ -3963,178 +4193,6 @@ function fetchConsentSignals() {
3963
4193
  return signals;
3964
4194
  });
3965
4195
  }
3966
- // src/utils/browserCompat.ts
3967
- function getChromeVersion(ua) {
3968
- var match = ua.match(/Chrome\/(\d+)/);
3969
- return match && match[1] ? parseInt(match[1], 10) : 0;
3970
- }
3971
- function getWebKitVersion(ua) {
3972
- var match = ua.match(/AppleWebKit\/(\d+)/);
3973
- return match && match[1] ? parseInt(match[1], 10) : 0;
3974
- }
3975
- function getPlatform() {
3976
- var _navigator_userAgentData;
3977
- if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
3978
- return navigator.userAgentData.platform;
3979
- }
3980
- var ua = navigator.userAgent;
3981
- if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
3982
- return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
3983
- }
3984
- if (/Win/i.test(ua)) {
3985
- return "Win32";
3986
- }
3987
- if (/Linux/i.test(ua)) {
3988
- return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
3989
- }
3990
- if (/CrOS/i.test(ua)) {
3991
- return "CrOS";
3992
- }
3993
- return navigator.platform || "Unknown";
3994
- }
3995
- function detectBrowser() {
3996
- var ua = navigator.userAgent;
3997
- var platform = getPlatform();
3998
- var name = "Unknown";
3999
- var version = "0";
4000
- var majorVersion = 0;
4001
- var isSmartTV = false;
4002
- var isLegacyTV = false;
4003
- var supportsModernJS = true;
4004
- var webOSVersion;
4005
- var tizenVersion;
4006
- var chromeVersionNum;
4007
- var chromeVersion = getChromeVersion(ua);
4008
- var webkitVersion = getWebKitVersion(ua);
4009
- chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
4010
- if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
4011
- name = "LG WebOS";
4012
- isSmartTV = true;
4013
- var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
4014
- if (!match || !match[1]) {
4015
- match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
4016
- }
4017
- if (match && match[1]) {
4018
- version = match[1];
4019
- var parts = version.split(".");
4020
- majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
4021
- webOSVersion = majorVersion;
4022
- } else if (chromeVersion > 0) {
4023
- if (chromeVersion >= 79) {
4024
- webOSVersion = 6;
4025
- version = "6.0";
4026
- majorVersion = 6;
4027
- } else if (chromeVersion >= 68) {
4028
- webOSVersion = 5;
4029
- version = "5.0";
4030
- majorVersion = 5;
4031
- } else if (chromeVersion >= 53) {
4032
- webOSVersion = 4;
4033
- version = "4.0";
4034
- majorVersion = 4;
4035
- } else if (chromeVersion >= 38) {
4036
- webOSVersion = 3;
4037
- version = "3.0";
4038
- majorVersion = 3;
4039
- } else {
4040
- webOSVersion = 2;
4041
- version = "2.0";
4042
- majorVersion = 2;
4043
- }
4044
- } else {
4045
- version = "Unknown";
4046
- webOSVersion = void 0;
4047
- }
4048
- isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
4049
- } else if (/Tizen/i.test(ua)) {
4050
- name = "Samsung Tizen";
4051
- isSmartTV = true;
4052
- var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
4053
- version = match1 && match1[1] ? match1[1] : "Unknown";
4054
- if (version !== "Unknown") {
4055
- var parts1 = version.split(".");
4056
- majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
4057
- tizenVersion = majorVersion;
4058
- }
4059
- isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
4060
- } else if (/SMART-TV|SmartTV/i.test(ua)) {
4061
- name = "Smart TV";
4062
- isSmartTV = true;
4063
- isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
4064
- } else if (/NetCast/i.test(ua)) {
4065
- name = "LG NetCast";
4066
- isSmartTV = true;
4067
- isLegacyTV = true;
4068
- } else if (/BRAVIA/i.test(ua)) {
4069
- name = "Sony BRAVIA";
4070
- isSmartTV = true;
4071
- isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
4072
- } else {
4073
- if (chromeVersion > 0) {
4074
- name = "Chrome";
4075
- version = chromeVersion.toString();
4076
- majorVersion = chromeVersion;
4077
- if (chromeVersion < 50) {
4078
- supportsModernJS = false;
4079
- }
4080
- }
4081
- if (webkitVersion > 0 && webkitVersion < 600) {
4082
- supportsModernJS = false;
4083
- }
4084
- }
4085
- if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
4086
- supportsModernJS = false;
4087
- }
4088
- if (typeof URLSearchParams === "undefined") {
4089
- supportsModernJS = false;
4090
- }
4091
- return {
4092
- name: name,
4093
- version: version,
4094
- majorVersion: majorVersion,
4095
- isSmartTV: isSmartTV,
4096
- isLegacyTV: isLegacyTV,
4097
- platform: platform,
4098
- supportsModernJS: supportsModernJS,
4099
- webOSVersion: webOSVersion,
4100
- tizenVersion: tizenVersion,
4101
- chromeVersion: chromeVersionNum
4102
- };
4103
- }
4104
- function requiresMediaPipelineResetAfterAds() {
4105
- var _browser_tizenVersion;
4106
- var browser = detectBrowser();
4107
- return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
4108
- }
4109
- function getBrowserConfigOverrides() {
4110
- var browser = detectBrowser();
4111
- var overrides = {};
4112
- if (browser.isSmartTV) {
4113
- overrides.allowNativeHls = true;
4114
- overrides.pauseContentDuringAds = true;
4115
- }
4116
- return overrides;
4117
- }
4118
- function logBrowserInfo() {
4119
- var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
4120
- if (!debug) return;
4121
- var browser = detectBrowser();
4122
- console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
4123
- browser: "".concat(browser.name, " ").concat(browser.version),
4124
- platform: browser.platform,
4125
- isSmartTV: browser.isSmartTV,
4126
- isLegacyTV: browser.isLegacyTV,
4127
- supportsModernJS: browser.supportsModernJS
4128
- }, browser.webOSVersion !== void 0 ? {
4129
- webOSVersion: browser.webOSVersion
4130
- } : {}, browser.tizenVersion !== void 0 ? {
4131
- tizenVersion: browser.tizenVersion
4132
- } : {}, browser.chromeVersion !== void 0 ? {
4133
- chromeVersion: browser.chromeVersion
4134
- } : {}), {
4135
- userAgent: navigator.userAgent
4136
- }));
4137
- }
4138
4196
  // src/player/Scte35Parser.ts
4139
4197
  function parseCueOutDuration(value) {
4140
4198
  var num = parseFloat(value.trim());