stormcloud-video-player 0.8.22 → 0.8.23
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 +124 -25
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +124 -25
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +7 -0
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -0
- package/lib/player/AdConfigManager.cjs +79 -11
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/HlsEngine.cjs +12 -3
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +120 -24
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +121 -24
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +121 -24
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +122 -25
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.cjs +72 -4
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.cjs +72 -4
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -2368,12 +2368,14 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
|
|
|
2368
2368
|
"adid"
|
|
2369
2369
|
]);
|
|
2370
2370
|
function resolveVastEnvironmentSignals(isCtv) {
|
|
2371
|
-
var _ref
|
|
2371
|
+
var _ref;
|
|
2372
2372
|
var bridgeSignals = readNativeBridgeSignals();
|
|
2373
|
+
var platformDevice = readPlatformNativeDeviceId();
|
|
2373
2374
|
var lg = isCtv && isLgWebOS();
|
|
2374
|
-
var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || (lg ? getLgTestDeviceId() : void 0);
|
|
2375
|
-
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || inferDeviceIdType() || (lg ? "lgudid" : void 0);
|
|
2376
|
-
var
|
|
2375
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId || (lg && platformDevice.limitAdTracking !== true ? getLgTestDeviceId() : void 0);
|
|
2376
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType() || (lg ? "lgudid" : void 0);
|
|
2377
|
+
var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
|
|
2378
|
+
var limitAdTracking = deviceId != null ? (_ref = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
|
|
2377
2379
|
if (isCtv) {
|
|
2378
2380
|
return _object_spread_props(_object_spread({
|
|
2379
2381
|
isCtv: true,
|
|
@@ -2444,6 +2446,72 @@ function createUuid() {
|
|
|
2444
2446
|
return nibble.toString(16);
|
|
2445
2447
|
});
|
|
2446
2448
|
}
|
|
2449
|
+
function readPlatformNativeDeviceId() {
|
|
2450
|
+
if (typeof window === "undefined") return {};
|
|
2451
|
+
try {
|
|
2452
|
+
var _window_webapis;
|
|
2453
|
+
var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
|
|
2454
|
+
if (adinfo) {
|
|
2455
|
+
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
2456
|
+
if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
|
|
2457
|
+
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
2458
|
+
return _object_spread({
|
|
2459
|
+
deviceId: tifa,
|
|
2460
|
+
deviceIdType: "tifa"
|
|
2461
|
+
}, typeof lat === "boolean" ? {
|
|
2462
|
+
limitAdTracking: lat
|
|
2463
|
+
} : {});
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
} catch (unused) {}
|
|
2467
|
+
try {
|
|
2468
|
+
var webOSDev = window.webOSDev;
|
|
2469
|
+
if (webOSDev) {
|
|
2470
|
+
var _webOSDev_lgudid;
|
|
2471
|
+
var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
|
|
2472
|
+
if (typeof lgudid === "string" && lgudid) {
|
|
2473
|
+
if (isZeroedAdId(lgudid)) {
|
|
2474
|
+
return {
|
|
2475
|
+
deviceIdType: "lgudid",
|
|
2476
|
+
limitAdTracking: true
|
|
2477
|
+
};
|
|
2478
|
+
}
|
|
2479
|
+
if (!isMacroPlaceholder(lgudid)) {
|
|
2480
|
+
return {
|
|
2481
|
+
deviceId: lgudid,
|
|
2482
|
+
deviceIdType: "lgudid",
|
|
2483
|
+
limitAdTracking: false
|
|
2484
|
+
};
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
} catch (unused) {}
|
|
2489
|
+
try {
|
|
2490
|
+
var roku = window.Roku;
|
|
2491
|
+
if (roku) {
|
|
2492
|
+
var rida = typeof roku.getPublisherUniqueId === "function" ? roku.getPublisherUniqueId() : roku.rida;
|
|
2493
|
+
if (typeof rida === "string" && rida && !isMacroPlaceholder(rida)) {
|
|
2494
|
+
return {
|
|
2495
|
+
deviceId: rida,
|
|
2496
|
+
deviceIdType: "rida",
|
|
2497
|
+
limitAdTracking: false
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
} catch (unused) {}
|
|
2502
|
+
return {};
|
|
2503
|
+
}
|
|
2504
|
+
var ZEROED_AD_ID_PATTERNS = /* @__PURE__ */ new Set([
|
|
2505
|
+
"38400000-8cf0-11bd-b23e-10b96e40000d",
|
|
2506
|
+
"00000000-0000-0000-0000-000000000000"
|
|
2507
|
+
]);
|
|
2508
|
+
function isMacroPlaceholder(value) {
|
|
2509
|
+
var t = value.trim();
|
|
2510
|
+
return !t || /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/.test(t) || /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(t) || ZEROED_AD_ID_PATTERNS.has(t.toLowerCase());
|
|
2511
|
+
}
|
|
2512
|
+
function isZeroedAdId(value) {
|
|
2513
|
+
return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
|
|
2514
|
+
}
|
|
2447
2515
|
function readNativeBridgeSignals() {
|
|
2448
2516
|
if (typeof window === "undefined") {
|
|
2449
2517
|
return {};
|
|
@@ -2784,7 +2852,7 @@ var INLINE_DEVICE_MACRO_REPLACEMENTS = [
|
|
|
2784
2852
|
}
|
|
2785
2853
|
}
|
|
2786
2854
|
];
|
|
2787
|
-
function
|
|
2855
|
+
function isMacroPlaceholder2(value) {
|
|
2788
2856
|
if (value == null) return true;
|
|
2789
2857
|
var trimmed = value.trim();
|
|
2790
2858
|
if (!trimmed) return true;
|
|
@@ -2843,11 +2911,11 @@ function applyDeviceIdentityParams(params, ctx) {
|
|
|
2843
2911
|
if (runtimeId) {
|
|
2844
2912
|
params.set("rdid", runtimeId);
|
|
2845
2913
|
params.set("idtype", runtimeType || tagType || "aaid");
|
|
2846
|
-
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue :
|
|
2914
|
+
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : isMacroPlaceholder2(tagLat) ? "0" : tagLat);
|
|
2847
2915
|
return;
|
|
2848
2916
|
}
|
|
2849
|
-
var tagRdidValid = Boolean(tagRdid && !
|
|
2850
|
-
var tagTypeValid = Boolean(tagType && !
|
|
2917
|
+
var tagRdidValid = Boolean(tagRdid && !isMacroPlaceholder2(tagRdid));
|
|
2918
|
+
var tagTypeValid = Boolean(tagType && !isMacroPlaceholder2(tagType));
|
|
2851
2919
|
if (tagRdidValid && tagTypeValid && runtimeType && !isEquivalentDeviceIdType(tagType, runtimeType)) {
|
|
2852
2920
|
params.delete("rdid");
|
|
2853
2921
|
params.delete("idtype");
|
|
@@ -2855,10 +2923,10 @@ function applyDeviceIdentityParams(params, ctx) {
|
|
|
2855
2923
|
return;
|
|
2856
2924
|
}
|
|
2857
2925
|
if (tagRdidValid) {
|
|
2858
|
-
if (
|
|
2926
|
+
if (isMacroPlaceholder2(tagType) && runtimeType) {
|
|
2859
2927
|
params.set("idtype", runtimeType);
|
|
2860
2928
|
}
|
|
2861
|
-
if (
|
|
2929
|
+
if (isMacroPlaceholder2(tagLat)) {
|
|
2862
2930
|
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : "0");
|
|
2863
2931
|
}
|
|
2864
2932
|
return;
|
|
@@ -3044,7 +3112,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
3044
3112
|
}
|
|
3045
3113
|
var staleKeys = [];
|
|
3046
3114
|
params.forEach(function(value, key) {
|
|
3047
|
-
if (
|
|
3115
|
+
if (isMacroPlaceholder2(value)) {
|
|
3048
3116
|
staleKeys.push(key);
|
|
3049
3117
|
}
|
|
3050
3118
|
});
|
|
@@ -5993,7 +6061,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
5993
6061
|
key: "setupNativeHls",
|
|
5994
6062
|
value: function setupNativeHls() {
|
|
5995
6063
|
return _async_to_generator(function() {
|
|
5996
|
-
var _this_config_isLiveStream, _this_config_lowLatencyMode, _this_video_play;
|
|
6064
|
+
var _this_config_isLiveStream, _this_config_lowLatencyMode, adBehavior, _this_video_play;
|
|
5997
6065
|
return _ts_generator(this, function(_state) {
|
|
5998
6066
|
switch(_state.label){
|
|
5999
6067
|
case 0:
|
|
@@ -6002,10 +6070,11 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6002
6070
|
this.video.src = this.config.src;
|
|
6003
6071
|
this.isLiveStream = (_this_config_isLiveStream = this.config.isLiveStream) !== null && _this_config_isLiveStream !== void 0 ? _this_config_isLiveStream : (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false;
|
|
6004
6072
|
if (this.debug) {
|
|
6005
|
-
|
|
6073
|
+
adBehavior = this.isLiveStream ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
|
|
6074
|
+
console.log("[StormcloudVideoPlayer] Using native HLS playback:", {
|
|
6006
6075
|
isLive: this.isLiveStream,
|
|
6007
6076
|
allowNativeHls: this.config.allowNativeHls,
|
|
6008
|
-
adBehavior:
|
|
6077
|
+
adBehavior: adBehavior
|
|
6009
6078
|
});
|
|
6010
6079
|
}
|
|
6011
6080
|
if (!this.config.autoplay) return [
|
|
@@ -6414,6 +6483,14 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6414
6483
|
});
|
|
6415
6484
|
}
|
|
6416
6485
|
},
|
|
6486
|
+
{
|
|
6487
|
+
key: "getLiveSyncPosition",
|
|
6488
|
+
value: function getLiveSyncPosition() {
|
|
6489
|
+
var _this_hls;
|
|
6490
|
+
var pos = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.liveSyncPosition;
|
|
6491
|
+
return typeof pos === "number" && Number.isFinite(pos) ? pos : void 0;
|
|
6492
|
+
}
|
|
6493
|
+
},
|
|
6417
6494
|
{
|
|
6418
6495
|
key: "destroy",
|
|
6419
6496
|
value: function destroy() {
|
|
@@ -7988,6 +8065,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7988
8065
|
this.host.video.volume = restoredVolume;
|
|
7989
8066
|
}
|
|
7990
8067
|
if (this.host.shouldContinueLiveStreamDuringAds()) {
|
|
8068
|
+
var liveSyncPos = this.host.getLiveSyncPosition();
|
|
8069
|
+
if (liveSyncPos != null && liveSyncPos > this.host.video.currentTime) {
|
|
8070
|
+
if (this.debug) {
|
|
8071
|
+
console.log("[StormcloudVideoPlayer] Live break end — snapping to live edge: ".concat(this.host.video.currentTime.toFixed(2), "s → ").concat(liveSyncPos.toFixed(2), "s"));
|
|
8072
|
+
}
|
|
8073
|
+
this.host.video.currentTime = liveSyncPos;
|
|
8074
|
+
}
|
|
7991
8075
|
if (this.host.video.paused) {
|
|
7992
8076
|
var _this_host_video_play;
|
|
7993
8077
|
if (this.debug) console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
|
|
@@ -8130,6 +8214,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8130
8214
|
shouldContinueLiveStreamDuringAds: function shouldContinueLiveStreamDuringAds() {
|
|
8131
8215
|
return _this.shouldContinueLiveStreamDuringAds();
|
|
8132
8216
|
},
|
|
8217
|
+
getLiveSyncPosition: function getLiveSyncPosition() {
|
|
8218
|
+
return _this.hlsEngine.getLiveSyncPosition();
|
|
8219
|
+
},
|
|
8133
8220
|
generateVastUrls: function generateVastUrls(base, count) {
|
|
8134
8221
|
return _this.generateVastUrls(base, count);
|
|
8135
8222
|
}
|
|
@@ -8171,7 +8258,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8171
8258
|
// ───────────────────────────────────────────────────────────────
|
|
8172
8259
|
function load() {
|
|
8173
8260
|
return _async_to_generator(function() {
|
|
8174
|
-
var _this, _this_config_lowLatencyMode, error;
|
|
8261
|
+
var _this, _this_config_lowLatencyMode, error, continueLiveStreamDuringAds;
|
|
8175
8262
|
return _ts_generator(this, function(_state) {
|
|
8176
8263
|
switch(_state.label){
|
|
8177
8264
|
case 0:
|
|
@@ -8225,15 +8312,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8225
8312
|
3,
|
|
8226
8313
|
6
|
|
8227
8314
|
];
|
|
8228
|
-
this.adPlayer.destroy();
|
|
8229
|
-
this.adPlayer = this.createAdPlayer(false);
|
|
8230
|
-
this.adPlayer.initialize();
|
|
8231
8315
|
return [
|
|
8232
8316
|
4,
|
|
8233
8317
|
this.hlsEngine.setupNativeHls()
|
|
8234
8318
|
];
|
|
8235
8319
|
case 5:
|
|
8236
8320
|
_state.sent();
|
|
8321
|
+
continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
|
|
8322
|
+
if (this.debug) {
|
|
8323
|
+
console.log("[StormcloudVideoPlayer] Native HLS ad behavior:", {
|
|
8324
|
+
isLive: this.hlsEngine.isLiveStream,
|
|
8325
|
+
continueLiveStreamDuringAds: continueLiveStreamDuringAds
|
|
8326
|
+
});
|
|
8327
|
+
}
|
|
8328
|
+
this.adPlayer.destroy();
|
|
8329
|
+
this.adPlayer = this.createAdPlayer(continueLiveStreamDuringAds);
|
|
8330
|
+
this.adPlayer.initialize();
|
|
8237
8331
|
return [
|
|
8238
8332
|
2
|
|
8239
8333
|
];
|
|
@@ -8341,9 +8435,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8341
8435
|
{
|
|
8342
8436
|
key: "shouldContinueLiveStreamDuringAds",
|
|
8343
8437
|
value: function shouldContinueLiveStreamDuringAds() {
|
|
8344
|
-
if (this.
|
|
8345
|
-
|
|
8346
|
-
|
|
8438
|
+
if (this.hlsEngine.isLiveStream) {
|
|
8439
|
+
return true;
|
|
8440
|
+
}
|
|
8441
|
+
var duration = this.video.duration;
|
|
8442
|
+
if (!Number.isFinite(duration) || duration === Infinity) {
|
|
8443
|
+
return true;
|
|
8444
|
+
}
|
|
8445
|
+
return false;
|
|
8347
8446
|
}
|
|
8348
8447
|
},
|
|
8349
8448
|
{
|
|
@@ -8641,9 +8740,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8641
8740
|
this.adBreak.showAds = true;
|
|
8642
8741
|
this.adBreak.inAdBreak = true;
|
|
8643
8742
|
this.timing.currentAdBreakStartWallClockMs = Date.now();
|
|
8644
|
-
if (!this.video.paused) {
|
|
8645
|
-
this.video.pause();
|
|
8646
|
-
}
|
|
8647
8743
|
_state.label = 1;
|
|
8648
8744
|
case 1:
|
|
8649
8745
|
_state.trys.push([
|
|
@@ -8904,6 +9000,7 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react_Component) {
|
|
|
8904
9000
|
if (_this1.props.muted !== void 0) config.muted = _this1.props.muted;
|
|
8905
9001
|
if (_this1.props.lowLatencyMode !== void 0) config.lowLatencyMode = _this1.props.lowLatencyMode;
|
|
8906
9002
|
if (_this1.props.allowNativeHls !== void 0) config.allowNativeHls = _this1.props.allowNativeHls;
|
|
9003
|
+
if (_this1.props.isLiveStream !== void 0) config.isLiveStream = _this1.props.isLiveStream;
|
|
8907
9004
|
if (_this1.props.driftToleranceMs !== void 0) config.driftToleranceMs = _this1.props.driftToleranceMs;
|
|
8908
9005
|
if (_this1.props.immediateManifestAds !== void 0) config.immediateManifestAds = _this1.props.immediateManifestAds;
|
|
8909
9006
|
if (_this1.props.debugAdTiming !== void 0) config.debugAdTiming = _this1.props.debugAdTiming;
|