stormcloud-video-player 0.6.8 → 0.6.9
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 +238 -156
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +23 -2
- package/lib/index.d.ts +23 -2
- package/lib/index.js +238 -156
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +238 -156
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +6 -1
- package/lib/players/HlsPlayer.cjs +238 -156
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +238 -156
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/vastAdLayer.d.cts +1 -1
- package/lib/sdk/vastManager.d.cts +1 -1
- package/lib/{types-BYwfSJb5.d.cts → types-DSKC4ySr.d.cts} +5 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +238 -156
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/tracking.cjs +179 -150
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +11 -6
- package/package.json +1 -1
|
@@ -56,6 +56,9 @@ interface ClientInfo {
|
|
|
56
56
|
referrer: string;
|
|
57
57
|
visibilityState: string;
|
|
58
58
|
}
|
|
59
|
+
interface PlayerAnalyticsContext {
|
|
60
|
+
inputStreamType?: string;
|
|
61
|
+
}
|
|
59
62
|
interface AdDetectInfo {
|
|
60
63
|
source: "scte35";
|
|
61
64
|
durationSeconds?: number;
|
|
@@ -72,6 +75,7 @@ interface AdLoadedInfo {
|
|
|
72
75
|
interface AdImpressionInfo {
|
|
73
76
|
source: "vast" | "ima" | "hls";
|
|
74
77
|
adIndex: number;
|
|
78
|
+
adUrl?: string;
|
|
75
79
|
durationSeconds?: number;
|
|
76
80
|
timestamp: string;
|
|
77
81
|
}
|
|
@@ -102,4 +106,4 @@ interface VastManager {
|
|
|
102
106
|
readonly isInitialized: boolean;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
export type { AdDetectInfo as A, ClientInfo as C, StormcloudVideoPlayerConfig as S, VastBidResponse as V, VastManager as a, AdImpressionInfo as b, AdLoadedInfo as c };
|
|
109
|
+
export type { AdDetectInfo as A, ClientInfo as C, PlayerAnalyticsContext as P, StormcloudVideoPlayerConfig as S, VastBidResponse as V, VastManager as a, AdImpressionInfo as b, AdLoadedInfo as c };
|
|
@@ -2179,24 +2179,30 @@ function getBrowserID(clientInfo) {
|
|
|
2179
2179
|
});
|
|
2180
2180
|
})();
|
|
2181
2181
|
}
|
|
2182
|
-
var
|
|
2182
|
+
var PLAYER_TRACKING_BASE_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking";
|
|
2183
|
+
var TRACK_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/metrics/ingest");
|
|
2184
|
+
var HEARTBEAT_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/heartbeat");
|
|
2185
|
+
var IMPRESSIONS_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/impressions/ingest");
|
|
2186
|
+
function buildHeaders(licenseKey) {
|
|
2187
|
+
var headers = {
|
|
2188
|
+
"Content-Type": "application/json"
|
|
2189
|
+
};
|
|
2190
|
+
if (licenseKey) {
|
|
2191
|
+
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2192
|
+
}
|
|
2193
|
+
return headers;
|
|
2194
|
+
}
|
|
2183
2195
|
function sendTrackRequest(licenseKey, body) {
|
|
2184
2196
|
return _async_to_generator(function() {
|
|
2185
|
-
var
|
|
2197
|
+
var response;
|
|
2186
2198
|
return _ts_generator(this, function(_state) {
|
|
2187
2199
|
switch(_state.label){
|
|
2188
2200
|
case 0:
|
|
2189
|
-
headers = {
|
|
2190
|
-
"Content-Type": "application/json"
|
|
2191
|
-
};
|
|
2192
|
-
if (licenseKey) {
|
|
2193
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2194
|
-
}
|
|
2195
2201
|
return [
|
|
2196
2202
|
4,
|
|
2197
2203
|
fetch(TRACK_URL, {
|
|
2198
2204
|
method: "POST",
|
|
2199
|
-
headers:
|
|
2205
|
+
headers: buildHeaders(licenseKey),
|
|
2200
2206
|
body: JSON.stringify(body)
|
|
2201
2207
|
})
|
|
2202
2208
|
];
|
|
@@ -2218,14 +2224,86 @@ function sendTrackRequest(licenseKey, body) {
|
|
|
2218
2224
|
});
|
|
2219
2225
|
})();
|
|
2220
2226
|
}
|
|
2221
|
-
function
|
|
2227
|
+
function postJson(url, licenseKey, body) {
|
|
2222
2228
|
return _async_to_generator(function() {
|
|
2223
|
-
var
|
|
2229
|
+
var response;
|
|
2230
|
+
return _ts_generator(this, function(_state) {
|
|
2231
|
+
switch(_state.label){
|
|
2232
|
+
case 0:
|
|
2233
|
+
return [
|
|
2234
|
+
4,
|
|
2235
|
+
fetch(url, {
|
|
2236
|
+
method: "POST",
|
|
2237
|
+
headers: buildHeaders(licenseKey),
|
|
2238
|
+
body: JSON.stringify(body)
|
|
2239
|
+
})
|
|
2240
|
+
];
|
|
2241
|
+
case 1:
|
|
2242
|
+
response = _state.sent();
|
|
2243
|
+
if (!response.ok) {
|
|
2244
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
2245
|
+
}
|
|
2246
|
+
return [
|
|
2247
|
+
4,
|
|
2248
|
+
response.json()
|
|
2249
|
+
];
|
|
2250
|
+
case 2:
|
|
2251
|
+
_state.sent();
|
|
2252
|
+
return [
|
|
2253
|
+
2
|
|
2254
|
+
];
|
|
2255
|
+
}
|
|
2256
|
+
});
|
|
2257
|
+
})();
|
|
2258
|
+
}
|
|
2259
|
+
function buildPlayerMetricEvent(_0) {
|
|
2260
|
+
return _async_to_generator(function(licenseKey) {
|
|
2261
|
+
var context, flags, _flags_captureAt, clientInfo, browserId, captureAt;
|
|
2262
|
+
var _arguments = arguments;
|
|
2224
2263
|
return _ts_generator(this, function(_state) {
|
|
2225
2264
|
switch(_state.label){
|
|
2226
2265
|
case 0:
|
|
2266
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2267
|
+
clientInfo = getClientInfo();
|
|
2268
|
+
return [
|
|
2269
|
+
4,
|
|
2270
|
+
getBrowserID(clientInfo)
|
|
2271
|
+
];
|
|
2272
|
+
case 1:
|
|
2273
|
+
browserId = _state.sent();
|
|
2274
|
+
captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
|
|
2275
|
+
return [
|
|
2276
|
+
2,
|
|
2277
|
+
{
|
|
2278
|
+
player_id: browserId,
|
|
2279
|
+
browserId: browserId,
|
|
2280
|
+
device_type: clientInfo.deviceType,
|
|
2281
|
+
deviceType: clientInfo.deviceType,
|
|
2282
|
+
input_stream_type: context.inputStreamType,
|
|
2283
|
+
os: clientInfo.os,
|
|
2284
|
+
ad_loaded: flags.adLoaded,
|
|
2285
|
+
ad_detect: flags.adDetect,
|
|
2286
|
+
license_key: licenseKey,
|
|
2287
|
+
capture_at: captureAt,
|
|
2288
|
+
timestamp: captureAt
|
|
2289
|
+
}
|
|
2290
|
+
];
|
|
2291
|
+
}
|
|
2292
|
+
});
|
|
2293
|
+
}).apply(this, arguments);
|
|
2294
|
+
}
|
|
2295
|
+
function sendInitialTracking(_0) {
|
|
2296
|
+
return _async_to_generator(function(licenseKey) {
|
|
2297
|
+
var context, clientInfo, browserId, trackingData, error;
|
|
2298
|
+
var _arguments = arguments;
|
|
2299
|
+
return _ts_generator(this, function(_state) {
|
|
2300
|
+
switch(_state.label){
|
|
2301
|
+
case 0:
|
|
2302
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
2303
|
+
_state.label = 1;
|
|
2304
|
+
case 1:
|
|
2227
2305
|
_state.trys.push([
|
|
2228
|
-
|
|
2306
|
+
1,
|
|
2229
2307
|
4,
|
|
2230
2308
|
,
|
|
2231
2309
|
5
|
|
@@ -2235,34 +2313,29 @@ function sendInitialTracking(licenseKey) {
|
|
|
2235
2313
|
4,
|
|
2236
2314
|
getBrowserID(clientInfo)
|
|
2237
2315
|
];
|
|
2238
|
-
case
|
|
2316
|
+
case 2:
|
|
2239
2317
|
browserId = _state.sent();
|
|
2240
2318
|
trackingData = _object_spread({
|
|
2241
2319
|
browserId: browserId
|
|
2242
2320
|
}, clientInfo);
|
|
2243
|
-
headers = {
|
|
2244
|
-
"Content-Type": "application/json"
|
|
2245
|
-
};
|
|
2246
|
-
if (licenseKey) {
|
|
2247
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2248
|
-
}
|
|
2249
2321
|
return [
|
|
2250
2322
|
4,
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2323
|
+
sendTrackRequest(licenseKey, {
|
|
2324
|
+
events: [
|
|
2325
|
+
{
|
|
2326
|
+
player_id: browserId,
|
|
2327
|
+
device_type: clientInfo.deviceType,
|
|
2328
|
+
input_stream_type: context.inputStreamType,
|
|
2329
|
+
os: clientInfo.os,
|
|
2330
|
+
ad_loaded: false,
|
|
2331
|
+
ad_detect: false,
|
|
2332
|
+
license_key: licenseKey,
|
|
2333
|
+
capture_at: /* @__PURE__ */ new Date().toISOString()
|
|
2334
|
+
}
|
|
2335
|
+
],
|
|
2336
|
+
trackingData: trackingData
|
|
2255
2337
|
})
|
|
2256
2338
|
];
|
|
2257
|
-
case 2:
|
|
2258
|
-
response = _state.sent();
|
|
2259
|
-
if (!response.ok) {
|
|
2260
|
-
throw new Error("HTTP error! status: ".concat(response.status));
|
|
2261
|
-
}
|
|
2262
|
-
return [
|
|
2263
|
-
4,
|
|
2264
|
-
response.json()
|
|
2265
|
-
];
|
|
2266
2339
|
case 3:
|
|
2267
2340
|
_state.sent();
|
|
2268
2341
|
return [
|
|
@@ -2282,36 +2355,30 @@ function sendInitialTracking(licenseKey) {
|
|
|
2282
2355
|
];
|
|
2283
2356
|
}
|
|
2284
2357
|
});
|
|
2285
|
-
})();
|
|
2358
|
+
}).apply(this, arguments);
|
|
2286
2359
|
}
|
|
2287
|
-
function sendAdDetectTracking(
|
|
2288
|
-
return _async_to_generator(function() {
|
|
2289
|
-
var
|
|
2360
|
+
function sendAdDetectTracking(_0, _1) {
|
|
2361
|
+
return _async_to_generator(function(licenseKey, adDetectInfo) {
|
|
2362
|
+
var context, error;
|
|
2363
|
+
var _arguments = arguments;
|
|
2290
2364
|
return _ts_generator(this, function(_state) {
|
|
2291
2365
|
switch(_state.label){
|
|
2292
2366
|
case 0:
|
|
2367
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2368
|
+
_state.label = 1;
|
|
2369
|
+
case 1:
|
|
2293
2370
|
_state.trys.push([
|
|
2294
|
-
|
|
2371
|
+
1,
|
|
2295
2372
|
3,
|
|
2296
2373
|
,
|
|
2297
2374
|
4
|
|
2298
2375
|
]);
|
|
2299
|
-
clientInfo = getClientInfo();
|
|
2300
|
-
return [
|
|
2301
|
-
4,
|
|
2302
|
-
getBrowserID(clientInfo)
|
|
2303
|
-
];
|
|
2304
|
-
case 1:
|
|
2305
|
-
browserId = _state.sent();
|
|
2306
|
-
trackingData = _object_spread({
|
|
2307
|
-
browserId: browserId
|
|
2308
|
-
}, clientInfo);
|
|
2309
2376
|
return [
|
|
2310
2377
|
4,
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
})
|
|
2378
|
+
sendHeartbeat(licenseKey, context, {
|
|
2379
|
+
adDetect: true,
|
|
2380
|
+
captureAt: adDetectInfo.timestamp
|
|
2381
|
+
})
|
|
2315
2382
|
];
|
|
2316
2383
|
case 2:
|
|
2317
2384
|
_state.sent();
|
|
@@ -2332,36 +2399,30 @@ function sendAdDetectTracking(licenseKey, adDetectInfo) {
|
|
|
2332
2399
|
];
|
|
2333
2400
|
}
|
|
2334
2401
|
});
|
|
2335
|
-
})();
|
|
2402
|
+
}).apply(this, arguments);
|
|
2336
2403
|
}
|
|
2337
|
-
function sendAdLoadedTracking(
|
|
2338
|
-
return _async_to_generator(function() {
|
|
2339
|
-
var
|
|
2404
|
+
function sendAdLoadedTracking(_0, _1) {
|
|
2405
|
+
return _async_to_generator(function(licenseKey, adLoadedInfo) {
|
|
2406
|
+
var context, error;
|
|
2407
|
+
var _arguments = arguments;
|
|
2340
2408
|
return _ts_generator(this, function(_state) {
|
|
2341
2409
|
switch(_state.label){
|
|
2342
2410
|
case 0:
|
|
2411
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2412
|
+
_state.label = 1;
|
|
2413
|
+
case 1:
|
|
2343
2414
|
_state.trys.push([
|
|
2344
|
-
|
|
2415
|
+
1,
|
|
2345
2416
|
3,
|
|
2346
2417
|
,
|
|
2347
2418
|
4
|
|
2348
2419
|
]);
|
|
2349
|
-
clientInfo = getClientInfo();
|
|
2350
2420
|
return [
|
|
2351
2421
|
4,
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
trackingData = _object_spread({
|
|
2357
|
-
browserId: browserId
|
|
2358
|
-
}, clientInfo);
|
|
2359
|
-
return [
|
|
2360
|
-
4,
|
|
2361
|
-
sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
|
|
2362
|
-
licenseKey: licenseKey,
|
|
2363
|
-
adLoadedInfo: adLoadedInfo
|
|
2364
|
-
}))
|
|
2422
|
+
sendHeartbeat(licenseKey, context, {
|
|
2423
|
+
adLoaded: true,
|
|
2424
|
+
captureAt: adLoadedInfo.timestamp
|
|
2425
|
+
})
|
|
2365
2426
|
];
|
|
2366
2427
|
case 2:
|
|
2367
2428
|
_state.sent();
|
|
@@ -2382,103 +2443,95 @@ function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
|
|
|
2382
2443
|
];
|
|
2383
2444
|
}
|
|
2384
2445
|
});
|
|
2385
|
-
})();
|
|
2446
|
+
}).apply(this, arguments);
|
|
2386
2447
|
}
|
|
2387
|
-
function sendAdImpressionTracking(
|
|
2388
|
-
return _async_to_generator(function() {
|
|
2389
|
-
var
|
|
2448
|
+
function sendAdImpressionTracking(_0, _1) {
|
|
2449
|
+
return _async_to_generator(function(licenseKey, adImpressionInfo) {
|
|
2450
|
+
var context, metricEvent, error;
|
|
2451
|
+
var _arguments = arguments;
|
|
2390
2452
|
return _ts_generator(this, function(_state) {
|
|
2391
2453
|
switch(_state.label){
|
|
2392
2454
|
case 0:
|
|
2455
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2456
|
+
_state.label = 1;
|
|
2457
|
+
case 1:
|
|
2393
2458
|
_state.trys.push([
|
|
2394
|
-
|
|
2395
|
-
|
|
2459
|
+
1,
|
|
2460
|
+
4,
|
|
2396
2461
|
,
|
|
2397
|
-
|
|
2462
|
+
5
|
|
2398
2463
|
]);
|
|
2399
|
-
clientInfo = getClientInfo();
|
|
2400
2464
|
return [
|
|
2401
2465
|
4,
|
|
2402
|
-
|
|
2466
|
+
buildPlayerMetricEvent(licenseKey, context, {
|
|
2467
|
+
captureAt: adImpressionInfo.timestamp
|
|
2468
|
+
})
|
|
2403
2469
|
];
|
|
2404
|
-
case
|
|
2405
|
-
|
|
2406
|
-
trackingData = _object_spread({
|
|
2407
|
-
browserId: browserId
|
|
2408
|
-
}, clientInfo);
|
|
2470
|
+
case 2:
|
|
2471
|
+
metricEvent = _state.sent();
|
|
2409
2472
|
return [
|
|
2410
2473
|
4,
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2474
|
+
Promise.all([
|
|
2475
|
+
postJson(HEARTBEAT_URL, licenseKey, metricEvent),
|
|
2476
|
+
postJson(IMPRESSIONS_URL, licenseKey, {
|
|
2477
|
+
events: [
|
|
2478
|
+
{
|
|
2479
|
+
player_id: metricEvent.player_id,
|
|
2480
|
+
ad_played_count: 1,
|
|
2481
|
+
ad_url: adImpressionInfo.adUrl,
|
|
2482
|
+
license_key: licenseKey,
|
|
2483
|
+
capture_at: adImpressionInfo.timestamp
|
|
2484
|
+
}
|
|
2485
|
+
]
|
|
2486
|
+
})
|
|
2487
|
+
])
|
|
2415
2488
|
];
|
|
2416
|
-
case
|
|
2489
|
+
case 3:
|
|
2417
2490
|
_state.sent();
|
|
2418
2491
|
return [
|
|
2419
2492
|
3,
|
|
2420
|
-
|
|
2493
|
+
5
|
|
2421
2494
|
];
|
|
2422
|
-
case
|
|
2495
|
+
case 4:
|
|
2423
2496
|
error = _state.sent();
|
|
2424
2497
|
console.error("[StormcloudVideoPlayer] Error sending ad impression tracking:", error);
|
|
2425
2498
|
return [
|
|
2426
2499
|
3,
|
|
2427
|
-
|
|
2500
|
+
5
|
|
2428
2501
|
];
|
|
2429
|
-
case
|
|
2502
|
+
case 5:
|
|
2430
2503
|
return [
|
|
2431
2504
|
2
|
|
2432
2505
|
];
|
|
2433
2506
|
}
|
|
2434
2507
|
});
|
|
2435
|
-
})();
|
|
2508
|
+
}).apply(this, arguments);
|
|
2436
2509
|
}
|
|
2437
|
-
function sendHeartbeat(
|
|
2438
|
-
return _async_to_generator(function() {
|
|
2439
|
-
var
|
|
2510
|
+
function sendHeartbeat(_0) {
|
|
2511
|
+
return _async_to_generator(function(licenseKey) {
|
|
2512
|
+
var context, flags, heartbeatData, error;
|
|
2513
|
+
var _arguments = arguments;
|
|
2440
2514
|
return _ts_generator(this, function(_state) {
|
|
2441
2515
|
switch(_state.label){
|
|
2442
2516
|
case 0:
|
|
2517
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2518
|
+
_state.label = 1;
|
|
2519
|
+
case 1:
|
|
2443
2520
|
_state.trys.push([
|
|
2444
|
-
|
|
2521
|
+
1,
|
|
2445
2522
|
4,
|
|
2446
2523
|
,
|
|
2447
2524
|
5
|
|
2448
2525
|
]);
|
|
2449
|
-
clientInfo = getClientInfo();
|
|
2450
2526
|
return [
|
|
2451
2527
|
4,
|
|
2452
|
-
|
|
2453
|
-
];
|
|
2454
|
-
case 1:
|
|
2455
|
-
browserId = _state.sent();
|
|
2456
|
-
heartbeatData = {
|
|
2457
|
-
browserId: browserId,
|
|
2458
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
2459
|
-
};
|
|
2460
|
-
headers = {
|
|
2461
|
-
"Content-Type": "application/json"
|
|
2462
|
-
};
|
|
2463
|
-
if (licenseKey) {
|
|
2464
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2465
|
-
}
|
|
2466
|
-
return [
|
|
2467
|
-
4,
|
|
2468
|
-
fetch("https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/heartbeat", {
|
|
2469
|
-
method: "POST",
|
|
2470
|
-
headers: headers,
|
|
2471
|
-
body: JSON.stringify(heartbeatData)
|
|
2472
|
-
})
|
|
2528
|
+
buildPlayerMetricEvent(licenseKey, context, flags)
|
|
2473
2529
|
];
|
|
2474
2530
|
case 2:
|
|
2475
|
-
|
|
2476
|
-
if (!response.ok) {
|
|
2477
|
-
throw new Error("HTTP error! status: ".concat(response.status));
|
|
2478
|
-
}
|
|
2531
|
+
heartbeatData = _state.sent();
|
|
2479
2532
|
return [
|
|
2480
2533
|
4,
|
|
2481
|
-
|
|
2534
|
+
postJson(HEARTBEAT_URL, licenseKey, heartbeatData)
|
|
2482
2535
|
];
|
|
2483
2536
|
case 3:
|
|
2484
2537
|
_state.sent();
|
|
@@ -2499,7 +2552,7 @@ function sendHeartbeat(licenseKey) {
|
|
|
2499
2552
|
];
|
|
2500
2553
|
}
|
|
2501
2554
|
});
|
|
2502
|
-
})();
|
|
2555
|
+
}).apply(this, arguments);
|
|
2503
2556
|
}
|
|
2504
2557
|
// src/utils/polyfills.ts
|
|
2505
2558
|
function polyfillURLSearchParams() {
|
|
@@ -3514,17 +3567,62 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3514
3567
|
return "vast";
|
|
3515
3568
|
}
|
|
3516
3569
|
},
|
|
3570
|
+
{
|
|
3571
|
+
key: "getInputStreamType",
|
|
3572
|
+
value: function getInputStreamType() {
|
|
3573
|
+
var src = this.config.src.toLowerCase();
|
|
3574
|
+
if (src.includes(".m3u8")) return "hls";
|
|
3575
|
+
if (src.includes(".mpd")) return "dash";
|
|
3576
|
+
if (src.includes(".mp4")) return "mp4";
|
|
3577
|
+
return this.isLiveStream ? "live" : "vod";
|
|
3578
|
+
}
|
|
3579
|
+
},
|
|
3580
|
+
{
|
|
3581
|
+
key: "getAnalyticsContext",
|
|
3582
|
+
value: function getAnalyticsContext() {
|
|
3583
|
+
return {
|
|
3584
|
+
inputStreamType: this.getInputStreamType()
|
|
3585
|
+
};
|
|
3586
|
+
}
|
|
3587
|
+
},
|
|
3588
|
+
{
|
|
3589
|
+
key: "getAdUrlFromBids",
|
|
3590
|
+
value: function getAdUrlFromBids(bids) {
|
|
3591
|
+
var _bids_;
|
|
3592
|
+
return bids === null || bids === void 0 ? void 0 : (_bids_ = bids[0]) === null || _bids_ === void 0 ? void 0 : _bids_.vastUrl;
|
|
3593
|
+
}
|
|
3594
|
+
},
|
|
3595
|
+
{
|
|
3596
|
+
key: "trackAdLoaded",
|
|
3597
|
+
value: function trackAdLoaded(bids) {
|
|
3598
|
+
if (!this.config.licenseKey) return;
|
|
3599
|
+
var adUrl = this.getAdUrlFromBids(bids);
|
|
3600
|
+
if (adUrl) {
|
|
3601
|
+
this.lastServedAdUrl = adUrl;
|
|
3602
|
+
}
|
|
3603
|
+
sendAdLoadedTracking(this.config.licenseKey, _object_spread_props(_object_spread({
|
|
3604
|
+
source: this.getAdSource()
|
|
3605
|
+
}, adUrl ? {
|
|
3606
|
+
vastUrl: adUrl
|
|
3607
|
+
} : {}), {
|
|
3608
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
3609
|
+
}), this.getAnalyticsContext());
|
|
3610
|
+
}
|
|
3611
|
+
},
|
|
3517
3612
|
{
|
|
3518
3613
|
key: "attachAdLayerEventListeners",
|
|
3519
3614
|
value: function attachAdLayerEventListeners() {
|
|
3520
3615
|
var _this = this;
|
|
3521
3616
|
this.adLayer.on("ad_impression", function() {
|
|
3522
3617
|
if (_this.config.licenseKey) {
|
|
3523
|
-
sendAdImpressionTracking(_this.config.licenseKey, {
|
|
3618
|
+
sendAdImpressionTracking(_this.config.licenseKey, _object_spread_props(_object_spread({
|
|
3524
3619
|
source: _this.getAdSource(),
|
|
3525
|
-
adIndex: _this.currentAdIndex
|
|
3620
|
+
adIndex: _this.currentAdIndex
|
|
3621
|
+
}, _this.lastServedAdUrl ? {
|
|
3622
|
+
adUrl: _this.lastServedAdUrl
|
|
3623
|
+
} : {}), {
|
|
3526
3624
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
3527
|
-
});
|
|
3625
|
+
}), _this.getAnalyticsContext());
|
|
3528
3626
|
}
|
|
3529
3627
|
});
|
|
3530
3628
|
this.adLayer.on("ad_error", function(errorPayload) {
|
|
@@ -3618,6 +3716,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3618
3716
|
_this.isInAdTransition = false;
|
|
3619
3717
|
if (!_this.inAdBreak) return;
|
|
3620
3718
|
_this.currentAdIndex++;
|
|
3719
|
+
_this.trackAdLoaded();
|
|
3621
3720
|
_this.adLayer.playPreloaded(token).catch(function(err) {
|
|
3622
3721
|
if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playPreloaded failed:", err);
|
|
3623
3722
|
_this.handleAdFailure();
|
|
@@ -3647,6 +3746,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3647
3746
|
var freshBids = (_this_pendingNextAdBids = _this.pendingNextAdBids) !== null && _this_pendingNextAdBids !== void 0 ? _this_pendingNextAdBids : bids;
|
|
3648
3747
|
_this.pendingNextAdBids = null;
|
|
3649
3748
|
_this.currentAdIndex++;
|
|
3749
|
+
_this.trackAdLoaded(freshBids);
|
|
3650
3750
|
_this.adLayer.playAd(freshBids).catch(function(err) {
|
|
3651
3751
|
if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playAd(pending) failed:", err);
|
|
3652
3752
|
_this.handleAdFailure();
|
|
@@ -4026,7 +4126,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4026
4126
|
}, ((_this_pendingAdBreak1 = this.pendingAdBreak) === null || _this_pendingAdBreak1 === void 0 ? void 0 : _this_pendingAdBreak1.detectedAtFragmentSn) != null && {
|
|
4027
4127
|
detectedAtFragmentSn: this.pendingAdBreak.detectedAtFragmentSn
|
|
4028
4128
|
});
|
|
4029
|
-
sendAdDetectTracking(this.config.licenseKey, adDetectInfo);
|
|
4129
|
+
sendAdDetectTracking(this.config.licenseKey, adDetectInfo, this.getAnalyticsContext());
|
|
4030
4130
|
}
|
|
4031
4131
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
4032
4132
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
@@ -4095,6 +4195,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4095
4195
|
var bids = this.pendingNextAdBids;
|
|
4096
4196
|
this.pendingNextAdBids = null;
|
|
4097
4197
|
this.currentAdIndex++;
|
|
4198
|
+
this.trackAdLoaded(bids);
|
|
4098
4199
|
this.adLayer.playAd(bids).catch(function() {
|
|
4099
4200
|
return _this.handleAdFailure();
|
|
4100
4201
|
});
|
|
@@ -4349,7 +4450,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4349
4450
|
key: "initializeTracking",
|
|
4350
4451
|
value: function initializeTracking() {
|
|
4351
4452
|
var _this = this;
|
|
4352
|
-
sendInitialTracking(this.config.licenseKey).then(function() {
|
|
4453
|
+
sendInitialTracking(this.config.licenseKey, this.getAnalyticsContext()).then(function() {
|
|
4353
4454
|
_this.heartbeatInterval = window.setInterval(function() {
|
|
4354
4455
|
_this.sendHeartbeatIfNeeded();
|
|
4355
4456
|
}, 5e3);
|
|
@@ -4370,7 +4471,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4370
4471
|
var now = Date.now();
|
|
4371
4472
|
if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
|
|
4372
4473
|
this.lastHeartbeatTime = now;
|
|
4373
|
-
sendHeartbeat(this.config.licenseKey).catch(function(error) {
|
|
4474
|
+
sendHeartbeat(this.config.licenseKey, this.getAnalyticsContext()).catch(function(error) {
|
|
4374
4475
|
if (_this.config.debugAdTiming) {
|
|
4375
4476
|
console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
|
|
4376
4477
|
}
|
|
@@ -4763,12 +4864,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4763
4864
|
10
|
|
4764
4865
|
];
|
|
4765
4866
|
_this.currentAdIndex++;
|
|
4766
|
-
|
|
4767
|
-
sendAdLoadedTracking(_this.config.licenseKey, {
|
|
4768
|
-
source: _this.getAdSource(),
|
|
4769
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
4770
|
-
});
|
|
4771
|
-
}
|
|
4867
|
+
_this.trackAdLoaded(bids1);
|
|
4772
4868
|
return [
|
|
4773
4869
|
4,
|
|
4774
4870
|
_this.adLayer.playAd(bids1)
|
|
@@ -4873,12 +4969,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4873
4969
|
];
|
|
4874
4970
|
case 18:
|
|
4875
4971
|
_this.currentAdIndex++;
|
|
4876
|
-
|
|
4877
|
-
sendAdLoadedTracking(_this.config.licenseKey, {
|
|
4878
|
-
source: _this.getAdSource(),
|
|
4879
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
4880
|
-
});
|
|
4881
|
-
}
|
|
4972
|
+
_this.trackAdLoaded(bids2);
|
|
4882
4973
|
return [
|
|
4883
4974
|
4,
|
|
4884
4975
|
_this.adLayer.playAd(bids2)
|
|
@@ -5037,12 +5128,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5037
5128
|
6
|
|
5038
5129
|
];
|
|
5039
5130
|
this.currentAdIndex++;
|
|
5040
|
-
|
|
5041
|
-
sendAdLoadedTracking(this.config.licenseKey, {
|
|
5042
|
-
source: this.getAdSource(),
|
|
5043
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
5044
|
-
});
|
|
5045
|
-
}
|
|
5131
|
+
this.trackAdLoaded();
|
|
5046
5132
|
_state.label = 1;
|
|
5047
5133
|
case 1:
|
|
5048
5134
|
_state.trys.push([
|
|
@@ -5236,12 +5322,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5236
5322
|
5
|
|
5237
5323
|
];
|
|
5238
5324
|
case 3:
|
|
5239
|
-
|
|
5240
|
-
sendAdLoadedTracking(this.config.licenseKey, {
|
|
5241
|
-
source: this.getAdSource(),
|
|
5242
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
5243
|
-
});
|
|
5244
|
-
}
|
|
5325
|
+
this.trackAdLoaded(bids);
|
|
5245
5326
|
return [
|
|
5246
5327
|
4,
|
|
5247
5328
|
this.adLayer.playAd(bids)
|
|
@@ -5387,6 +5468,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5387
5468
|
,
|
|
5388
5469
|
7
|
|
5389
5470
|
]);
|
|
5471
|
+
this.trackAdLoaded(bids);
|
|
5390
5472
|
return [
|
|
5391
5473
|
4,
|
|
5392
5474
|
this.adLayer.playAd(bids)
|