stormcloud-video-player 0.8.17 → 0.8.19
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/README.md +67 -83
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +859 -585
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +859 -585
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +11 -11
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +3 -3
- package/lib/player/{VmapManager.cjs → AdConfigManager.cjs} +503 -214
- package/lib/player/AdConfigManager.cjs.map +1 -0
- package/lib/player/{VmapManager.d.cts → AdConfigManager.d.cts} +2 -2
- package/lib/player/StormcloudVideoPlayer.cjs +635 -346
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +635 -346
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +635 -346
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +859 -585
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.cjs +92 -33
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.d.cts +1 -13
- package/lib/utils/vastEnvironmentSignals.cjs +439 -0
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -0
- package/lib/utils/vastEnvironmentSignals.d.cts +16 -0
- package/lib/utils/vastMacros.cjs +299 -25
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +3 -1
- package/package.json +1 -1
- package/lib/player/VmapManager.cjs.map +0 -1
|
@@ -2308,7 +2308,451 @@ function initializePolyfills() {
|
|
|
2308
2308
|
polyfillTextEncoder();
|
|
2309
2309
|
polyfillPromiseFinally();
|
|
2310
2310
|
}
|
|
2311
|
+
// src/utils/vastEnvironmentSignals.ts
|
|
2312
|
+
var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
|
|
2313
|
+
var AIRY_APP_NAME = "AiryTV Movies & TV";
|
|
2314
|
+
var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
|
|
2315
|
+
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
2316
|
+
var DEVICE_ID_STORAGE_KEYS = [
|
|
2317
|
+
"rdid",
|
|
2318
|
+
"ifa",
|
|
2319
|
+
"advertisingId",
|
|
2320
|
+
"advertising_id",
|
|
2321
|
+
"deviceAdvertisingId",
|
|
2322
|
+
"aaid",
|
|
2323
|
+
"adid",
|
|
2324
|
+
"rida",
|
|
2325
|
+
"tifa",
|
|
2326
|
+
"lgudid"
|
|
2327
|
+
];
|
|
2328
|
+
var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
|
|
2329
|
+
"aaid",
|
|
2330
|
+
"adid"
|
|
2331
|
+
]);
|
|
2332
|
+
function resolveVastEnvironmentSignals(isCtv) {
|
|
2333
|
+
var _ref, _bridgeSignals_limitAdTracking;
|
|
2334
|
+
var bridgeSignals = readNativeBridgeSignals();
|
|
2335
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
2336
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || inferDeviceIdType();
|
|
2337
|
+
var limitAdTracking = deviceId != null ? (_ref = (_bridgeSignals_limitAdTracking = bridgeSignals.limitAdTracking) !== null && _bridgeSignals_limitAdTracking !== void 0 ? _bridgeSignals_limitAdTracking : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
|
|
2338
|
+
if (isCtv) {
|
|
2339
|
+
return _object_spread_props(_object_spread({
|
|
2340
|
+
isCtv: true,
|
|
2341
|
+
contentUrl: bridgeSignals.contentUrl || readStoredString("contentUrl") || AIRY_DEFAULT_CONTENT_URL,
|
|
2342
|
+
appId: bridgeSignals.appId || readStoredString("appId") || readStoredString("msid") || AIRY_ANDROID_APP_ID,
|
|
2343
|
+
appName: bridgeSignals.appName || readStoredString("appName") || readStoredString("an") || AIRY_APP_NAME,
|
|
2344
|
+
sessionId: getOrCreateCtvSessionId()
|
|
2345
|
+
}, deviceId ? {
|
|
2346
|
+
deviceId: deviceId
|
|
2347
|
+
} : {}, deviceIdType ? {
|
|
2348
|
+
deviceIdType: deviceIdType
|
|
2349
|
+
} : {}, limitAdTracking != null ? {
|
|
2350
|
+
limitAdTracking: limitAdTracking
|
|
2351
|
+
} : {}), {
|
|
2352
|
+
deviceTypeHint: 5
|
|
2353
|
+
});
|
|
2354
|
+
}
|
|
2355
|
+
return _object_spread({
|
|
2356
|
+
isCtv: false
|
|
2357
|
+
}, deviceId ? {
|
|
2358
|
+
deviceId: deviceId
|
|
2359
|
+
} : {}, deviceIdType ? {
|
|
2360
|
+
deviceIdType: deviceIdType
|
|
2361
|
+
} : {}, limitAdTracking != null ? {
|
|
2362
|
+
limitAdTracking: limitAdTracking
|
|
2363
|
+
} : {});
|
|
2364
|
+
}
|
|
2365
|
+
function inferDeviceIdType() {
|
|
2366
|
+
if (typeof navigator === "undefined") {
|
|
2367
|
+
return void 0;
|
|
2368
|
+
}
|
|
2369
|
+
var ua = navigator.userAgent;
|
|
2370
|
+
if (/Roku/i.test(ua)) return "rida";
|
|
2371
|
+
if (/Tizen|Samsung/i.test(ua)) return "tifa";
|
|
2372
|
+
if (/AppleTV|Apple TV/i.test(ua)) return "tvOS";
|
|
2373
|
+
if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
|
|
2374
|
+
if (/Web0S|webOS|LG Browser|LGSTB|LGE/i.test(ua)) return "lgudid";
|
|
2375
|
+
if (/Android|Google TV/i.test(ua)) return "aaid";
|
|
2376
|
+
if (/iPhone|iPad|iPod/i.test(ua)) return "idfa";
|
|
2377
|
+
return void 0;
|
|
2378
|
+
}
|
|
2379
|
+
function isEquivalentDeviceIdType(tagType, runtimeType) {
|
|
2380
|
+
if (!tagType || !runtimeType) return false;
|
|
2381
|
+
var tag = tagType.toLowerCase();
|
|
2382
|
+
var runtime = runtimeType.toLowerCase();
|
|
2383
|
+
if (tag === runtime) return true;
|
|
2384
|
+
return ANDROID_ID_TYPES.has(tag) && ANDROID_ID_TYPES.has(runtime);
|
|
2385
|
+
}
|
|
2386
|
+
function getOrCreateCtvSessionId() {
|
|
2387
|
+
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
2388
|
+
if (existing) {
|
|
2389
|
+
return existing;
|
|
2390
|
+
}
|
|
2391
|
+
var sessionId = createUuid();
|
|
2392
|
+
try {
|
|
2393
|
+
var _window_localStorage;
|
|
2394
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
2395
|
+
} catch (unused) {}
|
|
2396
|
+
return sessionId;
|
|
2397
|
+
}
|
|
2398
|
+
function createUuid() {
|
|
2399
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
2400
|
+
return crypto.randomUUID();
|
|
2401
|
+
}
|
|
2402
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
|
|
2403
|
+
var value = Math.floor(Math.random() * 16);
|
|
2404
|
+
var nibble = char === "x" ? value : value & 3 | 8;
|
|
2405
|
+
return nibble.toString(16);
|
|
2406
|
+
});
|
|
2407
|
+
}
|
|
2408
|
+
function readNativeBridgeSignals() {
|
|
2409
|
+
if (typeof window === "undefined") {
|
|
2410
|
+
return {};
|
|
2411
|
+
}
|
|
2412
|
+
var candidates = [
|
|
2413
|
+
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
2414
|
+
window.__STORMCLOUD_CTV__,
|
|
2415
|
+
window.stormcloudCtv,
|
|
2416
|
+
window.AiryTV,
|
|
2417
|
+
window.Android,
|
|
2418
|
+
window.webOS,
|
|
2419
|
+
window.tizen,
|
|
2420
|
+
window.amazon
|
|
2421
|
+
].filter(Boolean);
|
|
2422
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2423
|
+
try {
|
|
2424
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2425
|
+
var source = _step.value;
|
|
2426
|
+
var contentUrl = readBridgeValue(source, [
|
|
2427
|
+
"contentUrl",
|
|
2428
|
+
"url",
|
|
2429
|
+
"videoUrl",
|
|
2430
|
+
"canonicalUrl"
|
|
2431
|
+
]) || void 0;
|
|
2432
|
+
var appId = readBridgeValue(source, [
|
|
2433
|
+
"appId",
|
|
2434
|
+
"msid",
|
|
2435
|
+
"applicationId",
|
|
2436
|
+
"packageName"
|
|
2437
|
+
]) || void 0;
|
|
2438
|
+
var appName = readBridgeValue(source, [
|
|
2439
|
+
"appName",
|
|
2440
|
+
"an",
|
|
2441
|
+
"applicationName"
|
|
2442
|
+
]) || void 0;
|
|
2443
|
+
var deviceId = readBridgeValue(source, [
|
|
2444
|
+
"rdid",
|
|
2445
|
+
"ifa",
|
|
2446
|
+
"advertisingId",
|
|
2447
|
+
"adId",
|
|
2448
|
+
"deviceId",
|
|
2449
|
+
"lgudid",
|
|
2450
|
+
"LGUDID",
|
|
2451
|
+
"tifa",
|
|
2452
|
+
"rida",
|
|
2453
|
+
"afai",
|
|
2454
|
+
"aaid"
|
|
2455
|
+
]) || void 0;
|
|
2456
|
+
if (!contentUrl && !deviceId && !appId && !appName) continue;
|
|
2457
|
+
var deviceIdType = readBridgeValue(source, [
|
|
2458
|
+
"idtype",
|
|
2459
|
+
"deviceIdType",
|
|
2460
|
+
"advertisingIdType",
|
|
2461
|
+
"idType"
|
|
2462
|
+
]) || inferDeviceIdType();
|
|
2463
|
+
var limitAdTracking = readBridgeBoolean(source, [
|
|
2464
|
+
"is_lat",
|
|
2465
|
+
"limitAdTracking",
|
|
2466
|
+
"limitedAdTracking",
|
|
2467
|
+
"lat"
|
|
2468
|
+
]);
|
|
2469
|
+
return _object_spread({}, contentUrl ? {
|
|
2470
|
+
contentUrl: contentUrl
|
|
2471
|
+
} : {}, appId ? {
|
|
2472
|
+
appId: appId
|
|
2473
|
+
} : {}, appName ? {
|
|
2474
|
+
appName: appName
|
|
2475
|
+
} : {}, deviceId ? {
|
|
2476
|
+
deviceId: deviceId
|
|
2477
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2478
|
+
deviceIdType: deviceIdType
|
|
2479
|
+
} : {}, deviceId && limitAdTracking != null ? {
|
|
2480
|
+
limitAdTracking: limitAdTracking
|
|
2481
|
+
} : {});
|
|
2482
|
+
}
|
|
2483
|
+
} catch (err) {
|
|
2484
|
+
_didIteratorError = true;
|
|
2485
|
+
_iteratorError = err;
|
|
2486
|
+
} finally{
|
|
2487
|
+
try {
|
|
2488
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2489
|
+
_iterator.return();
|
|
2490
|
+
}
|
|
2491
|
+
} finally{
|
|
2492
|
+
if (_didIteratorError) {
|
|
2493
|
+
throw _iteratorError;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
return {};
|
|
2498
|
+
}
|
|
2499
|
+
function readBridgeValue(source, keys) {
|
|
2500
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2501
|
+
try {
|
|
2502
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2503
|
+
var key = _step.value;
|
|
2504
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2505
|
+
if (typeof value === "string" && value) {
|
|
2506
|
+
return value;
|
|
2507
|
+
}
|
|
2508
|
+
if (typeof value === "function") {
|
|
2509
|
+
try {
|
|
2510
|
+
var result = value.call(source);
|
|
2511
|
+
if (typeof result === "string" && result) {
|
|
2512
|
+
return result;
|
|
2513
|
+
}
|
|
2514
|
+
} catch (unused) {}
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
} catch (err) {
|
|
2518
|
+
_didIteratorError = true;
|
|
2519
|
+
_iteratorError = err;
|
|
2520
|
+
} finally{
|
|
2521
|
+
try {
|
|
2522
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2523
|
+
_iterator.return();
|
|
2524
|
+
}
|
|
2525
|
+
} finally{
|
|
2526
|
+
if (_didIteratorError) {
|
|
2527
|
+
throw _iteratorError;
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
return void 0;
|
|
2532
|
+
}
|
|
2533
|
+
function readBridgeBoolean(source, keys) {
|
|
2534
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2535
|
+
try {
|
|
2536
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2537
|
+
var key = _step.value;
|
|
2538
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2539
|
+
var normalized = normalizeBoolean(value);
|
|
2540
|
+
if (normalized != null) {
|
|
2541
|
+
return normalized;
|
|
2542
|
+
}
|
|
2543
|
+
if (typeof value === "function") {
|
|
2544
|
+
try {
|
|
2545
|
+
var result = normalizeBoolean(value.call(source));
|
|
2546
|
+
if (result != null) {
|
|
2547
|
+
return result;
|
|
2548
|
+
}
|
|
2549
|
+
} catch (unused) {}
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
} catch (err) {
|
|
2553
|
+
_didIteratorError = true;
|
|
2554
|
+
_iteratorError = err;
|
|
2555
|
+
} finally{
|
|
2556
|
+
try {
|
|
2557
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2558
|
+
_iterator.return();
|
|
2559
|
+
}
|
|
2560
|
+
} finally{
|
|
2561
|
+
if (_didIteratorError) {
|
|
2562
|
+
throw _iteratorError;
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
return void 0;
|
|
2567
|
+
}
|
|
2568
|
+
function readStoredDeviceId() {
|
|
2569
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2570
|
+
try {
|
|
2571
|
+
for(var _iterator = DEVICE_ID_STORAGE_KEYS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2572
|
+
var key = _step.value;
|
|
2573
|
+
var value = readStoredString(key);
|
|
2574
|
+
if (value) {
|
|
2575
|
+
return value;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
} catch (err) {
|
|
2579
|
+
_didIteratorError = true;
|
|
2580
|
+
_iteratorError = err;
|
|
2581
|
+
} finally{
|
|
2582
|
+
try {
|
|
2583
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2584
|
+
_iterator.return();
|
|
2585
|
+
}
|
|
2586
|
+
} finally{
|
|
2587
|
+
if (_didIteratorError) {
|
|
2588
|
+
throw _iteratorError;
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
return void 0;
|
|
2593
|
+
}
|
|
2594
|
+
function readStoredString(key) {
|
|
2595
|
+
if (typeof window === "undefined") {
|
|
2596
|
+
return void 0;
|
|
2597
|
+
}
|
|
2598
|
+
try {
|
|
2599
|
+
var _window_localStorage;
|
|
2600
|
+
var value = (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key);
|
|
2601
|
+
return value || void 0;
|
|
2602
|
+
} catch (unused) {
|
|
2603
|
+
return void 0;
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
function readStoredLimitAdTracking() {
|
|
2607
|
+
return normalizeBoolean(readStoredString("limitAdTracking") || readStoredString("limitedAdTracking") || readStoredString("is_lat"));
|
|
2608
|
+
}
|
|
2609
|
+
function normalizeBoolean(value) {
|
|
2610
|
+
if (typeof value === "boolean") {
|
|
2611
|
+
return value;
|
|
2612
|
+
}
|
|
2613
|
+
if (typeof value === "number") {
|
|
2614
|
+
return value === 1;
|
|
2615
|
+
}
|
|
2616
|
+
if (typeof value === "string") {
|
|
2617
|
+
var normalized = value.toLowerCase();
|
|
2618
|
+
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
2619
|
+
return true;
|
|
2620
|
+
}
|
|
2621
|
+
if (normalized === "0" || normalized === "false" || normalized === "no") {
|
|
2622
|
+
return false;
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
return void 0;
|
|
2626
|
+
}
|
|
2311
2627
|
// src/utils/vastMacros.ts
|
|
2628
|
+
var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
|
|
2629
|
+
var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
|
|
2630
|
+
var EXAMPLE_COM_URL = /example\.com/i;
|
|
2631
|
+
var CTV_UNSUPPORTED_PARAMS = [
|
|
2632
|
+
"description_url",
|
|
2633
|
+
"tfcd",
|
|
2634
|
+
"npa",
|
|
2635
|
+
"min_ad_duration",
|
|
2636
|
+
"max_ad_duration",
|
|
2637
|
+
"unviewed_position_start",
|
|
2638
|
+
"impl",
|
|
2639
|
+
"scor",
|
|
2640
|
+
"vad_type",
|
|
2641
|
+
"gdpr",
|
|
2642
|
+
"gdpr_consent",
|
|
2643
|
+
"us_privacy"
|
|
2644
|
+
];
|
|
2645
|
+
var INLINE_DEVICE_MACRO_REPLACEMENTS = [
|
|
2646
|
+
{
|
|
2647
|
+
pattern: /\[RDID\]/gi,
|
|
2648
|
+
getValue: function getValue(ctx) {
|
|
2649
|
+
return ctx.deviceId;
|
|
2650
|
+
}
|
|
2651
|
+
},
|
|
2652
|
+
{
|
|
2653
|
+
pattern: /\[IFA\]/gi,
|
|
2654
|
+
getValue: function getValue(ctx) {
|
|
2655
|
+
return ctx.deviceId;
|
|
2656
|
+
}
|
|
2657
|
+
},
|
|
2658
|
+
{
|
|
2659
|
+
pattern: /\[ADVERTISING[_-]?ID(?:ENTIFIER)?\]/gi,
|
|
2660
|
+
getValue: function getValue(ctx) {
|
|
2661
|
+
return ctx.deviceId;
|
|
2662
|
+
}
|
|
2663
|
+
},
|
|
2664
|
+
{
|
|
2665
|
+
pattern: /\[DEVICE[_-]?ID\]/gi,
|
|
2666
|
+
getValue: function getValue(ctx) {
|
|
2667
|
+
return ctx.deviceId;
|
|
2668
|
+
}
|
|
2669
|
+
},
|
|
2670
|
+
{
|
|
2671
|
+
pattern: /\[IDTYPE\]/gi,
|
|
2672
|
+
getValue: function getValue(ctx) {
|
|
2673
|
+
return ctx.deviceIdType;
|
|
2674
|
+
}
|
|
2675
|
+
},
|
|
2676
|
+
{
|
|
2677
|
+
pattern: /\{rdid\}/gi,
|
|
2678
|
+
getValue: function getValue(ctx) {
|
|
2679
|
+
return ctx.deviceId;
|
|
2680
|
+
}
|
|
2681
|
+
},
|
|
2682
|
+
{
|
|
2683
|
+
pattern: /\{device[_-]?id\}/gi,
|
|
2684
|
+
getValue: function getValue(ctx) {
|
|
2685
|
+
return ctx.deviceId;
|
|
2686
|
+
}
|
|
2687
|
+
},
|
|
2688
|
+
{
|
|
2689
|
+
pattern: /\{idtype\}/gi,
|
|
2690
|
+
getValue: function getValue(ctx) {
|
|
2691
|
+
return ctx.deviceIdType;
|
|
2692
|
+
}
|
|
2693
|
+
},
|
|
2694
|
+
{
|
|
2695
|
+
pattern: /%%ADVERTISING_IDENTIFIER_PLAIN%%/gi,
|
|
2696
|
+
getValue: function getValue(ctx) {
|
|
2697
|
+
return ctx.deviceId;
|
|
2698
|
+
}
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
pattern: /%%ADVERTISING_ID_OPT_OUT%%/gi,
|
|
2702
|
+
getValue: function getValue(ctx) {
|
|
2703
|
+
return ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
|
|
2704
|
+
}
|
|
2705
|
+
},
|
|
2706
|
+
{
|
|
2707
|
+
pattern: /%%ADVERTISING_ID_TYPE%%/gi,
|
|
2708
|
+
getValue: function getValue(ctx) {
|
|
2709
|
+
return ctx.deviceIdType;
|
|
2710
|
+
}
|
|
2711
|
+
},
|
|
2712
|
+
{
|
|
2713
|
+
pattern: /%%ADVERTISING_ID%%/gi,
|
|
2714
|
+
getValue: function getValue(ctx) {
|
|
2715
|
+
return ctx.deviceId;
|
|
2716
|
+
}
|
|
2717
|
+
},
|
|
2718
|
+
{
|
|
2719
|
+
pattern: /%%LIMIT_AD_TRACKING%%/gi,
|
|
2720
|
+
getValue: function getValue(ctx) {
|
|
2721
|
+
return ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
|
|
2722
|
+
}
|
|
2723
|
+
},
|
|
2724
|
+
{
|
|
2725
|
+
pattern: /%%MSID%%/gi,
|
|
2726
|
+
getValue: function getValue(ctx) {
|
|
2727
|
+
return ctx.appId;
|
|
2728
|
+
}
|
|
2729
|
+
},
|
|
2730
|
+
{
|
|
2731
|
+
pattern: /%%APP_NAME%%/gi,
|
|
2732
|
+
getValue: function getValue(ctx) {
|
|
2733
|
+
return ctx.appName;
|
|
2734
|
+
}
|
|
2735
|
+
},
|
|
2736
|
+
{
|
|
2737
|
+
pattern: /%%SESSION_ID%%/gi,
|
|
2738
|
+
getValue: function getValue(ctx) {
|
|
2739
|
+
return ctx.sessionId;
|
|
2740
|
+
}
|
|
2741
|
+
},
|
|
2742
|
+
{
|
|
2743
|
+
pattern: /%%CORRELATOR%%/gi,
|
|
2744
|
+
getValue: function getValue(ctx) {
|
|
2745
|
+
return ctx.correlator;
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
];
|
|
2749
|
+
function isMacroPlaceholder(value) {
|
|
2750
|
+
if (value == null) return true;
|
|
2751
|
+
var trimmed = value.trim();
|
|
2752
|
+
if (!trimmed) return true;
|
|
2753
|
+
if (UNEXPANDED_MACRO_PATTERN.test(trimmed)) return true;
|
|
2754
|
+
return /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(trimmed);
|
|
2755
|
+
}
|
|
2312
2756
|
function generateCorrelator() {
|
|
2313
2757
|
if (typeof crypto !== "undefined" && crypto.getRandomValues) {
|
|
2314
2758
|
try {
|
|
@@ -2323,29 +2767,140 @@ function generateCorrelator() {
|
|
|
2323
2767
|
}
|
|
2324
2768
|
return String(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER) + 1);
|
|
2325
2769
|
}
|
|
2326
|
-
|
|
2327
|
-
var
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2770
|
+
function expandInlineMacroPlaceholders(baseUrl, ctx) {
|
|
2771
|
+
var url = baseUrl;
|
|
2772
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2773
|
+
try {
|
|
2774
|
+
for(var _iterator = INLINE_DEVICE_MACRO_REPLACEMENTS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2775
|
+
var _step_value = _step.value, pattern = _step_value.pattern, getValue = _step_value.getValue;
|
|
2776
|
+
var value = getValue(ctx);
|
|
2777
|
+
if (value != null && value !== "") {
|
|
2778
|
+
url = url.replace(pattern, encodeURIComponent(value));
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
} catch (err) {
|
|
2782
|
+
_didIteratorError = true;
|
|
2783
|
+
_iteratorError = err;
|
|
2784
|
+
} finally{
|
|
2785
|
+
try {
|
|
2786
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2787
|
+
_iterator.return();
|
|
2788
|
+
}
|
|
2789
|
+
} finally{
|
|
2790
|
+
if (_didIteratorError) {
|
|
2791
|
+
throw _iteratorError;
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
return url;
|
|
2796
|
+
}
|
|
2797
|
+
function applyDeviceIdentityParams(params, ctx) {
|
|
2798
|
+
var _ctx_deviceId, _ctx_deviceIdType;
|
|
2799
|
+
var runtimeId = (_ctx_deviceId = ctx.deviceId) === null || _ctx_deviceId === void 0 ? void 0 : _ctx_deviceId.trim();
|
|
2800
|
+
var runtimeType = ((_ctx_deviceIdType = ctx.deviceIdType) === null || _ctx_deviceIdType === void 0 ? void 0 : _ctx_deviceIdType.trim()) || inferDeviceIdType();
|
|
2801
|
+
var tagRdid = params.get("rdid");
|
|
2802
|
+
var tagType = params.get("idtype");
|
|
2803
|
+
var tagLat = params.get("is_lat");
|
|
2804
|
+
var latValue = ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
|
|
2805
|
+
if (runtimeId) {
|
|
2806
|
+
params.set("rdid", runtimeId);
|
|
2807
|
+
params.set("idtype", runtimeType || tagType || "aaid");
|
|
2808
|
+
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : isMacroPlaceholder(tagLat) ? "0" : tagLat);
|
|
2809
|
+
return;
|
|
2810
|
+
}
|
|
2811
|
+
var tagRdidValid = Boolean(tagRdid && !isMacroPlaceholder(tagRdid));
|
|
2812
|
+
var tagTypeValid = Boolean(tagType && !isMacroPlaceholder(tagType));
|
|
2813
|
+
if (tagRdidValid && tagTypeValid && runtimeType && !isEquivalentDeviceIdType(tagType, runtimeType)) {
|
|
2814
|
+
params.delete("rdid");
|
|
2815
|
+
params.delete("idtype");
|
|
2816
|
+
params.delete("is_lat");
|
|
2817
|
+
return;
|
|
2818
|
+
}
|
|
2819
|
+
if (tagRdidValid) {
|
|
2820
|
+
if (isMacroPlaceholder(tagType) && runtimeType) {
|
|
2821
|
+
params.set("idtype", runtimeType);
|
|
2822
|
+
}
|
|
2823
|
+
if (isMacroPlaceholder(tagLat)) {
|
|
2824
|
+
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : "0");
|
|
2825
|
+
}
|
|
2826
|
+
return;
|
|
2827
|
+
}
|
|
2828
|
+
params.delete("rdid");
|
|
2829
|
+
params.delete("idtype");
|
|
2830
|
+
params.delete("is_lat");
|
|
2831
|
+
}
|
|
2832
|
+
function removeBrokenAppNameOrphans(params, appName) {
|
|
2833
|
+
var toDelete = [];
|
|
2834
|
+
params.forEach(function(_value, key) {
|
|
2835
|
+
if (!key || INVALID_VAST_PARAM_KEY.test(key)) {
|
|
2836
|
+
toDelete.push(key);
|
|
2837
|
+
}
|
|
2838
|
+
});
|
|
2839
|
+
if (appName && appName.includes("&")) {
|
|
2840
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2841
|
+
try {
|
|
2842
|
+
for(var _iterator = appName.split("&").slice(1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2843
|
+
var suffix = _step.value;
|
|
2844
|
+
var trimmed = suffix.trimStart();
|
|
2845
|
+
if (!trimmed) continue;
|
|
2846
|
+
toDelete.push(suffix, " ".concat(trimmed), trimmed);
|
|
2847
|
+
}
|
|
2848
|
+
} catch (err) {
|
|
2849
|
+
_didIteratorError = true;
|
|
2850
|
+
_iteratorError = err;
|
|
2851
|
+
} finally{
|
|
2852
|
+
try {
|
|
2853
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2854
|
+
_iterator.return();
|
|
2855
|
+
}
|
|
2856
|
+
} finally{
|
|
2857
|
+
if (_didIteratorError) {
|
|
2858
|
+
throw _iteratorError;
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
2864
|
+
try {
|
|
2865
|
+
for(var _iterator1 = new Set(toDelete)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2866
|
+
var key = _step1.value;
|
|
2867
|
+
if (key) params.delete(key);
|
|
2868
|
+
}
|
|
2869
|
+
} catch (err) {
|
|
2870
|
+
_didIteratorError1 = true;
|
|
2871
|
+
_iteratorError1 = err;
|
|
2872
|
+
} finally{
|
|
2873
|
+
try {
|
|
2874
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
2875
|
+
_iterator1.return();
|
|
2876
|
+
}
|
|
2877
|
+
} finally{
|
|
2878
|
+
if (_didIteratorError1) {
|
|
2879
|
+
throw _iteratorError1;
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
function normalizeVastTagUrl(raw) {
|
|
2885
|
+
if (!raw) return raw;
|
|
2886
|
+
try {
|
|
2887
|
+
var url = new URL(raw);
|
|
2888
|
+
removeBrokenAppNameOrphans(url.searchParams);
|
|
2889
|
+
return url.toString();
|
|
2890
|
+
} catch (unused) {
|
|
2891
|
+
return raw;
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2341
2894
|
function applyVastMacros(baseUrl, ctx) {
|
|
2895
|
+
var expandedUrl = expandInlineMacroPlaceholders(baseUrl, ctx);
|
|
2342
2896
|
var url;
|
|
2343
2897
|
try {
|
|
2344
|
-
url = new URL(
|
|
2898
|
+
url = new URL(normalizeVastTagUrl(expandedUrl));
|
|
2345
2899
|
} catch (unused) {
|
|
2346
|
-
return replaceCorrelatorFallback(
|
|
2900
|
+
return replaceCorrelatorFallback(expandedUrl, ctx.correlator);
|
|
2347
2901
|
}
|
|
2348
2902
|
var params = url.searchParams;
|
|
2903
|
+
removeBrokenAppNameOrphans(params, ctx.appName);
|
|
2349
2904
|
params.set("correlator", ctx.correlator);
|
|
2350
2905
|
if (ctx.isCtv) {
|
|
2351
2906
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -2383,6 +2938,12 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2383
2938
|
if (!ctx.isCtv) {
|
|
2384
2939
|
params.set("description_url", requestUrl);
|
|
2385
2940
|
}
|
|
2941
|
+
} else {
|
|
2942
|
+
var existingUrl = params.get("url") || "";
|
|
2943
|
+
if (EXAMPLE_COM_URL.test(existingUrl)) {
|
|
2944
|
+
params.delete("url");
|
|
2945
|
+
params.delete("description_url");
|
|
2946
|
+
}
|
|
2386
2947
|
}
|
|
2387
2948
|
if (ctx.adWillPlayMuted != null) {
|
|
2388
2949
|
params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
|
|
@@ -2394,6 +2955,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2394
2955
|
params.set("msid", ctx.appId);
|
|
2395
2956
|
}
|
|
2396
2957
|
if (ctx.appName) {
|
|
2958
|
+
removeBrokenAppNameOrphans(params, ctx.appName);
|
|
2397
2959
|
params.set("an", ctx.appName);
|
|
2398
2960
|
}
|
|
2399
2961
|
if (ctx.sessionId) {
|
|
@@ -2404,15 +2966,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2404
2966
|
} else if (ctx.isCtv) {
|
|
2405
2967
|
params.set("dth", "5");
|
|
2406
2968
|
}
|
|
2407
|
-
|
|
2408
|
-
params.set("rdid", ctx.deviceId);
|
|
2409
|
-
params.set("idtype", ctx.deviceIdType);
|
|
2410
|
-
params.set("is_lat", ctx.limitAdTracking ? "1" : "0");
|
|
2411
|
-
} else {
|
|
2412
|
-
params.delete("rdid");
|
|
2413
|
-
params.delete("idtype");
|
|
2414
|
-
params.delete("is_lat");
|
|
2415
|
-
}
|
|
2969
|
+
applyDeviceIdentityParams(params, ctx);
|
|
2416
2970
|
if (!ctx.isCtv) {
|
|
2417
2971
|
var consent = ctx.consent;
|
|
2418
2972
|
if ((consent === null || consent === void 0 ? void 0 : consent.gdpr) != null) {
|
|
@@ -2430,7 +2984,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2430
2984
|
}
|
|
2431
2985
|
var staleKeys = [];
|
|
2432
2986
|
params.forEach(function(value, key) {
|
|
2433
|
-
if (
|
|
2987
|
+
if (isMacroPlaceholder(value)) {
|
|
2434
2988
|
staleKeys.push(key);
|
|
2435
2989
|
}
|
|
2436
2990
|
});
|
|
@@ -2454,6 +3008,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2454
3008
|
}
|
|
2455
3009
|
}
|
|
2456
3010
|
}
|
|
3011
|
+
removeBrokenAppNameOrphans(params, ctx.appName);
|
|
2457
3012
|
return url.toString();
|
|
2458
3013
|
}
|
|
2459
3014
|
function replaceCorrelatorFallback(baseUrl, correlator) {
|
|
@@ -3464,516 +4019,250 @@ var Scte35CueManager = /*#__PURE__*/ function() {
|
|
|
3464
4019
|
this.callbacks = callbacks;
|
|
3465
4020
|
}
|
|
3466
4021
|
_create_class(Scte35CueManager, [
|
|
3467
|
-
{
|
|
3468
|
-
key: "pendingScte35CueKey",
|
|
3469
|
-
get: function get() {
|
|
3470
|
-
return this.pendingScte35CueKeyValue;
|
|
3471
|
-
},
|
|
3472
|
-
set: function set(value) {
|
|
3473
|
-
this.pendingScte35CueKeyValue = value;
|
|
3474
|
-
}
|
|
3475
|
-
},
|
|
3476
|
-
{
|
|
3477
|
-
key: "activeScte35BreakKey",
|
|
3478
|
-
get: function get() {
|
|
3479
|
-
return this.activeScte35BreakKeyValue;
|
|
3480
|
-
},
|
|
3481
|
-
set: function set(value) {
|
|
3482
|
-
this.activeScte35BreakKeyValue = value;
|
|
3483
|
-
}
|
|
3484
|
-
},
|
|
3485
|
-
{
|
|
3486
|
-
key: "scheduledScte35BreakKey",
|
|
3487
|
-
get: function get() {
|
|
3488
|
-
return this.scheduledScte35BreakKeyValue;
|
|
3489
|
-
},
|
|
3490
|
-
set: function set(value) {
|
|
3491
|
-
this.scheduledScte35BreakKeyValue = value;
|
|
3492
|
-
}
|
|
3493
|
-
},
|
|
3494
|
-
{
|
|
3495
|
-
key: "createScte35CueContext",
|
|
3496
|
-
value: function createScte35CueContext(source, readiness, frag) {
|
|
3497
|
-
var context = {
|
|
3498
|
-
source: source,
|
|
3499
|
-
readiness: readiness
|
|
3500
|
-
};
|
|
3501
|
-
if (typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number") {
|
|
3502
|
-
context.fragmentSn = frag.sn;
|
|
3503
|
-
}
|
|
3504
|
-
var fragmentStartSec = getFragmentStartSeconds(frag);
|
|
3505
|
-
if (fragmentStartSec !== void 0) {
|
|
3506
|
-
context.fragmentStartSeconds = fragmentStartSec;
|
|
3507
|
-
}
|
|
3508
|
-
return context;
|
|
3509
|
-
}
|
|
3510
|
-
},
|
|
3511
|
-
{
|
|
3512
|
-
key: "onScte35Cue",
|
|
3513
|
-
value: function onScte35Cue(marker, context) {
|
|
3514
|
-
var cue = this.createScte35Cue(marker, context);
|
|
3515
|
-
var pendingKey = this.getPendingScte35CueKey(cue);
|
|
3516
|
-
if (context.readiness === "early") {
|
|
3517
|
-
this.pendingScte35Cues.set(pendingKey, cue);
|
|
3518
|
-
this.trimRecentScte35CueMaps();
|
|
3519
|
-
if (marker.type === "start") {
|
|
3520
|
-
this.callbacks.onEarlyStartCue(marker, context.fragmentSn, cue.key);
|
|
3521
|
-
}
|
|
3522
|
-
return;
|
|
3523
|
-
}
|
|
3524
|
-
if (marker.type === "end" && !this.shouldAcceptScte35EndCue(cue)) {
|
|
3525
|
-
if (this.debug) {
|
|
3526
|
-
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end cue", {
|
|
3527
|
-
key: cue.key,
|
|
3528
|
-
activeScte35BreakKey: this.activeScte35BreakKeyValue,
|
|
3529
|
-
inAdBreak: this.callbacks.isInAdBreak(),
|
|
3530
|
-
source: cue.source
|
|
3531
|
-
});
|
|
3532
|
-
}
|
|
3533
|
-
return;
|
|
3534
|
-
}
|
|
3535
|
-
if (marker.type === "start" && this.hasRecentlyHandledScte35Cue(cue)) {
|
|
3536
|
-
if (this.debug) {
|
|
3537
|
-
console.log("[StormcloudVideoPlayer] Ignoring duplicate SCTE-35 start cue", {
|
|
3538
|
-
key: cue.key,
|
|
3539
|
-
source: cue.source
|
|
3540
|
-
});
|
|
3541
|
-
}
|
|
3542
|
-
return;
|
|
3543
|
-
}
|
|
3544
|
-
this.pendingScte35Cues.delete(pendingKey);
|
|
3545
|
-
this.markScte35CueHandled(cue);
|
|
3546
|
-
this.callbacks.onPlaybackCue(marker, cue.key);
|
|
3547
|
-
}
|
|
3548
|
-
},
|
|
3549
|
-
{
|
|
3550
|
-
key: "activatePendingScte35CuesForFragment",
|
|
3551
|
-
value: function activatePendingScte35CuesForFragment(frag) {
|
|
3552
|
-
var _this = this;
|
|
3553
|
-
var fragmentSn = typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number" ? frag.sn : void 0;
|
|
3554
|
-
if (fragmentSn === void 0) {
|
|
3555
|
-
return;
|
|
3556
|
-
}
|
|
3557
|
-
var matchingCues = Array.from(this.pendingScte35Cues.entries()).filter(function(param) {
|
|
3558
|
-
var _param = _sliced_to_array(param, 2), cue = _param[1];
|
|
3559
|
-
return cue.fragmentSn === fragmentSn;
|
|
3560
|
-
});
|
|
3561
|
-
matchingCues.forEach(function(param) {
|
|
3562
|
-
var _param = _sliced_to_array(param, 2), pendingKey = _param[0], cue = _param[1];
|
|
3563
|
-
var _cue_fragmentStartSeconds;
|
|
3564
|
-
_this.pendingScte35Cues.delete(pendingKey);
|
|
3565
|
-
var context = {
|
|
3566
|
-
source: cue.source,
|
|
3567
|
-
readiness: "playback"
|
|
3568
|
-
};
|
|
3569
|
-
context.fragmentSn = fragmentSn;
|
|
3570
|
-
var fragmentStartSec = (_cue_fragmentStartSeconds = cue.fragmentStartSeconds) !== null && _cue_fragmentStartSeconds !== void 0 ? _cue_fragmentStartSeconds : getFragmentStartSeconds(frag);
|
|
3571
|
-
if (fragmentStartSec !== void 0) {
|
|
3572
|
-
context.fragmentStartSeconds = fragmentStartSec;
|
|
3573
|
-
}
|
|
3574
|
-
_this.onScte35Cue(cue.marker, context);
|
|
3575
|
-
});
|
|
3576
|
-
}
|
|
3577
|
-
},
|
|
3578
|
-
{
|
|
3579
|
-
key: "createScte35Cue",
|
|
3580
|
-
value: function createScte35Cue(marker, context) {
|
|
3581
|
-
var cue = {
|
|
3582
|
-
marker: marker,
|
|
3583
|
-
source: context.source,
|
|
3584
|
-
readiness: context.readiness,
|
|
3585
|
-
key: this.getScte35CueKey(marker, context)
|
|
3586
|
-
};
|
|
3587
|
-
if (context.fragmentSn !== void 0) {
|
|
3588
|
-
cue.fragmentSn = context.fragmentSn;
|
|
3589
|
-
}
|
|
3590
|
-
if (context.fragmentStartSeconds !== void 0) {
|
|
3591
|
-
cue.fragmentStartSeconds = context.fragmentStartSeconds;
|
|
3592
|
-
}
|
|
3593
|
-
return cue;
|
|
3594
|
-
}
|
|
3595
|
-
},
|
|
3596
|
-
{
|
|
3597
|
-
key: "getScte35CueKey",
|
|
3598
|
-
value: function getScte35CueKey(marker, context) {
|
|
3599
|
-
var _raw_attrs, _raw_attrs1, _raw_attrs2;
|
|
3600
|
-
var raw = this.getScte35MarkerRaw(marker);
|
|
3601
|
-
var spliceEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.splice_event_id);
|
|
3602
|
-
if (spliceEventId) {
|
|
3603
|
-
return "splice:".concat(spliceEventId);
|
|
3604
|
-
}
|
|
3605
|
-
var segmentationEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.segmentation_event_id);
|
|
3606
|
-
if (segmentationEventId) {
|
|
3607
|
-
return "segmentation:".concat(segmentationEventId);
|
|
3608
|
-
}
|
|
3609
|
-
var daterangeId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs = raw.attrs) === null || _raw_attrs === void 0 ? void 0 : _raw_attrs.ID);
|
|
3610
|
-
if (daterangeId) {
|
|
3611
|
-
return "daterange:".concat(daterangeId);
|
|
3612
|
-
}
|
|
3613
|
-
var scteValue = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs1 = raw.attrs) === null || _raw_attrs1 === void 0 ? void 0 : _raw_attrs1["SCTE35-OUT"]) || this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs2 = raw.attrs) === null || _raw_attrs2 === void 0 ? void 0 : _raw_attrs2["SCTE35-IN"]);
|
|
3614
|
-
if (scteValue) {
|
|
3615
|
-
return "daterange-scte:".concat(scteValue);
|
|
3616
|
-
}
|
|
3617
|
-
if (typeof marker.ptsSeconds === "number" && Number.isFinite(marker.ptsSeconds)) {
|
|
3618
|
-
return "pts:".concat(Math.round(marker.ptsSeconds * 2) / 2);
|
|
3619
|
-
}
|
|
3620
|
-
if (context.fragmentSn !== void 0) {
|
|
3621
|
-
return "fragment:".concat(context.fragmentSn);
|
|
3622
|
-
}
|
|
3623
|
-
return "".concat(context.source, ":wallclock:").concat(Math.floor(Date.now() / 1e3));
|
|
4022
|
+
{
|
|
4023
|
+
key: "pendingScte35CueKey",
|
|
4024
|
+
get: function get() {
|
|
4025
|
+
return this.pendingScte35CueKeyValue;
|
|
4026
|
+
},
|
|
4027
|
+
set: function set(value) {
|
|
4028
|
+
this.pendingScte35CueKeyValue = value;
|
|
3624
4029
|
}
|
|
3625
4030
|
},
|
|
3626
4031
|
{
|
|
3627
|
-
key: "
|
|
3628
|
-
|
|
3629
|
-
return
|
|
4032
|
+
key: "activeScte35BreakKey",
|
|
4033
|
+
get: function get() {
|
|
4034
|
+
return this.activeScte35BreakKeyValue;
|
|
4035
|
+
},
|
|
4036
|
+
set: function set(value) {
|
|
4037
|
+
this.activeScte35BreakKeyValue = value;
|
|
3630
4038
|
}
|
|
3631
4039
|
},
|
|
3632
4040
|
{
|
|
3633
|
-
key: "
|
|
3634
|
-
|
|
3635
|
-
return
|
|
4041
|
+
key: "scheduledScte35BreakKey",
|
|
4042
|
+
get: function get() {
|
|
4043
|
+
return this.scheduledScte35BreakKeyValue;
|
|
4044
|
+
},
|
|
4045
|
+
set: function set(value) {
|
|
4046
|
+
this.scheduledScte35BreakKeyValue = value;
|
|
3636
4047
|
}
|
|
3637
4048
|
},
|
|
3638
4049
|
{
|
|
3639
|
-
key: "
|
|
3640
|
-
value: function
|
|
3641
|
-
|
|
3642
|
-
|
|
4050
|
+
key: "createScte35CueContext",
|
|
4051
|
+
value: function createScte35CueContext(source, readiness, frag) {
|
|
4052
|
+
var context = {
|
|
4053
|
+
source: source,
|
|
4054
|
+
readiness: readiness
|
|
4055
|
+
};
|
|
4056
|
+
if (typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number") {
|
|
4057
|
+
context.fragmentSn = frag.sn;
|
|
3643
4058
|
}
|
|
3644
|
-
|
|
3645
|
-
|
|
4059
|
+
var fragmentStartSec = getFragmentStartSeconds(frag);
|
|
4060
|
+
if (fragmentStartSec !== void 0) {
|
|
4061
|
+
context.fragmentStartSeconds = fragmentStartSec;
|
|
3646
4062
|
}
|
|
3647
|
-
return
|
|
3648
|
-
}
|
|
3649
|
-
},
|
|
3650
|
-
{
|
|
3651
|
-
key: "isStrongScte35CueKey",
|
|
3652
|
-
value: function isStrongScte35CueKey(key) {
|
|
3653
|
-
return !!(key && (key.startsWith("splice:") || key.startsWith("segmentation:") || key.startsWith("daterange:") || key.startsWith("daterange-scte:")));
|
|
4063
|
+
return context;
|
|
3654
4064
|
}
|
|
3655
4065
|
},
|
|
3656
4066
|
{
|
|
3657
|
-
key: "
|
|
3658
|
-
value: function
|
|
3659
|
-
|
|
3660
|
-
|
|
4067
|
+
key: "onScte35Cue",
|
|
4068
|
+
value: function onScte35Cue(marker, context) {
|
|
4069
|
+
var cue = this.createScte35Cue(marker, context);
|
|
4070
|
+
var pendingKey = this.getPendingScte35CueKey(cue);
|
|
4071
|
+
if (context.readiness === "early") {
|
|
4072
|
+
this.pendingScte35Cues.set(pendingKey, cue);
|
|
4073
|
+
this.trimRecentScte35CueMaps();
|
|
4074
|
+
if (marker.type === "start") {
|
|
4075
|
+
this.callbacks.onEarlyStartCue(marker, context.fragmentSn, cue.key);
|
|
4076
|
+
}
|
|
4077
|
+
return;
|
|
3661
4078
|
}
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
this.trimRecentScte35CueMaps();
|
|
3671
|
-
}
|
|
3672
|
-
},
|
|
3673
|
-
{
|
|
3674
|
-
key: "trimRecentScte35CueMaps",
|
|
3675
|
-
value: function trimRecentScte35CueMaps() {
|
|
3676
|
-
while(this.recentScte35CueKeys.size > this.recentScte35CueLimit){
|
|
3677
|
-
var firstKey = this.recentScte35CueKeys.keys().next().value;
|
|
3678
|
-
if (!firstKey) {
|
|
3679
|
-
break;
|
|
4079
|
+
if (marker.type === "end" && !this.shouldAcceptScte35EndCue(cue)) {
|
|
4080
|
+
if (this.debug) {
|
|
4081
|
+
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end cue", {
|
|
4082
|
+
key: cue.key,
|
|
4083
|
+
activeScte35BreakKey: this.activeScte35BreakKeyValue,
|
|
4084
|
+
inAdBreak: this.callbacks.isInAdBreak(),
|
|
4085
|
+
source: cue.source
|
|
4086
|
+
});
|
|
3680
4087
|
}
|
|
3681
|
-
|
|
4088
|
+
return;
|
|
3682
4089
|
}
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
4090
|
+
if (marker.type === "start" && this.hasRecentlyHandledScte35Cue(cue)) {
|
|
4091
|
+
if (this.debug) {
|
|
4092
|
+
console.log("[StormcloudVideoPlayer] Ignoring duplicate SCTE-35 start cue", {
|
|
4093
|
+
key: cue.key,
|
|
4094
|
+
source: cue.source
|
|
4095
|
+
});
|
|
3687
4096
|
}
|
|
3688
|
-
|
|
4097
|
+
return;
|
|
3689
4098
|
}
|
|
4099
|
+
this.pendingScte35Cues.delete(pendingKey);
|
|
4100
|
+
this.markScte35CueHandled(cue);
|
|
4101
|
+
this.callbacks.onPlaybackCue(marker, cue.key);
|
|
3690
4102
|
}
|
|
3691
4103
|
},
|
|
3692
4104
|
{
|
|
3693
|
-
key: "
|
|
3694
|
-
value: function
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
return false;
|
|
4105
|
+
key: "activatePendingScte35CuesForFragment",
|
|
4106
|
+
value: function activatePendingScte35CuesForFragment(frag) {
|
|
4107
|
+
var _this = this;
|
|
4108
|
+
var fragmentSn = typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number" ? frag.sn : void 0;
|
|
4109
|
+
if (fragmentSn === void 0) {
|
|
4110
|
+
return;
|
|
3700
4111
|
}
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
var
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
"deviceAdvertisingId",
|
|
3718
|
-
"aaid",
|
|
3719
|
-
"adid",
|
|
3720
|
-
"rida",
|
|
3721
|
-
"tifa"
|
|
3722
|
-
];
|
|
3723
|
-
function resolveCtvVastSignals() {
|
|
3724
|
-
var _ref, _bridgeSignals_limitAdTracking;
|
|
3725
|
-
var bridgeSignals = readNativeBridgeSignals();
|
|
3726
|
-
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
3727
|
-
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || inferDeviceIdType();
|
|
3728
|
-
var contentUrl = bridgeSignals.contentUrl || readStoredString("contentUrl") || AIRY_DEFAULT_CONTENT_URL;
|
|
3729
|
-
return _object_spread_props(_object_spread({
|
|
3730
|
-
contentUrl: contentUrl,
|
|
3731
|
-
appId: AIRY_ANDROID_APP_ID,
|
|
3732
|
-
appName: AIRY_APP_NAME,
|
|
3733
|
-
sessionId: getOrCreateCtvSessionId()
|
|
3734
|
-
}, deviceId ? {
|
|
3735
|
-
deviceId: deviceId
|
|
3736
|
-
} : {}, deviceId && deviceIdType ? {
|
|
3737
|
-
deviceIdType: deviceIdType
|
|
3738
|
-
} : {}, deviceId ? {
|
|
3739
|
-
limitAdTracking: (_ref = (_bridgeSignals_limitAdTracking = bridgeSignals.limitAdTracking) !== null && _bridgeSignals_limitAdTracking !== void 0 ? _bridgeSignals_limitAdTracking : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false
|
|
3740
|
-
} : {}), {
|
|
3741
|
-
deviceTypeHint: 5
|
|
3742
|
-
});
|
|
3743
|
-
}
|
|
3744
|
-
function getOrCreateCtvSessionId() {
|
|
3745
|
-
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
3746
|
-
if (existing) {
|
|
3747
|
-
return existing;
|
|
3748
|
-
}
|
|
3749
|
-
var sessionId = createUuid();
|
|
3750
|
-
try {
|
|
3751
|
-
var _window_localStorage;
|
|
3752
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
3753
|
-
} catch (unused) {}
|
|
3754
|
-
return sessionId;
|
|
3755
|
-
}
|
|
3756
|
-
function createUuid() {
|
|
3757
|
-
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
3758
|
-
return crypto.randomUUID();
|
|
3759
|
-
}
|
|
3760
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
|
|
3761
|
-
var value = Math.floor(Math.random() * 16);
|
|
3762
|
-
var nibble = char === "x" ? value : value & 3 | 8;
|
|
3763
|
-
return nibble.toString(16);
|
|
3764
|
-
});
|
|
3765
|
-
}
|
|
3766
|
-
function readNativeBridgeSignals() {
|
|
3767
|
-
if (typeof window === "undefined") {
|
|
3768
|
-
return {};
|
|
3769
|
-
}
|
|
3770
|
-
var candidates = [
|
|
3771
|
-
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
3772
|
-
window.__STORMCLOUD_CTV__,
|
|
3773
|
-
window.stormcloudCtv,
|
|
3774
|
-
window.AiryTV,
|
|
3775
|
-
window.Android
|
|
3776
|
-
].filter(Boolean);
|
|
3777
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3778
|
-
try {
|
|
3779
|
-
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3780
|
-
var source = _step.value;
|
|
3781
|
-
var contentUrl = readBridgeValue(source, [
|
|
3782
|
-
"contentUrl",
|
|
3783
|
-
"url",
|
|
3784
|
-
"videoUrl",
|
|
3785
|
-
"canonicalUrl"
|
|
3786
|
-
]) || void 0;
|
|
3787
|
-
var deviceId = readBridgeValue(source, [
|
|
3788
|
-
"rdid",
|
|
3789
|
-
"ifa",
|
|
3790
|
-
"advertisingId",
|
|
3791
|
-
"adId",
|
|
3792
|
-
"deviceId"
|
|
3793
|
-
]) || void 0;
|
|
3794
|
-
if (!contentUrl && !deviceId) continue;
|
|
3795
|
-
var deviceIdType = readBridgeValue(source, [
|
|
3796
|
-
"idtype",
|
|
3797
|
-
"deviceIdType",
|
|
3798
|
-
"advertisingIdType"
|
|
3799
|
-
]) || inferDeviceIdType();
|
|
3800
|
-
var limitAdTracking = readBridgeBoolean(source, [
|
|
3801
|
-
"is_lat",
|
|
3802
|
-
"limitAdTracking",
|
|
3803
|
-
"limitedAdTracking",
|
|
3804
|
-
"lat"
|
|
3805
|
-
]);
|
|
3806
|
-
return _object_spread({}, contentUrl ? {
|
|
3807
|
-
contentUrl: contentUrl
|
|
3808
|
-
} : {}, deviceId ? {
|
|
3809
|
-
deviceId: deviceId
|
|
3810
|
-
} : {}, deviceId && deviceIdType ? {
|
|
3811
|
-
deviceIdType: deviceIdType
|
|
3812
|
-
} : {}, deviceId && limitAdTracking != null ? {
|
|
3813
|
-
limitAdTracking: limitAdTracking
|
|
3814
|
-
} : {});
|
|
3815
|
-
}
|
|
3816
|
-
} catch (err) {
|
|
3817
|
-
_didIteratorError = true;
|
|
3818
|
-
_iteratorError = err;
|
|
3819
|
-
} finally{
|
|
3820
|
-
try {
|
|
3821
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3822
|
-
_iterator.return();
|
|
3823
|
-
}
|
|
3824
|
-
} finally{
|
|
3825
|
-
if (_didIteratorError) {
|
|
3826
|
-
throw _iteratorError;
|
|
3827
|
-
}
|
|
3828
|
-
}
|
|
3829
|
-
}
|
|
3830
|
-
return {};
|
|
3831
|
-
}
|
|
3832
|
-
function readBridgeValue(source, keys) {
|
|
3833
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3834
|
-
try {
|
|
3835
|
-
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3836
|
-
var key = _step.value;
|
|
3837
|
-
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
3838
|
-
if (typeof value === "string" && value) {
|
|
3839
|
-
return value;
|
|
3840
|
-
}
|
|
3841
|
-
if (typeof value === "function") {
|
|
3842
|
-
try {
|
|
3843
|
-
var result = value.call(source);
|
|
3844
|
-
if (typeof result === "string" && result) {
|
|
3845
|
-
return result;
|
|
4112
|
+
var matchingCues = Array.from(this.pendingScte35Cues.entries()).filter(function(param) {
|
|
4113
|
+
var _param = _sliced_to_array(param, 2), cue = _param[1];
|
|
4114
|
+
return cue.fragmentSn === fragmentSn;
|
|
4115
|
+
});
|
|
4116
|
+
matchingCues.forEach(function(param) {
|
|
4117
|
+
var _param = _sliced_to_array(param, 2), pendingKey = _param[0], cue = _param[1];
|
|
4118
|
+
var _cue_fragmentStartSeconds;
|
|
4119
|
+
_this.pendingScte35Cues.delete(pendingKey);
|
|
4120
|
+
var context = {
|
|
4121
|
+
source: cue.source,
|
|
4122
|
+
readiness: "playback"
|
|
4123
|
+
};
|
|
4124
|
+
context.fragmentSn = fragmentSn;
|
|
4125
|
+
var fragmentStartSec = (_cue_fragmentStartSeconds = cue.fragmentStartSeconds) !== null && _cue_fragmentStartSeconds !== void 0 ? _cue_fragmentStartSeconds : getFragmentStartSeconds(frag);
|
|
4126
|
+
if (fragmentStartSec !== void 0) {
|
|
4127
|
+
context.fragmentStartSeconds = fragmentStartSec;
|
|
3846
4128
|
}
|
|
3847
|
-
|
|
4129
|
+
_this.onScte35Cue(cue.marker, context);
|
|
4130
|
+
});
|
|
3848
4131
|
}
|
|
3849
|
-
}
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
4132
|
+
},
|
|
4133
|
+
{
|
|
4134
|
+
key: "createScte35Cue",
|
|
4135
|
+
value: function createScte35Cue(marker, context) {
|
|
4136
|
+
var cue = {
|
|
4137
|
+
marker: marker,
|
|
4138
|
+
source: context.source,
|
|
4139
|
+
readiness: context.readiness,
|
|
4140
|
+
key: this.getScte35CueKey(marker, context)
|
|
4141
|
+
};
|
|
4142
|
+
if (context.fragmentSn !== void 0) {
|
|
4143
|
+
cue.fragmentSn = context.fragmentSn;
|
|
4144
|
+
}
|
|
4145
|
+
if (context.fragmentStartSeconds !== void 0) {
|
|
4146
|
+
cue.fragmentStartSeconds = context.fragmentStartSeconds;
|
|
4147
|
+
}
|
|
4148
|
+
return cue;
|
|
3857
4149
|
}
|
|
3858
|
-
}
|
|
3859
|
-
|
|
3860
|
-
|
|
4150
|
+
},
|
|
4151
|
+
{
|
|
4152
|
+
key: "getScte35CueKey",
|
|
4153
|
+
value: function getScte35CueKey(marker, context) {
|
|
4154
|
+
var _raw_attrs, _raw_attrs1, _raw_attrs2;
|
|
4155
|
+
var raw = this.getScte35MarkerRaw(marker);
|
|
4156
|
+
var spliceEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.splice_event_id);
|
|
4157
|
+
if (spliceEventId) {
|
|
4158
|
+
return "splice:".concat(spliceEventId);
|
|
4159
|
+
}
|
|
4160
|
+
var segmentationEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.segmentation_event_id);
|
|
4161
|
+
if (segmentationEventId) {
|
|
4162
|
+
return "segmentation:".concat(segmentationEventId);
|
|
4163
|
+
}
|
|
4164
|
+
var daterangeId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs = raw.attrs) === null || _raw_attrs === void 0 ? void 0 : _raw_attrs.ID);
|
|
4165
|
+
if (daterangeId) {
|
|
4166
|
+
return "daterange:".concat(daterangeId);
|
|
4167
|
+
}
|
|
4168
|
+
var scteValue = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs1 = raw.attrs) === null || _raw_attrs1 === void 0 ? void 0 : _raw_attrs1["SCTE35-OUT"]) || this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs2 = raw.attrs) === null || _raw_attrs2 === void 0 ? void 0 : _raw_attrs2["SCTE35-IN"]);
|
|
4169
|
+
if (scteValue) {
|
|
4170
|
+
return "daterange-scte:".concat(scteValue);
|
|
4171
|
+
}
|
|
4172
|
+
if (typeof marker.ptsSeconds === "number" && Number.isFinite(marker.ptsSeconds)) {
|
|
4173
|
+
return "pts:".concat(Math.round(marker.ptsSeconds * 2) / 2);
|
|
4174
|
+
}
|
|
4175
|
+
if (context.fragmentSn !== void 0) {
|
|
4176
|
+
return "fragment:".concat(context.fragmentSn);
|
|
4177
|
+
}
|
|
4178
|
+
return "".concat(context.source, ":wallclock:").concat(Math.floor(Date.now() / 1e3));
|
|
3861
4179
|
}
|
|
3862
|
-
}
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3868
|
-
try {
|
|
3869
|
-
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3870
|
-
var key = _step.value;
|
|
3871
|
-
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
3872
|
-
var normalized = normalizeBoolean(value);
|
|
3873
|
-
if (normalized != null) {
|
|
3874
|
-
return normalized;
|
|
4180
|
+
},
|
|
4181
|
+
{
|
|
4182
|
+
key: "getPendingScte35CueKey",
|
|
4183
|
+
value: function getPendingScte35CueKey(cue) {
|
|
4184
|
+
return "".concat(cue.marker.type, ":").concat(cue.key, ":").concat(cue.fragmentSn !== void 0 ? cue.fragmentSn : "unknown");
|
|
3875
4185
|
}
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
}
|
|
3882
|
-
} catch (unused) {}
|
|
4186
|
+
},
|
|
4187
|
+
{
|
|
4188
|
+
key: "getScte35MarkerRaw",
|
|
4189
|
+
value: function getScte35MarkerRaw(marker) {
|
|
4190
|
+
return _type_of(marker.raw) === "object" && marker.raw !== null ? marker.raw : {};
|
|
3883
4191
|
}
|
|
3884
|
-
}
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
4192
|
+
},
|
|
4193
|
+
{
|
|
4194
|
+
key: "toIdentityString",
|
|
4195
|
+
value: function toIdentityString(value) {
|
|
4196
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4197
|
+
return String(value);
|
|
4198
|
+
}
|
|
4199
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
4200
|
+
return value.trim();
|
|
4201
|
+
}
|
|
4202
|
+
return void 0;
|
|
3892
4203
|
}
|
|
3893
|
-
}
|
|
3894
|
-
|
|
3895
|
-
|
|
4204
|
+
},
|
|
4205
|
+
{
|
|
4206
|
+
key: "isStrongScte35CueKey",
|
|
4207
|
+
value: function isStrongScte35CueKey(key) {
|
|
4208
|
+
return !!(key && (key.startsWith("splice:") || key.startsWith("segmentation:") || key.startsWith("daterange:") || key.startsWith("daterange-scte:")));
|
|
3896
4209
|
}
|
|
3897
|
-
}
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
var value = readStoredString(key);
|
|
3907
|
-
if (value) {
|
|
3908
|
-
return value;
|
|
4210
|
+
},
|
|
4211
|
+
{
|
|
4212
|
+
key: "hasRecentlyHandledScte35Cue",
|
|
4213
|
+
value: function hasRecentlyHandledScte35Cue(cue) {
|
|
4214
|
+
if (this.activeScte35BreakKeyValue === cue.key || this.scheduledScte35BreakKeyValue === cue.key) {
|
|
4215
|
+
return true;
|
|
4216
|
+
}
|
|
4217
|
+
var recentKey = "".concat(cue.marker.type, ":").concat(cue.key);
|
|
4218
|
+
return this.recentScte35CueKeys.has(recentKey);
|
|
3909
4219
|
}
|
|
3910
|
-
}
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3917
|
-
_iterator.return();
|
|
4220
|
+
},
|
|
4221
|
+
{
|
|
4222
|
+
key: "markScte35CueHandled",
|
|
4223
|
+
value: function markScte35CueHandled(cue) {
|
|
4224
|
+
this.recentScte35CueKeys.set("".concat(cue.marker.type, ":").concat(cue.key), Date.now());
|
|
4225
|
+
this.trimRecentScte35CueMaps();
|
|
3918
4226
|
}
|
|
3919
|
-
}
|
|
3920
|
-
|
|
3921
|
-
|
|
4227
|
+
},
|
|
4228
|
+
{
|
|
4229
|
+
key: "trimRecentScte35CueMaps",
|
|
4230
|
+
value: function trimRecentScte35CueMaps() {
|
|
4231
|
+
while(this.recentScte35CueKeys.size > this.recentScte35CueLimit){
|
|
4232
|
+
var firstKey = this.recentScte35CueKeys.keys().next().value;
|
|
4233
|
+
if (!firstKey) {
|
|
4234
|
+
break;
|
|
4235
|
+
}
|
|
4236
|
+
this.recentScte35CueKeys.delete(firstKey);
|
|
4237
|
+
}
|
|
4238
|
+
while(this.pendingScte35Cues.size > this.recentScte35CueLimit){
|
|
4239
|
+
var firstKey1 = this.pendingScte35Cues.keys().next().value;
|
|
4240
|
+
if (!firstKey1) {
|
|
4241
|
+
break;
|
|
4242
|
+
}
|
|
4243
|
+
this.pendingScte35Cues.delete(firstKey1);
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
},
|
|
4247
|
+
{
|
|
4248
|
+
key: "shouldAcceptScte35EndCue",
|
|
4249
|
+
value: function shouldAcceptScte35EndCue(cue) {
|
|
4250
|
+
if (!this.callbacks.isInAdBreak()) {
|
|
4251
|
+
return false;
|
|
4252
|
+
}
|
|
4253
|
+
if (this.isStrongScte35CueKey(this.activeScte35BreakKeyValue) && this.isStrongScte35CueKey(cue.key) && this.activeScte35BreakKeyValue !== cue.key) {
|
|
4254
|
+
return false;
|
|
4255
|
+
}
|
|
4256
|
+
return true;
|
|
3922
4257
|
}
|
|
3923
4258
|
}
|
|
3924
|
-
|
|
3925
|
-
return
|
|
3926
|
-
}
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
try {
|
|
3932
|
-
var _window_localStorage;
|
|
3933
|
-
var value = (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key);
|
|
3934
|
-
return value || void 0;
|
|
3935
|
-
} catch (unused) {
|
|
3936
|
-
return void 0;
|
|
3937
|
-
}
|
|
3938
|
-
}
|
|
3939
|
-
function readStoredLimitAdTracking() {
|
|
3940
|
-
return normalizeBoolean(readStoredString("limitAdTracking") || readStoredString("limitedAdTracking") || readStoredString("is_lat"));
|
|
3941
|
-
}
|
|
3942
|
-
function normalizeBoolean(value) {
|
|
3943
|
-
if (typeof value === "boolean") {
|
|
3944
|
-
return value;
|
|
3945
|
-
}
|
|
3946
|
-
if (typeof value === "number") {
|
|
3947
|
-
return value === 1;
|
|
3948
|
-
}
|
|
3949
|
-
if (typeof value === "string") {
|
|
3950
|
-
var normalized = value.toLowerCase();
|
|
3951
|
-
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
3952
|
-
return true;
|
|
3953
|
-
}
|
|
3954
|
-
if (normalized === "0" || normalized === "false" || normalized === "no") {
|
|
3955
|
-
return false;
|
|
3956
|
-
}
|
|
3957
|
-
}
|
|
3958
|
-
return void 0;
|
|
3959
|
-
}
|
|
3960
|
-
function inferDeviceIdType() {
|
|
3961
|
-
if (typeof navigator === "undefined") {
|
|
3962
|
-
return void 0;
|
|
3963
|
-
}
|
|
3964
|
-
var ua = navigator.userAgent;
|
|
3965
|
-
if (/Roku/i.test(ua)) return "rida";
|
|
3966
|
-
if (/Tizen|Samsung/i.test(ua)) return "tifa";
|
|
3967
|
-
if (/AppleTV/i.test(ua)) return "tvOS";
|
|
3968
|
-
if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
|
|
3969
|
-
if (/Web0S|webOS|LG/i.test(ua)) return "lgudid";
|
|
3970
|
-
if (/Android|Google TV/i.test(ua)) return "aaid";
|
|
3971
|
-
return void 0;
|
|
3972
|
-
}
|
|
3973
|
-
// src/player/VmapManager.ts
|
|
3974
|
-
var VmapManager = /*#__PURE__*/ function() {
|
|
3975
|
-
function VmapManager(config, video) {
|
|
3976
|
-
_class_call_check(this, VmapManager);
|
|
4259
|
+
]);
|
|
4260
|
+
return Scte35CueManager;
|
|
4261
|
+
}();
|
|
4262
|
+
// src/player/AdConfigManager.ts
|
|
4263
|
+
var AdConfigManager = /*#__PURE__*/ function() {
|
|
4264
|
+
function AdConfigManager(config, video) {
|
|
4265
|
+
_class_call_check(this, AdConfigManager);
|
|
3977
4266
|
this.vmapBreaks = [];
|
|
3978
4267
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
3979
4268
|
this.streamCorrelator = generateCorrelator();
|
|
@@ -3985,7 +4274,7 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
3985
4274
|
this.config = config;
|
|
3986
4275
|
this.video = video;
|
|
3987
4276
|
}
|
|
3988
|
-
_create_class(
|
|
4277
|
+
_create_class(AdConfigManager, [
|
|
3989
4278
|
{
|
|
3990
4279
|
key: "debug",
|
|
3991
4280
|
get: function get() {
|
|
@@ -4047,7 +4336,7 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
4047
4336
|
];
|
|
4048
4337
|
}
|
|
4049
4338
|
if (this.config.vastTagUrl) {
|
|
4050
|
-
this.apiVastTagUrl = this.config.vastTagUrl;
|
|
4339
|
+
this.apiVastTagUrl = normalizeVastTagUrl(this.config.vastTagUrl);
|
|
4051
4340
|
if (this.debug) {
|
|
4052
4341
|
console.log("[StormcloudVideoPlayer] Using custom VAST tag URL:", this.apiVastTagUrl);
|
|
4053
4342
|
}
|
|
@@ -4087,7 +4376,7 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
4087
4376
|
data = _state.sent();
|
|
4088
4377
|
imaPayload = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : (_data_response_ima = _data_response.ima) === null || _data_response_ima === void 0 ? void 0 : (_data_response_ima_publisherdeskima = _data_response_ima["publisherdesk.ima"]) === null || _data_response_ima_publisherdeskima === void 0 ? void 0 : _data_response_ima_publisherdeskima.payload;
|
|
4089
4378
|
if (imaPayload) {
|
|
4090
|
-
this.apiVastTagUrl =
|
|
4379
|
+
this.apiVastTagUrl = normalizeVastTagUrl(imaPayload);
|
|
4091
4380
|
if (this.debug) {
|
|
4092
4381
|
console.log("[StormcloudVideoPlayer] Extracted VAST tag URL from /ads/web:", this.apiVastTagUrl);
|
|
4093
4382
|
}
|
|
@@ -4402,24 +4691,24 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
4402
4691
|
for(var i = 0; i < count; i++){
|
|
4403
4692
|
this.adRequestPositionInBreak++;
|
|
4404
4693
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
4405
|
-
var
|
|
4694
|
+
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
4406
4695
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
4407
4696
|
correlator: generateCorrelator(),
|
|
4408
4697
|
streamCorrelator: this.streamCorrelator,
|
|
4409
4698
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
4410
4699
|
adPosition: this.adRequestPositionInBreak,
|
|
4411
|
-
isCtv:
|
|
4412
|
-
contentUrl:
|
|
4413
|
-
pageUrl: !
|
|
4700
|
+
isCtv: envSignals.isCtv,
|
|
4701
|
+
contentUrl: envSignals.contentUrl,
|
|
4702
|
+
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? window.location.href : void 0,
|
|
4414
4703
|
adWillPlayMuted: adWillPlayMuted,
|
|
4415
4704
|
adWillAutoPlay: !!this.config.autoplay,
|
|
4416
|
-
appId:
|
|
4417
|
-
appName:
|
|
4418
|
-
sessionId:
|
|
4419
|
-
deviceId:
|
|
4420
|
-
deviceIdType:
|
|
4421
|
-
limitAdTracking:
|
|
4422
|
-
deviceTypeHint:
|
|
4705
|
+
appId: envSignals.appId,
|
|
4706
|
+
appName: envSignals.appName,
|
|
4707
|
+
sessionId: envSignals.sessionId,
|
|
4708
|
+
deviceId: envSignals.deviceId,
|
|
4709
|
+
deviceIdType: envSignals.deviceIdType,
|
|
4710
|
+
limitAdTracking: envSignals.limitAdTracking,
|
|
4711
|
+
deviceTypeHint: envSignals.deviceTypeHint,
|
|
4423
4712
|
adTest: this.config.adTest,
|
|
4424
4713
|
consent: this.consentSignals
|
|
4425
4714
|
});
|
|
@@ -4472,7 +4761,7 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
4472
4761
|
}
|
|
4473
4762
|
}
|
|
4474
4763
|
]);
|
|
4475
|
-
return
|
|
4764
|
+
return AdConfigManager;
|
|
4476
4765
|
}();
|
|
4477
4766
|
// src/player/AdTimingService.ts
|
|
4478
4767
|
var AdTimingService = /*#__PURE__*/ function() {
|
|
@@ -6199,7 +6488,7 @@ function resizePlayer(video, adPlayer, debug) {
|
|
|
6199
6488
|
}
|
|
6200
6489
|
// src/player/AdBreakOrchestrator.ts
|
|
6201
6490
|
var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
6202
|
-
function AdBreakOrchestrator(host, timing, preloadPool,
|
|
6491
|
+
function AdBreakOrchestrator(host, timing, preloadPool, adConfig, cueManager, placeholder) {
|
|
6203
6492
|
_class_call_check(this, AdBreakOrchestrator);
|
|
6204
6493
|
this.inAdBreak = false;
|
|
6205
6494
|
this.showAds = false;
|
|
@@ -6214,7 +6503,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
6214
6503
|
this.host = host;
|
|
6215
6504
|
this.timing = timing;
|
|
6216
6505
|
this.preloadPool = preloadPool;
|
|
6217
|
-
this.
|
|
6506
|
+
this.adConfig = adConfig;
|
|
6218
6507
|
this.cueManager = cueManager;
|
|
6219
6508
|
this.placeholder = placeholder;
|
|
6220
6509
|
}
|
|
@@ -6380,7 +6669,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
6380
6669
|
}
|
|
6381
6670
|
this.pendingAdBreak = null;
|
|
6382
6671
|
this.cueManager.pendingScte35CueKey = void 0;
|
|
6383
|
-
this.
|
|
6672
|
+
this.adConfig.podAssignedByPrefetch = false;
|
|
6384
6673
|
}
|
|
6385
6674
|
},
|
|
6386
6675
|
{
|
|
@@ -6394,15 +6683,15 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
6394
6683
|
return _ts_generator(this, function(_state) {
|
|
6395
6684
|
switch(_state.label){
|
|
6396
6685
|
case 0:
|
|
6397
|
-
scheduled = this.
|
|
6686
|
+
scheduled = this.adConfig.findCurrentOrNextBreak(this.host.video.currentTime * 1e3);
|
|
6398
6687
|
if (scheduled) {
|
|
6399
|
-
this.
|
|
6688
|
+
this.adConfig.consumedVmapBreakIds.add(this.adConfig.getAdBreakKey(scheduled));
|
|
6400
6689
|
}
|
|
6401
|
-
tags = this.
|
|
6690
|
+
tags = this.adConfig.selectVastTagsForBreak(scheduled);
|
|
6402
6691
|
if (tags && tags.length > 0 && tags[0]) {
|
|
6403
6692
|
baseVastUrl = tags[0];
|
|
6404
|
-
} else if (this.
|
|
6405
|
-
baseVastUrl = this.
|
|
6693
|
+
} else if (this.adConfig.apiVastTagUrl) {
|
|
6694
|
+
baseVastUrl = this.adConfig.apiVastTagUrl;
|
|
6406
6695
|
} else {
|
|
6407
6696
|
this.clearPendingAdBreak();
|
|
6408
6697
|
return [
|
|
@@ -6420,10 +6709,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
6420
6709
|
this.continuousFetchingActive = true;
|
|
6421
6710
|
this.isShowingPlaceholder = false;
|
|
6422
6711
|
this.timing.totalAdRequestsInBreak = 0;
|
|
6423
|
-
if (this.
|
|
6424
|
-
this.
|
|
6712
|
+
if (this.adConfig.podAssignedByPrefetch) {
|
|
6713
|
+
this.adConfig.podAssignedByPrefetch = false;
|
|
6425
6714
|
} else {
|
|
6426
|
-
this.
|
|
6715
|
+
this.adConfig.beginNewAdPod();
|
|
6427
6716
|
}
|
|
6428
6717
|
currentMuted = this.host.video.muted;
|
|
6429
6718
|
currentVolume = this.host.video.volume;
|
|
@@ -7695,7 +7984,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7695
7984
|
return _this.adBreak.inAdBreak;
|
|
7696
7985
|
}
|
|
7697
7986
|
});
|
|
7698
|
-
this.
|
|
7987
|
+
this.adConfig = new AdConfigManager(this.config, this.video);
|
|
7699
7988
|
this.timing = new AdTimingService(this.config, this.video, {
|
|
7700
7989
|
onAdStopTimerFired: function onAdStopTimerFired() {
|
|
7701
7990
|
return _this.onAdStopTimerFired();
|
|
@@ -7775,7 +8064,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7775
8064
|
generateVastUrls: function generateVastUrls(base, count) {
|
|
7776
8065
|
return _this.generateVastUrls(base, count);
|
|
7777
8066
|
}
|
|
7778
|
-
}, this.timing, this.preloadPool, this.
|
|
8067
|
+
}, this.timing, this.preloadPool, this.adConfig, this.cueManager, this.placeholder);
|
|
7779
8068
|
}
|
|
7780
8069
|
_create_class(StormcloudVideoPlayer, [
|
|
7781
8070
|
{
|
|
@@ -7803,7 +8092,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7803
8092
|
{
|
|
7804
8093
|
key: "generateVastUrls",
|
|
7805
8094
|
value: function generateVastUrls(baseUrl, count) {
|
|
7806
|
-
return this.
|
|
8095
|
+
return this.adConfig.generateVastUrlsWithCorrelators(baseUrl, count, this.adPlayer, this.palNonce, this.adBreak.inAdBreak);
|
|
7807
8096
|
}
|
|
7808
8097
|
},
|
|
7809
8098
|
{
|
|
@@ -7831,7 +8120,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7831
8120
|
]);
|
|
7832
8121
|
return [
|
|
7833
8122
|
4,
|
|
7834
|
-
this.
|
|
8123
|
+
this.adConfig.fetchAdConfiguration()
|
|
7835
8124
|
];
|
|
7836
8125
|
case 2:
|
|
7837
8126
|
_state.sent();
|
|
@@ -7858,9 +8147,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7858
8147
|
continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
|
|
7859
8148
|
}).catch(function() {});
|
|
7860
8149
|
fetchConsentSignals().then(function(signals) {
|
|
7861
|
-
_this.
|
|
8150
|
+
_this.adConfig.consentSignals = signals;
|
|
7862
8151
|
}).catch(function() {});
|
|
7863
|
-
this.
|
|
8152
|
+
this.adConfig.initializeTracking();
|
|
7864
8153
|
if (!this.hlsEngine.shouldUseNativeHls(function() {
|
|
7865
8154
|
return _this.getStreamType();
|
|
7866
8155
|
})) return [
|
|
@@ -7895,14 +8184,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7895
8184
|
return _async_to_generator(function() {
|
|
7896
8185
|
var prerollKey, adBehavior;
|
|
7897
8186
|
return _ts_generator(this, function(_state) {
|
|
7898
|
-
if (!this.
|
|
8187
|
+
if (!this.adConfig.isVmapEnabled() && !isLive && this.adConfig.vmapBreaks.length === 0 && this.adConfig.apiVastTagUrl) {
|
|
7899
8188
|
prerollKey = "synthetic-vod-preroll";
|
|
7900
|
-
if (!this.
|
|
7901
|
-
this.
|
|
8189
|
+
if (!this.adConfig.consumedVmapBreakIds.has(prerollKey)) {
|
|
8190
|
+
this.adConfig.vmapBreaks = [
|
|
7902
8191
|
{
|
|
7903
8192
|
id: prerollKey,
|
|
7904
8193
|
startTimeMs: 0,
|
|
7905
|
-
vastTagUrl: this.
|
|
8194
|
+
vastTagUrl: this.adConfig.apiVastTagUrl
|
|
7906
8195
|
}
|
|
7907
8196
|
];
|
|
7908
8197
|
if (this.debug) {
|
|
@@ -8169,19 +8458,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8169
8458
|
key: "startAdPrefetch",
|
|
8170
8459
|
value: function startAdPrefetch(marker, fragmentSn, cueKey) {
|
|
8171
8460
|
if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
|
|
8172
|
-
var scheduled = this.
|
|
8173
|
-
var tags = this.
|
|
8461
|
+
var scheduled = this.adConfig.findCurrentOrNextBreak(this.video.currentTime * 1e3);
|
|
8462
|
+
var tags = this.adConfig.selectVastTagsForBreak(scheduled);
|
|
8174
8463
|
var baseVastUrl;
|
|
8175
8464
|
if (tags && tags.length > 0 && tags[0]) {
|
|
8176
8465
|
baseVastUrl = tags[0];
|
|
8177
|
-
} else if (this.
|
|
8178
|
-
baseVastUrl = this.
|
|
8466
|
+
} else if (this.adConfig.apiVastTagUrl) {
|
|
8467
|
+
baseVastUrl = this.adConfig.apiVastTagUrl;
|
|
8179
8468
|
} else {
|
|
8180
8469
|
if (this.debug) console.warn("[StormcloudVideoPlayer] No VAST URL available for prefetch");
|
|
8181
8470
|
return;
|
|
8182
8471
|
}
|
|
8183
|
-
this.
|
|
8184
|
-
this.
|
|
8472
|
+
this.adConfig.beginNewAdPod();
|
|
8473
|
+
this.adConfig.podAssignedByPrefetch = true;
|
|
8185
8474
|
var generatedUrls = this.generateVastUrls(baseVastUrl, 1);
|
|
8186
8475
|
this.adBreak.pendingAdBreak = _object_spread_props(_object_spread({
|
|
8187
8476
|
marker: marker
|
|
@@ -8216,10 +8505,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8216
8505
|
key: "onTimeUpdate",
|
|
8217
8506
|
value: function onTimeUpdate(currentTimeSec) {
|
|
8218
8507
|
var _this = this;
|
|
8219
|
-
if (!this.
|
|
8508
|
+
if (!this.adConfig.isVmapEnabled() || this.adConfig.vmapBreaks.length === 0) return;
|
|
8220
8509
|
if (this.adPlayer.isAdPlaying() || this.adBreak.inAdBreak) return;
|
|
8221
8510
|
var nowMs = currentTimeSec * 1e3;
|
|
8222
|
-
var breakToPlay = this.
|
|
8511
|
+
var breakToPlay = this.adConfig.findBreakForTime(nowMs);
|
|
8223
8512
|
if (breakToPlay) {
|
|
8224
8513
|
void this.handleVmapAdBreak(breakToPlay, nowMs).catch(function(error) {
|
|
8225
8514
|
if (_this.debug) {
|
|
@@ -8233,11 +8522,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8233
8522
|
key: "onVideoEnded",
|
|
8234
8523
|
value: function onVideoEnded() {
|
|
8235
8524
|
var _this = this;
|
|
8236
|
-
if (!this.
|
|
8525
|
+
if (!this.adConfig.isVmapEnabled() || this.adConfig.vmapBreaks.length === 0) return;
|
|
8237
8526
|
if (this.adPlayer.isAdPlaying() || this.adBreak.inAdBreak) return;
|
|
8238
8527
|
var durationMs = Number.isFinite(this.video.duration) ? Math.floor(this.video.duration * 1e3) : 0;
|
|
8239
|
-
var postroll = this.
|
|
8240
|
-
return b.startTimeMs === -1 && !_this.
|
|
8528
|
+
var postroll = this.adConfig.vmapBreaks.find(function(b) {
|
|
8529
|
+
return b.startTimeMs === -1 && !_this.adConfig.consumedVmapBreakIds.has(_this.adConfig.getAdBreakKey(b));
|
|
8241
8530
|
});
|
|
8242
8531
|
if (postroll) {
|
|
8243
8532
|
void this.handleVmapAdBreak(postroll, durationMs).catch(function(error) {
|
|
@@ -8256,11 +8545,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8256
8545
|
return _ts_generator(this, function(_state) {
|
|
8257
8546
|
switch(_state.label){
|
|
8258
8547
|
case 0:
|
|
8259
|
-
key = this.
|
|
8260
|
-
if (this.
|
|
8548
|
+
key = this.adConfig.getAdBreakKey(adBreak);
|
|
8549
|
+
if (this.adConfig.consumedVmapBreakIds.has(key)) return [
|
|
8261
8550
|
2
|
|
8262
8551
|
];
|
|
8263
|
-
breakStartMs = this.
|
|
8552
|
+
breakStartMs = this.adConfig.resolveBreakStartMs(adBreak);
|
|
8264
8553
|
if (breakStartMs == null) return [
|
|
8265
8554
|
2
|
|
8266
8555
|
];
|
|
@@ -8271,8 +8560,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8271
8560
|
3,
|
|
8272
8561
|
4
|
|
8273
8562
|
];
|
|
8274
|
-
this.
|
|
8275
|
-
tags = this.
|
|
8563
|
+
this.adConfig.consumedVmapBreakIds.add(key);
|
|
8564
|
+
tags = this.adConfig.selectVastTagsForBreak(adBreak);
|
|
8276
8565
|
if (!tags || tags.length === 0) return [
|
|
8277
8566
|
2
|
|
8278
8567
|
];
|
|
@@ -8464,7 +8753,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8464
8753
|
this.video.removeEventListener("emptied", this.emptiedHandler);
|
|
8465
8754
|
delete this.emptiedHandler;
|
|
8466
8755
|
}
|
|
8467
|
-
this.
|
|
8756
|
+
this.adConfig.destroyTracking();
|
|
8468
8757
|
this.hlsEngine.destroy();
|
|
8469
8758
|
(_this_adPlayer = this.adPlayer) === null || _this_adPlayer === void 0 ? void 0 : _this_adPlayer.destroy();
|
|
8470
8759
|
if (this.palPlaybackStarted) {
|
|
@@ -9101,7 +9390,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
9101
9390
|
})
|
|
9102
9391
|
]
|
|
9103
9392
|
}),
|
|
9104
|
-
adStatus.showAds && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
9393
|
+
adStatus.showAds && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
9105
9394
|
style: {
|
|
9106
9395
|
position: "absolute",
|
|
9107
9396
|
top: "".concat(12 * responsiveScale, "px"),
|
|
@@ -9113,35 +9402,20 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
9113
9402
|
pointerEvents: "none",
|
|
9114
9403
|
animation: "sc-fade-in 0.3s ease"
|
|
9115
9404
|
},
|
|
9116
|
-
children:
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
}),
|
|
9131
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
9132
|
-
style: {
|
|
9133
|
-
background: "rgba(0, 0, 0, 0.58)",
|
|
9134
|
-
color: "rgba(255, 255, 255, 0.92)",
|
|
9135
|
-
padding: "".concat(4 * responsiveScale, "px ").concat(10 * responsiveScale, "px"),
|
|
9136
|
-
borderRadius: "6px",
|
|
9137
|
-
fontSize: "".concat(11 * responsiveScale, "px"),
|
|
9138
|
-
fontWeight: 600,
|
|
9139
|
-
border: "1px solid rgba(255, 255, 255, 0.1)",
|
|
9140
|
-
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.25)"
|
|
9141
|
-
},
|
|
9142
|
-
children: "".concat(Math.max(1, adStatus.currentIndex), " of ").concat(Math.max(Math.max(1, adStatus.currentIndex), adStatus.totalAds))
|
|
9143
|
-
})
|
|
9144
|
-
]
|
|
9405
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
9406
|
+
style: {
|
|
9407
|
+
background: "rgba(234, 179, 8, 0.95)",
|
|
9408
|
+
color: "#111",
|
|
9409
|
+
padding: "".concat(4 * responsiveScale, "px ").concat(12 * responsiveScale, "px"),
|
|
9410
|
+
borderRadius: "6px",
|
|
9411
|
+
fontSize: "".concat(11 * responsiveScale, "px"),
|
|
9412
|
+
fontWeight: 700,
|
|
9413
|
+
letterSpacing: "0.08em",
|
|
9414
|
+
textTransform: "uppercase",
|
|
9415
|
+
boxShadow: "0 2px 12px rgba(234, 179, 8, 0.35)"
|
|
9416
|
+
},
|
|
9417
|
+
children: "Ad ".concat(Math.max(1, adStatus.currentIndex))
|
|
9418
|
+
})
|
|
9145
9419
|
}),
|
|
9146
9420
|
showCenterPlay && !isLoading && !isBuffering && !showLicenseWarning && !adStatus.showAds && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
9147
9421
|
onClick: handleCenterPlayClick,
|