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.js
CHANGED
|
@@ -370,6 +370,202 @@ function _ts_values(o) {
|
|
|
370
370
|
import React, { useEffect, useRef, useMemo, useCallback } from "react";
|
|
371
371
|
// src/sdk/hlsAdPlayer.ts
|
|
372
372
|
import Hls from "hls.js";
|
|
373
|
+
// src/utils/browserCompat.ts
|
|
374
|
+
function getChromeVersion(ua) {
|
|
375
|
+
var match = ua.match(/Chrome\/(\d+)/);
|
|
376
|
+
return match && match[1] ? parseInt(match[1], 10) : 0;
|
|
377
|
+
}
|
|
378
|
+
function getWebKitVersion(ua) {
|
|
379
|
+
var match = ua.match(/AppleWebKit\/(\d+)/);
|
|
380
|
+
return match && match[1] ? parseInt(match[1], 10) : 0;
|
|
381
|
+
}
|
|
382
|
+
function getPlatform() {
|
|
383
|
+
var _navigator_userAgentData;
|
|
384
|
+
if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
|
|
385
|
+
return navigator.userAgentData.platform;
|
|
386
|
+
}
|
|
387
|
+
var ua = navigator.userAgent;
|
|
388
|
+
if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
|
|
389
|
+
return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
|
|
390
|
+
}
|
|
391
|
+
if (/Win/i.test(ua)) {
|
|
392
|
+
return "Win32";
|
|
393
|
+
}
|
|
394
|
+
if (/Linux/i.test(ua)) {
|
|
395
|
+
return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
|
|
396
|
+
}
|
|
397
|
+
if (/CrOS/i.test(ua)) {
|
|
398
|
+
return "CrOS";
|
|
399
|
+
}
|
|
400
|
+
return navigator.platform || "Unknown";
|
|
401
|
+
}
|
|
402
|
+
function detectBrowser() {
|
|
403
|
+
var ua = navigator.userAgent;
|
|
404
|
+
var platform = getPlatform();
|
|
405
|
+
var name = "Unknown";
|
|
406
|
+
var version = "0";
|
|
407
|
+
var majorVersion = 0;
|
|
408
|
+
var isSmartTV = false;
|
|
409
|
+
var isLegacyTV = false;
|
|
410
|
+
var supportsModernJS2 = true;
|
|
411
|
+
var webOSVersion;
|
|
412
|
+
var tizenVersion;
|
|
413
|
+
var chromeVersionNum;
|
|
414
|
+
var chromeVersion = getChromeVersion(ua);
|
|
415
|
+
var webkitVersion = getWebKitVersion(ua);
|
|
416
|
+
chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
|
|
417
|
+
if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
|
|
418
|
+
name = "LG WebOS";
|
|
419
|
+
isSmartTV = true;
|
|
420
|
+
var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
|
|
421
|
+
if (!match || !match[1]) {
|
|
422
|
+
match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
|
|
423
|
+
}
|
|
424
|
+
if (match && match[1]) {
|
|
425
|
+
version = match[1];
|
|
426
|
+
var parts = version.split(".");
|
|
427
|
+
majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
|
|
428
|
+
webOSVersion = majorVersion;
|
|
429
|
+
} else if (chromeVersion > 0) {
|
|
430
|
+
if (chromeVersion >= 79) {
|
|
431
|
+
webOSVersion = 6;
|
|
432
|
+
version = "6.0";
|
|
433
|
+
majorVersion = 6;
|
|
434
|
+
} else if (chromeVersion >= 68) {
|
|
435
|
+
webOSVersion = 5;
|
|
436
|
+
version = "5.0";
|
|
437
|
+
majorVersion = 5;
|
|
438
|
+
} else if (chromeVersion >= 53) {
|
|
439
|
+
webOSVersion = 4;
|
|
440
|
+
version = "4.0";
|
|
441
|
+
majorVersion = 4;
|
|
442
|
+
} else if (chromeVersion >= 38) {
|
|
443
|
+
webOSVersion = 3;
|
|
444
|
+
version = "3.0";
|
|
445
|
+
majorVersion = 3;
|
|
446
|
+
} else {
|
|
447
|
+
webOSVersion = 2;
|
|
448
|
+
version = "2.0";
|
|
449
|
+
majorVersion = 2;
|
|
450
|
+
}
|
|
451
|
+
} else {
|
|
452
|
+
version = "Unknown";
|
|
453
|
+
webOSVersion = void 0;
|
|
454
|
+
}
|
|
455
|
+
isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
|
|
456
|
+
} else if (/Tizen/i.test(ua)) {
|
|
457
|
+
name = "Samsung Tizen";
|
|
458
|
+
isSmartTV = true;
|
|
459
|
+
var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
|
|
460
|
+
version = match1 && match1[1] ? match1[1] : "Unknown";
|
|
461
|
+
if (version !== "Unknown") {
|
|
462
|
+
var parts1 = version.split(".");
|
|
463
|
+
majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
|
|
464
|
+
tizenVersion = majorVersion;
|
|
465
|
+
}
|
|
466
|
+
isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
|
|
467
|
+
} else if (/SMART-TV|SmartTV/i.test(ua)) {
|
|
468
|
+
name = "Smart TV";
|
|
469
|
+
isSmartTV = true;
|
|
470
|
+
isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
|
|
471
|
+
} else if (/NetCast/i.test(ua)) {
|
|
472
|
+
name = "LG NetCast";
|
|
473
|
+
isSmartTV = true;
|
|
474
|
+
isLegacyTV = true;
|
|
475
|
+
} else if (/BRAVIA/i.test(ua)) {
|
|
476
|
+
name = "Sony BRAVIA";
|
|
477
|
+
isSmartTV = true;
|
|
478
|
+
isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
|
|
479
|
+
} else {
|
|
480
|
+
if (chromeVersion > 0) {
|
|
481
|
+
name = "Chrome";
|
|
482
|
+
version = chromeVersion.toString();
|
|
483
|
+
majorVersion = chromeVersion;
|
|
484
|
+
if (chromeVersion < 50) {
|
|
485
|
+
supportsModernJS2 = false;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (webkitVersion > 0 && webkitVersion < 600) {
|
|
489
|
+
supportsModernJS2 = false;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
|
|
493
|
+
supportsModernJS2 = false;
|
|
494
|
+
}
|
|
495
|
+
if (typeof URLSearchParams === "undefined") {
|
|
496
|
+
supportsModernJS2 = false;
|
|
497
|
+
}
|
|
498
|
+
return {
|
|
499
|
+
name: name,
|
|
500
|
+
version: version,
|
|
501
|
+
majorVersion: majorVersion,
|
|
502
|
+
isSmartTV: isSmartTV,
|
|
503
|
+
isLegacyTV: isLegacyTV,
|
|
504
|
+
platform: platform,
|
|
505
|
+
supportsModernJS: supportsModernJS2,
|
|
506
|
+
webOSVersion: webOSVersion,
|
|
507
|
+
tizenVersion: tizenVersion,
|
|
508
|
+
chromeVersion: chromeVersionNum
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
function requiresMediaPipelineResetAfterAds() {
|
|
512
|
+
var _browser_tizenVersion;
|
|
513
|
+
var browser = detectBrowser();
|
|
514
|
+
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
515
|
+
}
|
|
516
|
+
function getBrowserConfigOverrides() {
|
|
517
|
+
var browser = detectBrowser();
|
|
518
|
+
var overrides = {};
|
|
519
|
+
if (browser.isSmartTV) {
|
|
520
|
+
overrides.allowNativeHls = true;
|
|
521
|
+
overrides.pauseContentDuringAds = true;
|
|
522
|
+
}
|
|
523
|
+
return overrides;
|
|
524
|
+
}
|
|
525
|
+
function supportsModernJS() {
|
|
526
|
+
try {
|
|
527
|
+
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";
|
|
528
|
+
} catch (e) {
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function logBrowserInfo() {
|
|
533
|
+
var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
534
|
+
if (!debug) return;
|
|
535
|
+
var browser = detectBrowser();
|
|
536
|
+
console.log("[StormcloudVideoPlayer] Browser Compatibility Info:", _object_spread_props(_object_spread({
|
|
537
|
+
browser: "".concat(browser.name, " ").concat(browser.version),
|
|
538
|
+
platform: browser.platform,
|
|
539
|
+
isSmartTV: browser.isSmartTV,
|
|
540
|
+
isLegacyTV: browser.isLegacyTV,
|
|
541
|
+
supportsModernJS: browser.supportsModernJS
|
|
542
|
+
}, browser.webOSVersion !== void 0 ? {
|
|
543
|
+
webOSVersion: browser.webOSVersion
|
|
544
|
+
} : {}, browser.tizenVersion !== void 0 ? {
|
|
545
|
+
tizenVersion: browser.tizenVersion
|
|
546
|
+
} : {}, browser.chromeVersion !== void 0 ? {
|
|
547
|
+
chromeVersion: browser.chromeVersion
|
|
548
|
+
} : {}), {
|
|
549
|
+
userAgent: navigator.userAgent
|
|
550
|
+
}));
|
|
551
|
+
}
|
|
552
|
+
function supportsFeature(feature) {
|
|
553
|
+
switch(feature){
|
|
554
|
+
case "urlsearchparams":
|
|
555
|
+
return typeof URLSearchParams !== "undefined";
|
|
556
|
+
case "textencoder":
|
|
557
|
+
return typeof TextEncoder !== "undefined";
|
|
558
|
+
case "promises":
|
|
559
|
+
return typeof Promise !== "undefined";
|
|
560
|
+
case "fetch":
|
|
561
|
+
return typeof fetch !== "undefined";
|
|
562
|
+
case "crypto":
|
|
563
|
+
return typeof crypto !== "undefined" && typeof crypto.subtle !== "undefined";
|
|
564
|
+
default:
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
// src/sdk/hlsAdPlayer.ts
|
|
373
569
|
var MAX_VAST_WRAPPER_DEPTH = 5;
|
|
374
570
|
function createHlsAdPlayer(contentVideo, options) {
|
|
375
571
|
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
|
|
@@ -402,6 +598,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
402
598
|
var lastAdProgressPosition = 0;
|
|
403
599
|
var sawDecodedVideoFrame = false;
|
|
404
600
|
var videoFrameCallbackHandle;
|
|
601
|
+
var pendingPlayPromise;
|
|
405
602
|
var trackingFired = {
|
|
406
603
|
impression: false,
|
|
407
604
|
start: false,
|
|
@@ -1205,6 +1402,60 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1205
1402
|
complete: false
|
|
1206
1403
|
};
|
|
1207
1404
|
}
|
|
1405
|
+
function isRvfcSupported(video) {
|
|
1406
|
+
return typeof video.requestVideoFrameCallback === "function";
|
|
1407
|
+
}
|
|
1408
|
+
function settlePendingPlay() {
|
|
1409
|
+
pendingPlayPromise = void 0;
|
|
1410
|
+
}
|
|
1411
|
+
function startAdPlayback(context) {
|
|
1412
|
+
if (!adVideoElement) return;
|
|
1413
|
+
var playPromise = adVideoElement.play();
|
|
1414
|
+
pendingPlayPromise = playPromise;
|
|
1415
|
+
playPromise.catch(function(error) {
|
|
1416
|
+
if (pendingPlayPromise !== playPromise) {
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
console.error("[HlsAdPlayer] Error starting ".concat(context, ":"), error);
|
|
1420
|
+
handleAdError();
|
|
1421
|
+
}).finally(function() {
|
|
1422
|
+
if (pendingPlayPromise === playPromise) {
|
|
1423
|
+
pendingPlayPromise = void 0;
|
|
1424
|
+
}
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
function prepareVideoElementForNewSource() {
|
|
1428
|
+
settlePendingPlay();
|
|
1429
|
+
if (adHls) {
|
|
1430
|
+
adHls.destroy();
|
|
1431
|
+
adHls = void 0;
|
|
1432
|
+
}
|
|
1433
|
+
if (!adVideoElement) return;
|
|
1434
|
+
try {
|
|
1435
|
+
adVideoElement.pause();
|
|
1436
|
+
adVideoElement.removeAttribute("src");
|
|
1437
|
+
adVideoElement.load();
|
|
1438
|
+
} catch (error) {
|
|
1439
|
+
console.warn("[HlsAdPlayer] Error preparing ad video for new source:", error);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
function recreateAdVideoElement() {
|
|
1443
|
+
console.log("[HlsAdPlayer] Recreating ad video element (single-decoder platform)");
|
|
1444
|
+
teardownAdEventListeners();
|
|
1445
|
+
prepareVideoElementForNewSource();
|
|
1446
|
+
if (adVideoElement) {
|
|
1447
|
+
try {
|
|
1448
|
+
adVideoElement.remove();
|
|
1449
|
+
} catch (error) {
|
|
1450
|
+
console.warn("[HlsAdPlayer] Error removing ad video element:", error);
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
adVideoElement = createAdVideoElement();
|
|
1454
|
+
adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.appendChild(adVideoElement);
|
|
1455
|
+
contentVideo[AD_VIDEO_PROP] = adVideoElement;
|
|
1456
|
+
adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
|
|
1457
|
+
adVideoElement.muted = originalMutedState;
|
|
1458
|
+
}
|
|
1208
1459
|
function loadCurrentAdMedia() {
|
|
1209
1460
|
if (!adVideoElement || !currentAd) {
|
|
1210
1461
|
throw new Error("No ad video element or ad to load");
|
|
@@ -1227,10 +1478,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1227
1478
|
adHls.attachMedia(adVideoElement);
|
|
1228
1479
|
adHls.on(Hls.Events.MANIFEST_PARSED, function() {
|
|
1229
1480
|
console.log("[HlsAdPlayer] HLS manifest parsed, starting playback");
|
|
1230
|
-
|
|
1231
|
-
console.error("[HlsAdPlayer] Error starting ad playback:", error);
|
|
1232
|
-
handleAdError();
|
|
1233
|
-
});
|
|
1481
|
+
startAdPlayback("HLS ad playback");
|
|
1234
1482
|
});
|
|
1235
1483
|
adHls.on(Hls.Events.ERROR, function(_event, data) {
|
|
1236
1484
|
console.error("[HlsAdPlayer] HLS error:", data);
|
|
@@ -1240,10 +1488,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1240
1488
|
});
|
|
1241
1489
|
} else if (isHlsAd && adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
|
|
1242
1490
|
adVideoElement.src = mediaFile.url;
|
|
1243
|
-
|
|
1244
|
-
console.error("[HlsAdPlayer] Error starting ad playback:", error);
|
|
1245
|
-
handleAdError();
|
|
1246
|
-
});
|
|
1491
|
+
startAdPlayback("native HLS ad playback");
|
|
1247
1492
|
} else if (!isHlsAd && isProgressiveMediaFile(mediaFile)) {
|
|
1248
1493
|
if (adHls) {
|
|
1249
1494
|
adHls.destroy();
|
|
@@ -1251,10 +1496,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1251
1496
|
}
|
|
1252
1497
|
adVideoElement.src = mediaFile.url;
|
|
1253
1498
|
adVideoElement.load();
|
|
1254
|
-
|
|
1255
|
-
console.error("[HlsAdPlayer] Error starting progressive ad playback:", error);
|
|
1256
|
-
handleAdError();
|
|
1257
|
-
});
|
|
1499
|
+
startAdPlayback("progressive ad playback");
|
|
1258
1500
|
} else {
|
|
1259
1501
|
throw new Error("Unsupported ad media file type: ".concat(mediaFile.type));
|
|
1260
1502
|
}
|
|
@@ -1271,6 +1513,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1271
1513
|
trackingFired.impression = true;
|
|
1272
1514
|
console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
|
|
1273
1515
|
}
|
|
1516
|
+
clearStallWatchdog();
|
|
1517
|
+
if (requiresMediaPipelineResetAfterAds()) {
|
|
1518
|
+
recreateAdVideoElement();
|
|
1519
|
+
setupAdEventListeners();
|
|
1520
|
+
} else {
|
|
1521
|
+
prepareVideoElementForNewSource();
|
|
1522
|
+
}
|
|
1274
1523
|
try {
|
|
1275
1524
|
loadCurrentAdMedia();
|
|
1276
1525
|
emit("pod_ad_started", {
|
|
@@ -1382,9 +1631,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1382
1631
|
if (decodedFrames !== void 0 && decodedFrames > 0) {
|
|
1383
1632
|
sawDecodedVideoFrame = true;
|
|
1384
1633
|
markFrameCounterReliable();
|
|
1385
|
-
} else if (
|
|
1386
|
-
|
|
1387
|
-
|
|
1634
|
+
} else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
|
|
1635
|
+
var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
|
|
1636
|
+
if (isRvfcSupported(adVideoElement) && timeAdvancing) {
|
|
1637
|
+
handleVideoDecodeFailure();
|
|
1638
|
+
return;
|
|
1639
|
+
}
|
|
1640
|
+
if (decodedFrames === 0 && timeAdvancing && isFrameCounterReliable()) {
|
|
1641
|
+
handleVideoDecodeFailure();
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1388
1644
|
}
|
|
1389
1645
|
}
|
|
1390
1646
|
if (adVideoElement.currentTime > lastAdProgressPosition + 0.05) {
|
|
@@ -1401,19 +1657,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1401
1657
|
}, STALL_CHECK_INTERVAL_MS);
|
|
1402
1658
|
}
|
|
1403
1659
|
function releaseAdDecoder() {
|
|
1404
|
-
|
|
1405
|
-
adHls.destroy();
|
|
1406
|
-
adHls = void 0;
|
|
1407
|
-
}
|
|
1408
|
-
if (adVideoElement) {
|
|
1409
|
-
try {
|
|
1410
|
-
adVideoElement.pause();
|
|
1411
|
-
adVideoElement.removeAttribute("src");
|
|
1412
|
-
adVideoElement.load();
|
|
1413
|
-
} catch (error) {
|
|
1414
|
-
console.warn("[HlsAdPlayer] Error releasing ad decoder:", error);
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1660
|
+
prepareVideoElementForNewSource();
|
|
1417
1661
|
if (adContainerEl) {
|
|
1418
1662
|
adContainerEl.style.display = "none";
|
|
1419
1663
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -4007,201 +4251,6 @@ function fetchConsentSignals() {
|
|
|
4007
4251
|
return signals;
|
|
4008
4252
|
});
|
|
4009
4253
|
}
|
|
4010
|
-
// src/utils/browserCompat.ts
|
|
4011
|
-
function getChromeVersion(ua) {
|
|
4012
|
-
var match = ua.match(/Chrome\/(\d+)/);
|
|
4013
|
-
return match && match[1] ? parseInt(match[1], 10) : 0;
|
|
4014
|
-
}
|
|
4015
|
-
function getWebKitVersion(ua) {
|
|
4016
|
-
var match = ua.match(/AppleWebKit\/(\d+)/);
|
|
4017
|
-
return match && match[1] ? parseInt(match[1], 10) : 0;
|
|
4018
|
-
}
|
|
4019
|
-
function getPlatform() {
|
|
4020
|
-
var _navigator_userAgentData;
|
|
4021
|
-
if ("userAgentData" in navigator && ((_navigator_userAgentData = navigator.userAgentData) === null || _navigator_userAgentData === void 0 ? void 0 : _navigator_userAgentData.platform)) {
|
|
4022
|
-
return navigator.userAgentData.platform;
|
|
4023
|
-
}
|
|
4024
|
-
var ua = navigator.userAgent;
|
|
4025
|
-
if (/Mac|iPhone|iPad|iPod/i.test(ua)) {
|
|
4026
|
-
return /iPhone|iPad|iPod/i.test(ua) ? "iPhone" : "MacIntel";
|
|
4027
|
-
}
|
|
4028
|
-
if (/Win/i.test(ua)) {
|
|
4029
|
-
return "Win32";
|
|
4030
|
-
}
|
|
4031
|
-
if (/Linux/i.test(ua)) {
|
|
4032
|
-
return /Android/i.test(ua) ? "Linux armv8l" : "Linux x86_64";
|
|
4033
|
-
}
|
|
4034
|
-
if (/CrOS/i.test(ua)) {
|
|
4035
|
-
return "CrOS";
|
|
4036
|
-
}
|
|
4037
|
-
return navigator.platform || "Unknown";
|
|
4038
|
-
}
|
|
4039
|
-
function detectBrowser() {
|
|
4040
|
-
var ua = navigator.userAgent;
|
|
4041
|
-
var platform = getPlatform();
|
|
4042
|
-
var name = "Unknown";
|
|
4043
|
-
var version = "0";
|
|
4044
|
-
var majorVersion = 0;
|
|
4045
|
-
var isSmartTV = false;
|
|
4046
|
-
var isLegacyTV = false;
|
|
4047
|
-
var supportsModernJS2 = true;
|
|
4048
|
-
var webOSVersion;
|
|
4049
|
-
var tizenVersion;
|
|
4050
|
-
var chromeVersionNum;
|
|
4051
|
-
var chromeVersion = getChromeVersion(ua);
|
|
4052
|
-
var webkitVersion = getWebKitVersion(ua);
|
|
4053
|
-
chromeVersionNum = chromeVersion > 0 ? chromeVersion : void 0;
|
|
4054
|
-
if (/Web0S|webOS|LG Browser|LGSTB/i.test(ua)) {
|
|
4055
|
-
name = "LG WebOS";
|
|
4056
|
-
isSmartTV = true;
|
|
4057
|
-
var match = ua.match(/Web0S[/\s]*([\d.]+)/i) || ua.match(/webOS[/\s]*([\d.]+)/i);
|
|
4058
|
-
if (!match || !match[1]) {
|
|
4059
|
-
match = ua.match(/webOSTV[/\s-]*([\d.]+)/i) || ua.match(/webOS\.TV[/\s-]*([\d.]+)/i);
|
|
4060
|
-
}
|
|
4061
|
-
if (match && match[1]) {
|
|
4062
|
-
version = match[1];
|
|
4063
|
-
var parts = version.split(".");
|
|
4064
|
-
majorVersion = parts[0] ? parseInt(parts[0], 10) : 0;
|
|
4065
|
-
webOSVersion = majorVersion;
|
|
4066
|
-
} else if (chromeVersion > 0) {
|
|
4067
|
-
if (chromeVersion >= 79) {
|
|
4068
|
-
webOSVersion = 6;
|
|
4069
|
-
version = "6.0";
|
|
4070
|
-
majorVersion = 6;
|
|
4071
|
-
} else if (chromeVersion >= 68) {
|
|
4072
|
-
webOSVersion = 5;
|
|
4073
|
-
version = "5.0";
|
|
4074
|
-
majorVersion = 5;
|
|
4075
|
-
} else if (chromeVersion >= 53) {
|
|
4076
|
-
webOSVersion = 4;
|
|
4077
|
-
version = "4.0";
|
|
4078
|
-
majorVersion = 4;
|
|
4079
|
-
} else if (chromeVersion >= 38) {
|
|
4080
|
-
webOSVersion = 3;
|
|
4081
|
-
version = "3.0";
|
|
4082
|
-
majorVersion = 3;
|
|
4083
|
-
} else {
|
|
4084
|
-
webOSVersion = 2;
|
|
4085
|
-
version = "2.0";
|
|
4086
|
-
majorVersion = 2;
|
|
4087
|
-
}
|
|
4088
|
-
} else {
|
|
4089
|
-
version = "Unknown";
|
|
4090
|
-
webOSVersion = void 0;
|
|
4091
|
-
}
|
|
4092
|
-
isLegacyTV = webOSVersion !== void 0 && webOSVersion < 3;
|
|
4093
|
-
} else if (/Tizen/i.test(ua)) {
|
|
4094
|
-
name = "Samsung Tizen";
|
|
4095
|
-
isSmartTV = true;
|
|
4096
|
-
var match1 = ua.match(/Tizen[/\s]*([\d.]+)/i);
|
|
4097
|
-
version = match1 && match1[1] ? match1[1] : "Unknown";
|
|
4098
|
-
if (version !== "Unknown") {
|
|
4099
|
-
var parts1 = version.split(".");
|
|
4100
|
-
majorVersion = parts1[0] ? parseInt(parts1[0], 10) : 0;
|
|
4101
|
-
tizenVersion = majorVersion;
|
|
4102
|
-
}
|
|
4103
|
-
isLegacyTV = tizenVersion !== void 0 && tizenVersion < 3;
|
|
4104
|
-
} else if (/SMART-TV|SmartTV/i.test(ua)) {
|
|
4105
|
-
name = "Smart TV";
|
|
4106
|
-
isSmartTV = true;
|
|
4107
|
-
isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
|
|
4108
|
-
} else if (/NetCast/i.test(ua)) {
|
|
4109
|
-
name = "LG NetCast";
|
|
4110
|
-
isSmartTV = true;
|
|
4111
|
-
isLegacyTV = true;
|
|
4112
|
-
} else if (/BRAVIA/i.test(ua)) {
|
|
4113
|
-
name = "Sony BRAVIA";
|
|
4114
|
-
isSmartTV = true;
|
|
4115
|
-
isLegacyTV = chromeVersion > 0 && chromeVersion < 53;
|
|
4116
|
-
} else {
|
|
4117
|
-
if (chromeVersion > 0) {
|
|
4118
|
-
name = "Chrome";
|
|
4119
|
-
version = chromeVersion.toString();
|
|
4120
|
-
majorVersion = chromeVersion;
|
|
4121
|
-
if (chromeVersion < 50) {
|
|
4122
|
-
supportsModernJS2 = false;
|
|
4123
|
-
}
|
|
4124
|
-
}
|
|
4125
|
-
if (webkitVersion > 0 && webkitVersion < 600) {
|
|
4126
|
-
supportsModernJS2 = false;
|
|
4127
|
-
}
|
|
4128
|
-
}
|
|
4129
|
-
if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
|
|
4130
|
-
supportsModernJS2 = false;
|
|
4131
|
-
}
|
|
4132
|
-
if (typeof URLSearchParams === "undefined") {
|
|
4133
|
-
supportsModernJS2 = false;
|
|
4134
|
-
}
|
|
4135
|
-
return {
|
|
4136
|
-
name: name,
|
|
4137
|
-
version: version,
|
|
4138
|
-
majorVersion: majorVersion,
|
|
4139
|
-
isSmartTV: isSmartTV,
|
|
4140
|
-
isLegacyTV: isLegacyTV,
|
|
4141
|
-
platform: platform,
|
|
4142
|
-
supportsModernJS: supportsModernJS2,
|
|
4143
|
-
webOSVersion: webOSVersion,
|
|
4144
|
-
tizenVersion: tizenVersion,
|
|
4145
|
-
chromeVersion: chromeVersionNum
|
|
4146
|
-
};
|
|
4147
|
-
}
|
|
4148
|
-
function requiresMediaPipelineResetAfterAds() {
|
|
4149
|
-
var _browser_tizenVersion;
|
|
4150
|
-
var browser = detectBrowser();
|
|
4151
|
-
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
4152
|
-
}
|
|
4153
|
-
function getBrowserConfigOverrides() {
|
|
4154
|
-
var browser = detectBrowser();
|
|
4155
|
-
var overrides = {};
|
|
4156
|
-
if (browser.isSmartTV) {
|
|
4157
|
-
overrides.allowNativeHls = true;
|
|
4158
|
-
overrides.pauseContentDuringAds = true;
|
|
4159
|
-
}
|
|
4160
|
-
return overrides;
|
|
4161
|
-
}
|
|
4162
|
-
function supportsModernJS() {
|
|
4163
|
-
try {
|
|
4164
|
-
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";
|
|
4165
|
-
} catch (e) {
|
|
4166
|
-
return false;
|
|
4167
|
-
}
|
|
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
|
-
function supportsFeature(feature) {
|
|
4190
|
-
switch(feature){
|
|
4191
|
-
case "urlsearchparams":
|
|
4192
|
-
return typeof URLSearchParams !== "undefined";
|
|
4193
|
-
case "textencoder":
|
|
4194
|
-
return typeof TextEncoder !== "undefined";
|
|
4195
|
-
case "promises":
|
|
4196
|
-
return typeof Promise !== "undefined";
|
|
4197
|
-
case "fetch":
|
|
4198
|
-
return typeof fetch !== "undefined";
|
|
4199
|
-
case "crypto":
|
|
4200
|
-
return typeof crypto !== "undefined" && typeof crypto.subtle !== "undefined";
|
|
4201
|
-
default:
|
|
4202
|
-
return false;
|
|
4203
|
-
}
|
|
4204
|
-
}
|
|
4205
4254
|
// src/player/Scte35Parser.ts
|
|
4206
4255
|
function parseCueOutDuration(value) {
|
|
4207
4256
|
var num = parseFloat(value.trim());
|