stormcloud-video-player 0.8.50 → 0.8.51
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/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +272 -223
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +272 -223
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -1
- package/lib/player/AdConfigManager.d.cts +1 -1
- package/lib/player/AdTimingService.d.cts +1 -1
- package/lib/player/HlsEngine.d.cts +1 -1
- package/lib/player/PlayerControls.d.cts +1 -1
- package/lib/player/Scte35CueManager.d.cts +1 -1
- package/lib/player/Scte35Parser.d.cts +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +249 -200
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/player/playerTypes.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +249 -200
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +249 -200
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +220 -28
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +249 -200
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -590,6 +590,202 @@ module.exports = __toCommonJS(index_exports);
|
|
|
590
590
|
var import_react = __toESM(require("react"), 1);
|
|
591
591
|
// src/sdk/hlsAdPlayer.ts
|
|
592
592
|
var import_hls = __toESM(require("hls.js"), 1);
|
|
593
|
+
// src/utils/browserCompat.ts
|
|
594
|
+
function getChromeVersion(ua) {
|
|
595
|
+
var match = ua.match(/Chrome\/(\d+)/);
|
|
596
|
+
return match && match[1] ? parseInt(match[1], 10) : 0;
|
|
597
|
+
}
|
|
598
|
+
function getWebKitVersion(ua) {
|
|
599
|
+
var match = ua.match(/AppleWebKit\/(\d+)/);
|
|
600
|
+
return match && match[1] ? parseInt(match[1], 10) : 0;
|
|
601
|
+
}
|
|
602
|
+
function getPlatform() {
|
|
603
|
+
var _navigator_userAgentData;
|
|
604
|
+
if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
|
|
605
|
+
return navigator.userAgentData.platform;
|
|
606
|
+
}
|
|
607
|
+
var ua = navigator.userAgent;
|
|
608
|
+
if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
|
|
609
|
+
return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
|
|
610
|
+
}
|
|
611
|
+
if (/Win/i.test(ua)) {
|
|
612
|
+
return "Win32";
|
|
613
|
+
}
|
|
614
|
+
if (/Linux/i.test(ua)) {
|
|
615
|
+
return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
|
|
616
|
+
}
|
|
617
|
+
if (/CrOS/i.test(ua)) {
|
|
618
|
+
return "CrOS";
|
|
619
|
+
}
|
|
620
|
+
return navigator.platform || "Unknown";
|
|
621
|
+
}
|
|
622
|
+
function detectBrowser() {
|
|
623
|
+
var ua = navigator.userAgent;
|
|
624
|
+
var platform = getPlatform();
|
|
625
|
+
var name = "Unknown";
|
|
626
|
+
var version = "0";
|
|
627
|
+
var majorVersion = 0;
|
|
628
|
+
var isSmartTV = false;
|
|
629
|
+
var isLegacyTV = false;
|
|
630
|
+
var supportsModernJS2 = true;
|
|
631
|
+
var webOSVersion;
|
|
632
|
+
var tizenVersion;
|
|
633
|
+
var chromeVersionNum;
|
|
634
|
+
var chromeVersion = getChromeVersion(ua);
|
|
635
|
+
var webkitVersion = getWebKitVersion(ua);
|
|
636
|
+
chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
|
|
637
|
+
if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
|
|
638
|
+
name = "LG WebOS";
|
|
639
|
+
isSmartTV = true;
|
|
640
|
+
var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
|
|
641
|
+
if (!match || !match[1]) {
|
|
642
|
+
match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
|
|
643
|
+
}
|
|
644
|
+
if (match && match[1]) {
|
|
645
|
+
version = match[1];
|
|
646
|
+
var parts = version.split(".");
|
|
647
|
+
majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
|
|
648
|
+
webOSVersion = majorVersion;
|
|
649
|
+
} else if (chromeVersion > 0) {
|
|
650
|
+
if (chromeVersion >= 79) {
|
|
651
|
+
webOSVersion = 6;
|
|
652
|
+
version = "6.0";
|
|
653
|
+
majorVersion = 6;
|
|
654
|
+
} else if (chromeVersion >= 68) {
|
|
655
|
+
webOSVersion = 5;
|
|
656
|
+
version = "5.0";
|
|
657
|
+
majorVersion = 5;
|
|
658
|
+
} else if (chromeVersion >= 53) {
|
|
659
|
+
webOSVersion = 4;
|
|
660
|
+
version = "4.0";
|
|
661
|
+
majorVersion = 4;
|
|
662
|
+
} else if (chromeVersion >= 38) {
|
|
663
|
+
webOSVersion = 3;
|
|
664
|
+
version = "3.0";
|
|
665
|
+
majorVersion = 3;
|
|
666
|
+
} else {
|
|
667
|
+
webOSVersion = 2;
|
|
668
|
+
version = "2.0";
|
|
669
|
+
majorVersion = 2;
|
|
670
|
+
}
|
|
671
|
+
} else {
|
|
672
|
+
version = "Unknown";
|
|
673
|
+
webOSVersion = void 0;
|
|
674
|
+
}
|
|
675
|
+
isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
|
|
676
|
+
} else if (/Tizen/i.test(ua)) {
|
|
677
|
+
name = "Samsung Tizen";
|
|
678
|
+
isSmartTV = true;
|
|
679
|
+
var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
|
|
680
|
+
version = match1 && match1[1] ? match1[1] : "Unknown";
|
|
681
|
+
if (version !== "Unknown") {
|
|
682
|
+
var parts1 = version.split(".");
|
|
683
|
+
majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
|
|
684
|
+
tizenVersion = majorVersion;
|
|
685
|
+
}
|
|
686
|
+
isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
|
|
687
|
+
} else if (/SMART-TV|SmartTV/i.test(ua)) {
|
|
688
|
+
name = "Smart TV";
|
|
689
|
+
isSmartTV = true;
|
|
690
|
+
isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
|
|
691
|
+
} else if (/NetCast/i.test(ua)) {
|
|
692
|
+
name = "LG NetCast";
|
|
693
|
+
isSmartTV = true;
|
|
694
|
+
isLegacyTV = true;
|
|
695
|
+
} else if (/BRAVIA/i.test(ua)) {
|
|
696
|
+
name = "Sony BRAVIA";
|
|
697
|
+
isSmartTV = true;
|
|
698
|
+
isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
|
|
699
|
+
} else {
|
|
700
|
+
if (chromeVersion > 0) {
|
|
701
|
+
name = "Chrome";
|
|
702
|
+
version = chromeVersion.toString();
|
|
703
|
+
majorVersion = chromeVersion;
|
|
704
|
+
if (chromeVersion < 50) {
|
|
705
|
+
supportsModernJS2 = false;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
if (webkitVersion > 0 && webkitVersion < 600) {
|
|
709
|
+
supportsModernJS2 = false;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
|
|
713
|
+
supportsModernJS2 = false;
|
|
714
|
+
}
|
|
715
|
+
if (typeof URLSearchParams === "undefined") {
|
|
716
|
+
supportsModernJS2 = false;
|
|
717
|
+
}
|
|
718
|
+
return {
|
|
719
|
+
name: name,
|
|
720
|
+
version: version,
|
|
721
|
+
majorVersion: majorVersion,
|
|
722
|
+
isSmartTV: isSmartTV,
|
|
723
|
+
isLegacyTV: isLegacyTV,
|
|
724
|
+
platform: platform,
|
|
725
|
+
supportsModernJS: supportsModernJS2,
|
|
726
|
+
webOSVersion: webOSVersion,
|
|
727
|
+
tizenVersion: tizenVersion,
|
|
728
|
+
chromeVersion: chromeVersionNum
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
function requiresMediaPipelineResetAfterAds() {
|
|
732
|
+
var _browser_tizenVersion;
|
|
733
|
+
var browser = detectBrowser();
|
|
734
|
+
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
735
|
+
}
|
|
736
|
+
function getBrowserConfigOverrides() {
|
|
737
|
+
var browser = detectBrowser();
|
|
738
|
+
var overrides = {};
|
|
739
|
+
if (browser.isSmartTV) {
|
|
740
|
+
overrides.allowNativeHls = true;
|
|
741
|
+
overrides.pauseContentDuringAds = true;
|
|
742
|
+
}
|
|
743
|
+
return overrides;
|
|
744
|
+
}
|
|
745
|
+
function supportsModernJS() {
|
|
746
|
+
try {
|
|
747
|
+
return typeof Promise !== "undefined" && typeof Map !== "undefined" && typeof Set !== "undefined" && typeof Array.from !== "undefined" && typeof Object.assign !== "undefined" && typeof Array.prototype.forEach !== "undefined" && typeof String.prototype.includes !== "undefined";
|
|
748
|
+
} catch (e) {
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
function logBrowserInfo() {
|
|
753
|
+
var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
754
|
+
if (!debug) return;
|
|
755
|
+
var browser = detectBrowser();
|
|
756
|
+
console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
|
|
757
|
+
browser: "".concat(browser.name, " ").concat(browser.version),
|
|
758
|
+
platform: browser.platform,
|
|
759
|
+
isSmartTV: browser.isSmartTV,
|
|
760
|
+
isLegacyTV: browser.isLegacyTV,
|
|
761
|
+
supportsModernJS: browser.supportsModernJS
|
|
762
|
+
}, browser.webOSVersion !== void 0 ? {
|
|
763
|
+
webOSVersion: browser.webOSVersion
|
|
764
|
+
} : {}, browser.tizenVersion !== void 0 ? {
|
|
765
|
+
tizenVersion: browser.tizenVersion
|
|
766
|
+
} : {}, browser.chromeVersion !== void 0 ? {
|
|
767
|
+
chromeVersion: browser.chromeVersion
|
|
768
|
+
} : {}), {
|
|
769
|
+
userAgent: navigator.userAgent
|
|
770
|
+
}));
|
|
771
|
+
}
|
|
772
|
+
function supportsFeature(feature) {
|
|
773
|
+
switch(feature){
|
|
774
|
+
case "urlsearchparams":
|
|
775
|
+
return typeof URLSearchParams !== "undefined";
|
|
776
|
+
case "textencoder":
|
|
777
|
+
return typeof TextEncoder !== "undefined";
|
|
778
|
+
case "promises":
|
|
779
|
+
return typeof Promise !== "undefined";
|
|
780
|
+
case "fetch":
|
|
781
|
+
return typeof fetch !== "undefined";
|
|
782
|
+
case "crypto":
|
|
783
|
+
return typeof crypto !== "undefined" && typeof crypto.subtle !== "undefined";
|
|
784
|
+
default:
|
|
785
|
+
return false;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
// src/sdk/hlsAdPlayer.ts
|
|
593
789
|
var MAX_VAST_WRAPPER_DEPTH = 5;
|
|
594
790
|
function createHlsAdPlayer(contentVideo, options) {
|
|
595
791
|
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
|
|
@@ -622,6 +818,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
622
818
|
var lastAdProgressPosition = 0;
|
|
623
819
|
var sawDecodedVideoFrame = false;
|
|
624
820
|
var videoFrameCallbackHandle;
|
|
821
|
+
var pendingPlayPromise;
|
|
625
822
|
var trackingFired = {
|
|
626
823
|
impression: false,
|
|
627
824
|
start: false,
|
|
@@ -1425,6 +1622,60 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1425
1622
|
complete: false
|
|
1426
1623
|
};
|
|
1427
1624
|
}
|
|
1625
|
+
function isRvfcSupported(video) {
|
|
1626
|
+
return typeof video.requestVideoFrameCallback === "function";
|
|
1627
|
+
}
|
|
1628
|
+
function settlePendingPlay() {
|
|
1629
|
+
pendingPlayPromise = void 0;
|
|
1630
|
+
}
|
|
1631
|
+
function startAdPlayback(context) {
|
|
1632
|
+
if (!adVideoElement) return;
|
|
1633
|
+
var playPromise = adVideoElement.play();
|
|
1634
|
+
pendingPlayPromise = playPromise;
|
|
1635
|
+
playPromise.catch(function(error) {
|
|
1636
|
+
if (pendingPlayPromise !== playPromise) {
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
console.error("[HlsAdPlayer] Error starting ".concat(context, ":"), error);
|
|
1640
|
+
handleAdError();
|
|
1641
|
+
}).finally(function() {
|
|
1642
|
+
if (pendingPlayPromise === playPromise) {
|
|
1643
|
+
pendingPlayPromise = void 0;
|
|
1644
|
+
}
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
function prepareVideoElementForNewSource() {
|
|
1648
|
+
settlePendingPlay();
|
|
1649
|
+
if (adHls) {
|
|
1650
|
+
adHls.destroy();
|
|
1651
|
+
adHls = void 0;
|
|
1652
|
+
}
|
|
1653
|
+
if (!adVideoElement) return;
|
|
1654
|
+
try {
|
|
1655
|
+
adVideoElement.pause();
|
|
1656
|
+
adVideoElement.removeAttribute("src");
|
|
1657
|
+
adVideoElement.load();
|
|
1658
|
+
} catch (error) {
|
|
1659
|
+
console.warn("[HlsAdPlayer] Error preparing ad video for new source:", error);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
function recreateAdVideoElement() {
|
|
1663
|
+
console.log("[HlsAdPlayer] Recreating ad video element (single-decoder platform)");
|
|
1664
|
+
teardownAdEventListeners();
|
|
1665
|
+
prepareVideoElementForNewSource();
|
|
1666
|
+
if (adVideoElement) {
|
|
1667
|
+
try {
|
|
1668
|
+
adVideoElement.remove();
|
|
1669
|
+
} catch (error) {
|
|
1670
|
+
console.warn("[HlsAdPlayer] Error removing ad video element:", error);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
adVideoElement = createAdVideoElement();
|
|
1674
|
+
adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.appendChild(adVideoElement);
|
|
1675
|
+
contentVideo[AD_VIDEO_PROP] = adVideoElement;
|
|
1676
|
+
adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
|
|
1677
|
+
adVideoElement.muted = originalMutedState;
|
|
1678
|
+
}
|
|
1428
1679
|
function loadCurrentAdMedia() {
|
|
1429
1680
|
if (!adVideoElement || !currentAd) {
|
|
1430
1681
|
throw new Error("No ad video element or ad to load");
|
|
@@ -1447,10 +1698,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1447
1698
|
adHls.attachMedia(adVideoElement);
|
|
1448
1699
|
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
1449
1700
|
console.log("[HlsAdPlayer] HLS manifest parsed, starting playback");
|
|
1450
|
-
|
|
1451
|
-
console.error("[HlsAdPlayer] Error starting ad playback:", error);
|
|
1452
|
-
handleAdError();
|
|
1453
|
-
});
|
|
1701
|
+
startAdPlayback("HLS ad playback");
|
|
1454
1702
|
});
|
|
1455
1703
|
adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
|
|
1456
1704
|
console.error("[HlsAdPlayer] HLS error:", data);
|
|
@@ -1460,10 +1708,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1460
1708
|
});
|
|
1461
1709
|
} else if (isHlsAd && adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
|
|
1462
1710
|
adVideoElement.src = mediaFile.url;
|
|
1463
|
-
|
|
1464
|
-
console.error("[HlsAdPlayer] Error starting ad playback:", error);
|
|
1465
|
-
handleAdError();
|
|
1466
|
-
});
|
|
1711
|
+
startAdPlayback("native HLS ad playback");
|
|
1467
1712
|
} else if (!isHlsAd && isProgressiveMediaFile(mediaFile)) {
|
|
1468
1713
|
if (adHls) {
|
|
1469
1714
|
adHls.destroy();
|
|
@@ -1471,10 +1716,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1471
1716
|
}
|
|
1472
1717
|
adVideoElement.src = mediaFile.url;
|
|
1473
1718
|
adVideoElement.load();
|
|
1474
|
-
|
|
1475
|
-
console.error("[HlsAdPlayer] Error starting progressive ad playback:", error);
|
|
1476
|
-
handleAdError();
|
|
1477
|
-
});
|
|
1719
|
+
startAdPlayback("progressive ad playback");
|
|
1478
1720
|
} else {
|
|
1479
1721
|
throw new Error("Unsupported ad media file type: ".concat(mediaFile.type));
|
|
1480
1722
|
}
|
|
@@ -1491,6 +1733,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1491
1733
|
trackingFired.impression = true;
|
|
1492
1734
|
console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
|
|
1493
1735
|
}
|
|
1736
|
+
clearStallWatchdog();
|
|
1737
|
+
if (requiresMediaPipelineResetAfterAds()) {
|
|
1738
|
+
recreateAdVideoElement();
|
|
1739
|
+
setupAdEventListeners();
|
|
1740
|
+
} else {
|
|
1741
|
+
prepareVideoElementForNewSource();
|
|
1742
|
+
}
|
|
1494
1743
|
try {
|
|
1495
1744
|
loadCurrentAdMedia();
|
|
1496
1745
|
emit("pod_ad_started", {
|
|
@@ -1602,9 +1851,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1602
1851
|
if (decodedFrames !== void 0 && decodedFrames > 0) {
|
|
1603
1852
|
sawDecodedVideoFrame = true;
|
|
1604
1853
|
markFrameCounterReliable();
|
|
1605
|
-
} else if (
|
|
1606
|
-
|
|
1607
|
-
|
|
1854
|
+
} else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
|
|
1855
|
+
var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
|
|
1856
|
+
if (isRvfcSupported(adVideoElement) && timeAdvancing) {
|
|
1857
|
+
handleVideoDecodeFailure();
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
if (decodedFrames === 0 && timeAdvancing && isFrameCounterReliable()) {
|
|
1861
|
+
handleVideoDecodeFailure();
|
|
1862
|
+
return;
|
|
1863
|
+
}
|
|
1608
1864
|
}
|
|
1609
1865
|
}
|
|
1610
1866
|
if (adVideoElement.currentTime > lastAdProgressPosition + 0.05) {
|
|
@@ -1621,19 +1877,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1621
1877
|
}, STALL_CHECK_INTERVAL_MS);
|
|
1622
1878
|
}
|
|
1623
1879
|
function releaseAdDecoder() {
|
|
1624
|
-
|
|
1625
|
-
adHls.destroy();
|
|
1626
|
-
adHls = void 0;
|
|
1627
|
-
}
|
|
1628
|
-
if (adVideoElement) {
|
|
1629
|
-
try {
|
|
1630
|
-
adVideoElement.pause();
|
|
1631
|
-
adVideoElement.removeAttribute("src");
|
|
1632
|
-
adVideoElement.load();
|
|
1633
|
-
} catch (error) {
|
|
1634
|
-
console.warn("[HlsAdPlayer] Error releasing ad decoder:", error);
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1880
|
+
prepareVideoElementForNewSource();
|
|
1637
1881
|
if (adContainerEl) {
|
|
1638
1882
|
adContainerEl.style.display = "none";
|
|
1639
1883
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -4225,201 +4469,6 @@ function fetchConsentSignals() {
|
|
|
4225
4469
|
return signals;
|
|
4226
4470
|
});
|
|
4227
4471
|
}
|
|
4228
|
-
// src/utils/browserCompat.ts
|
|
4229
|
-
function getChromeVersion(ua) {
|
|
4230
|
-
var match = ua.match(/Chrome\/(\d+)/);
|
|
4231
|
-
return match && match[1] ? parseInt(match[1], 10) : 0;
|
|
4232
|
-
}
|
|
4233
|
-
function getWebKitVersion(ua) {
|
|
4234
|
-
var match = ua.match(/AppleWebKit\/(\d+)/);
|
|
4235
|
-
return match && match[1] ? parseInt(match[1], 10) : 0;
|
|
4236
|
-
}
|
|
4237
|
-
function getPlatform() {
|
|
4238
|
-
var _navigator_userAgentData;
|
|
4239
|
-
if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
|
|
4240
|
-
return navigator.userAgentData.platform;
|
|
4241
|
-
}
|
|
4242
|
-
var ua = navigator.userAgent;
|
|
4243
|
-
if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
|
|
4244
|
-
return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
|
|
4245
|
-
}
|
|
4246
|
-
if (/Win/i.test(ua)) {
|
|
4247
|
-
return "Win32";
|
|
4248
|
-
}
|
|
4249
|
-
if (/Linux/i.test(ua)) {
|
|
4250
|
-
return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
|
|
4251
|
-
}
|
|
4252
|
-
if (/CrOS/i.test(ua)) {
|
|
4253
|
-
return "CrOS";
|
|
4254
|
-
}
|
|
4255
|
-
return navigator.platform || "Unknown";
|
|
4256
|
-
}
|
|
4257
|
-
function detectBrowser() {
|
|
4258
|
-
var ua = navigator.userAgent;
|
|
4259
|
-
var platform = getPlatform();
|
|
4260
|
-
var name = "Unknown";
|
|
4261
|
-
var version = "0";
|
|
4262
|
-
var majorVersion = 0;
|
|
4263
|
-
var isSmartTV = false;
|
|
4264
|
-
var isLegacyTV = false;
|
|
4265
|
-
var supportsModernJS2 = true;
|
|
4266
|
-
var webOSVersion;
|
|
4267
|
-
var tizenVersion;
|
|
4268
|
-
var chromeVersionNum;
|
|
4269
|
-
var chromeVersion = getChromeVersion(ua);
|
|
4270
|
-
var webkitVersion = getWebKitVersion(ua);
|
|
4271
|
-
chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
|
|
4272
|
-
if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
|
|
4273
|
-
name = "LG WebOS";
|
|
4274
|
-
isSmartTV = true;
|
|
4275
|
-
var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
|
|
4276
|
-
if (!match || !match[1]) {
|
|
4277
|
-
match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
|
|
4278
|
-
}
|
|
4279
|
-
if (match && match[1]) {
|
|
4280
|
-
version = match[1];
|
|
4281
|
-
var parts = version.split(".");
|
|
4282
|
-
majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
|
|
4283
|
-
webOSVersion = majorVersion;
|
|
4284
|
-
} else if (chromeVersion > 0) {
|
|
4285
|
-
if (chromeVersion >= 79) {
|
|
4286
|
-
webOSVersion = 6;
|
|
4287
|
-
version = "6.0";
|
|
4288
|
-
majorVersion = 6;
|
|
4289
|
-
} else if (chromeVersion >= 68) {
|
|
4290
|
-
webOSVersion = 5;
|
|
4291
|
-
version = "5.0";
|
|
4292
|
-
majorVersion = 5;
|
|
4293
|
-
} else if (chromeVersion >= 53) {
|
|
4294
|
-
webOSVersion = 4;
|
|
4295
|
-
version = "4.0";
|
|
4296
|
-
majorVersion = 4;
|
|
4297
|
-
} else if (chromeVersion >= 38) {
|
|
4298
|
-
webOSVersion = 3;
|
|
4299
|
-
version = "3.0";
|
|
4300
|
-
majorVersion = 3;
|
|
4301
|
-
} else {
|
|
4302
|
-
webOSVersion = 2;
|
|
4303
|
-
version = "2.0";
|
|
4304
|
-
majorVersion = 2;
|
|
4305
|
-
}
|
|
4306
|
-
} else {
|
|
4307
|
-
version = "Unknown";
|
|
4308
|
-
webOSVersion = void 0;
|
|
4309
|
-
}
|
|
4310
|
-
isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
|
|
4311
|
-
} else if (/Tizen/i.test(ua)) {
|
|
4312
|
-
name = "Samsung Tizen";
|
|
4313
|
-
isSmartTV = true;
|
|
4314
|
-
var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
|
|
4315
|
-
version = match1 && match1[1] ? match1[1] : "Unknown";
|
|
4316
|
-
if (version !== "Unknown") {
|
|
4317
|
-
var parts1 = version.split(".");
|
|
4318
|
-
majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
|
|
4319
|
-
tizenVersion = majorVersion;
|
|
4320
|
-
}
|
|
4321
|
-
isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
|
|
4322
|
-
} else if (/SMART-TV|SmartTV/i.test(ua)) {
|
|
4323
|
-
name = "Smart TV";
|
|
4324
|
-
isSmartTV = true;
|
|
4325
|
-
isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
|
|
4326
|
-
} else if (/NetCast/i.test(ua)) {
|
|
4327
|
-
name = "LG NetCast";
|
|
4328
|
-
isSmartTV = true;
|
|
4329
|
-
isLegacyTV = true;
|
|
4330
|
-
} else if (/BRAVIA/i.test(ua)) {
|
|
4331
|
-
name = "Sony BRAVIA";
|
|
4332
|
-
isSmartTV = true;
|
|
4333
|
-
isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
|
|
4334
|
-
} else {
|
|
4335
|
-
if (chromeVersion > 0) {
|
|
4336
|
-
name = "Chrome";
|
|
4337
|
-
version = chromeVersion.toString();
|
|
4338
|
-
majorVersion = chromeVersion;
|
|
4339
|
-
if (chromeVersion < 50) {
|
|
4340
|
-
supportsModernJS2 = false;
|
|
4341
|
-
}
|
|
4342
|
-
}
|
|
4343
|
-
if (webkitVersion > 0 && webkitVersion < 600) {
|
|
4344
|
-
supportsModernJS2 = false;
|
|
4345
|
-
}
|
|
4346
|
-
}
|
|
4347
|
-
if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
|
|
4348
|
-
supportsModernJS2 = false;
|
|
4349
|
-
}
|
|
4350
|
-
if (typeof URLSearchParams === "undefined") {
|
|
4351
|
-
supportsModernJS2 = false;
|
|
4352
|
-
}
|
|
4353
|
-
return {
|
|
4354
|
-
name: name,
|
|
4355
|
-
version: version,
|
|
4356
|
-
majorVersion: majorVersion,
|
|
4357
|
-
isSmartTV: isSmartTV,
|
|
4358
|
-
isLegacyTV: isLegacyTV,
|
|
4359
|
-
platform: platform,
|
|
4360
|
-
supportsModernJS: supportsModernJS2,
|
|
4361
|
-
webOSVersion: webOSVersion,
|
|
4362
|
-
tizenVersion: tizenVersion,
|
|
4363
|
-
chromeVersion: chromeVersionNum
|
|
4364
|
-
};
|
|
4365
|
-
}
|
|
4366
|
-
function requiresMediaPipelineResetAfterAds() {
|
|
4367
|
-
var _browser_tizenVersion;
|
|
4368
|
-
var browser = detectBrowser();
|
|
4369
|
-
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
4370
|
-
}
|
|
4371
|
-
function getBrowserConfigOverrides() {
|
|
4372
|
-
var browser = detectBrowser();
|
|
4373
|
-
var overrides = {};
|
|
4374
|
-
if (browser.isSmartTV) {
|
|
4375
|
-
overrides.allowNativeHls = true;
|
|
4376
|
-
overrides.pauseContentDuringAds = true;
|
|
4377
|
-
}
|
|
4378
|
-
return overrides;
|
|
4379
|
-
}
|
|
4380
|
-
function supportsModernJS() {
|
|
4381
|
-
try {
|
|
4382
|
-
return typeof Promise !== "undefined" && typeof Map !== "undefined" && typeof Set !== "undefined" && typeof Array.from !== "undefined" && typeof Object.assign !== "undefined" && typeof Array.prototype.forEach !== "undefined" && typeof String.prototype.includes !== "undefined";
|
|
4383
|
-
} catch (e) {
|
|
4384
|
-
return false;
|
|
4385
|
-
}
|
|
4386
|
-
}
|
|
4387
|
-
function logBrowserInfo() {
|
|
4388
|
-
var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
4389
|
-
if (!debug) return;
|
|
4390
|
-
var browser = detectBrowser();
|
|
4391
|
-
console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
|
|
4392
|
-
browser: "".concat(browser.name, " ").concat(browser.version),
|
|
4393
|
-
platform: browser.platform,
|
|
4394
|
-
isSmartTV: browser.isSmartTV,
|
|
4395
|
-
isLegacyTV: browser.isLegacyTV,
|
|
4396
|
-
supportsModernJS: browser.supportsModernJS
|
|
4397
|
-
}, browser.webOSVersion !== void 0 ? {
|
|
4398
|
-
webOSVersion: browser.webOSVersion
|
|
4399
|
-
} : {}, browser.tizenVersion !== void 0 ? {
|
|
4400
|
-
tizenVersion: browser.tizenVersion
|
|
4401
|
-
} : {}, browser.chromeVersion !== void 0 ? {
|
|
4402
|
-
chromeVersion: browser.chromeVersion
|
|
4403
|
-
} : {}), {
|
|
4404
|
-
userAgent: navigator.userAgent
|
|
4405
|
-
}));
|
|
4406
|
-
}
|
|
4407
|
-
function supportsFeature(feature) {
|
|
4408
|
-
switch(feature){
|
|
4409
|
-
case "urlsearchparams":
|
|
4410
|
-
return typeof URLSearchParams !== "undefined";
|
|
4411
|
-
case "textencoder":
|
|
4412
|
-
return typeof TextEncoder !== "undefined";
|
|
4413
|
-
case "promises":
|
|
4414
|
-
return typeof Promise !== "undefined";
|
|
4415
|
-
case "fetch":
|
|
4416
|
-
return typeof fetch !== "undefined";
|
|
4417
|
-
case "crypto":
|
|
4418
|
-
return typeof crypto !== "undefined" && typeof crypto.subtle !== "undefined";
|
|
4419
|
-
default:
|
|
4420
|
-
return false;
|
|
4421
|
-
}
|
|
4422
|
-
}
|
|
4423
4472
|
// src/player/Scte35Parser.ts
|
|
4424
4473
|
function parseCueOutDuration(value) {
|
|
4425
4474
|
var num = parseFloat(value.trim());
|