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
package/lib/players/index.cjs
CHANGED
|
@@ -2404,12 +2404,14 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
|
|
|
2404
2404
|
"adid"
|
|
2405
2405
|
]);
|
|
2406
2406
|
function resolveVastEnvironmentSignals(isCtv) {
|
|
2407
|
-
var _ref
|
|
2407
|
+
var _ref;
|
|
2408
2408
|
var bridgeSignals = readNativeBridgeSignals();
|
|
2409
|
+
var platformDevice = readPlatformNativeDeviceId();
|
|
2409
2410
|
var lg = isCtv && isLgWebOS();
|
|
2410
|
-
var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || (lg ? getLgTestDeviceId() : void 0);
|
|
2411
|
-
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || inferDeviceIdType() || (lg ? "lgudid" : void 0);
|
|
2412
|
-
var
|
|
2411
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId || (lg && platformDevice.limitAdTracking !== true ? getLgTestDeviceId() : void 0);
|
|
2412
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType() || (lg ? "lgudid" : void 0);
|
|
2413
|
+
var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
|
|
2414
|
+
var limitAdTracking = deviceId != null ? (_ref = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
|
|
2413
2415
|
if (isCtv) {
|
|
2414
2416
|
return _object_spread_props(_object_spread({
|
|
2415
2417
|
isCtv: true,
|
|
@@ -2480,6 +2482,72 @@ function createUuid() {
|
|
|
2480
2482
|
return nibble.toString(16);
|
|
2481
2483
|
});
|
|
2482
2484
|
}
|
|
2485
|
+
function readPlatformNativeDeviceId() {
|
|
2486
|
+
if (typeof window === "undefined") return {};
|
|
2487
|
+
try {
|
|
2488
|
+
var _window_webapis;
|
|
2489
|
+
var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
|
|
2490
|
+
if (adinfo) {
|
|
2491
|
+
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
2492
|
+
if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
|
|
2493
|
+
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
2494
|
+
return _object_spread({
|
|
2495
|
+
deviceId: tifa,
|
|
2496
|
+
deviceIdType: "tifa"
|
|
2497
|
+
}, typeof lat === "boolean" ? {
|
|
2498
|
+
limitAdTracking: lat
|
|
2499
|
+
} : {});
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
} catch (unused) {}
|
|
2503
|
+
try {
|
|
2504
|
+
var webOSDev = window.webOSDev;
|
|
2505
|
+
if (webOSDev) {
|
|
2506
|
+
var _webOSDev_lgudid;
|
|
2507
|
+
var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
|
|
2508
|
+
if (typeof lgudid === "string" && lgudid) {
|
|
2509
|
+
if (isZeroedAdId(lgudid)) {
|
|
2510
|
+
return {
|
|
2511
|
+
deviceIdType: "lgudid",
|
|
2512
|
+
limitAdTracking: true
|
|
2513
|
+
};
|
|
2514
|
+
}
|
|
2515
|
+
if (!isMacroPlaceholder(lgudid)) {
|
|
2516
|
+
return {
|
|
2517
|
+
deviceId: lgudid,
|
|
2518
|
+
deviceIdType: "lgudid",
|
|
2519
|
+
limitAdTracking: false
|
|
2520
|
+
};
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
} catch (unused) {}
|
|
2525
|
+
try {
|
|
2526
|
+
var roku = window.Roku;
|
|
2527
|
+
if (roku) {
|
|
2528
|
+
var rida = typeof roku.getPublisherUniqueId === "function" ? roku.getPublisherUniqueId() : roku.rida;
|
|
2529
|
+
if (typeof rida === "string" && rida && !isMacroPlaceholder(rida)) {
|
|
2530
|
+
return {
|
|
2531
|
+
deviceId: rida,
|
|
2532
|
+
deviceIdType: "rida",
|
|
2533
|
+
limitAdTracking: false
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
} catch (unused) {}
|
|
2538
|
+
return {};
|
|
2539
|
+
}
|
|
2540
|
+
var ZEROED_AD_ID_PATTERNS = /* @__PURE__ */ new Set([
|
|
2541
|
+
"38400000-8cf0-11bd-b23e-10b96e40000d",
|
|
2542
|
+
"00000000-0000-0000-0000-000000000000"
|
|
2543
|
+
]);
|
|
2544
|
+
function isMacroPlaceholder(value) {
|
|
2545
|
+
var t = value.trim();
|
|
2546
|
+
return !t || /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/.test(t) || /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(t) || ZEROED_AD_ID_PATTERNS.has(t.toLowerCase());
|
|
2547
|
+
}
|
|
2548
|
+
function isZeroedAdId(value) {
|
|
2549
|
+
return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
|
|
2550
|
+
}
|
|
2483
2551
|
function readNativeBridgeSignals() {
|
|
2484
2552
|
if (typeof window === "undefined") {
|
|
2485
2553
|
return {};
|
|
@@ -2820,7 +2888,7 @@ var INLINE_DEVICE_MACRO_REPLACEMENTS = [
|
|
|
2820
2888
|
}
|
|
2821
2889
|
}
|
|
2822
2890
|
];
|
|
2823
|
-
function
|
|
2891
|
+
function isMacroPlaceholder2(value) {
|
|
2824
2892
|
if (value == null) return true;
|
|
2825
2893
|
var trimmed = value.trim();
|
|
2826
2894
|
if (!trimmed) return true;
|
|
@@ -2879,11 +2947,11 @@ function applyDeviceIdentityParams(params, ctx) {
|
|
|
2879
2947
|
if (runtimeId) {
|
|
2880
2948
|
params.set("rdid", runtimeId);
|
|
2881
2949
|
params.set("idtype", runtimeType || tagType || "aaid");
|
|
2882
|
-
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue :
|
|
2950
|
+
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : isMacroPlaceholder2(tagLat) ? "0" : tagLat);
|
|
2883
2951
|
return;
|
|
2884
2952
|
}
|
|
2885
|
-
var tagRdidValid = Boolean(tagRdid && !
|
|
2886
|
-
var tagTypeValid = Boolean(tagType && !
|
|
2953
|
+
var tagRdidValid = Boolean(tagRdid && !isMacroPlaceholder2(tagRdid));
|
|
2954
|
+
var tagTypeValid = Boolean(tagType && !isMacroPlaceholder2(tagType));
|
|
2887
2955
|
if (tagRdidValid && tagTypeValid && runtimeType && !isEquivalentDeviceIdType(tagType, runtimeType)) {
|
|
2888
2956
|
params.delete("rdid");
|
|
2889
2957
|
params.delete("idtype");
|
|
@@ -2891,10 +2959,10 @@ function applyDeviceIdentityParams(params, ctx) {
|
|
|
2891
2959
|
return;
|
|
2892
2960
|
}
|
|
2893
2961
|
if (tagRdidValid) {
|
|
2894
|
-
if (
|
|
2962
|
+
if (isMacroPlaceholder2(tagType) && runtimeType) {
|
|
2895
2963
|
params.set("idtype", runtimeType);
|
|
2896
2964
|
}
|
|
2897
|
-
if (
|
|
2965
|
+
if (isMacroPlaceholder2(tagLat)) {
|
|
2898
2966
|
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : "0");
|
|
2899
2967
|
}
|
|
2900
2968
|
return;
|
|
@@ -3080,7 +3148,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
3080
3148
|
}
|
|
3081
3149
|
var staleKeys = [];
|
|
3082
3150
|
params.forEach(function(value, key) {
|
|
3083
|
-
if (
|
|
3151
|
+
if (isMacroPlaceholder2(value)) {
|
|
3084
3152
|
staleKeys.push(key);
|
|
3085
3153
|
}
|
|
3086
3154
|
});
|
|
@@ -6029,7 +6097,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6029
6097
|
key: "setupNativeHls",
|
|
6030
6098
|
value: function setupNativeHls() {
|
|
6031
6099
|
return _async_to_generator(function() {
|
|
6032
|
-
var _this_config_isLiveStream, _this_config_lowLatencyMode, _this_video_play;
|
|
6100
|
+
var _this_config_isLiveStream, _this_config_lowLatencyMode, adBehavior, _this_video_play;
|
|
6033
6101
|
return _ts_generator(this, function(_state) {
|
|
6034
6102
|
switch(_state.label){
|
|
6035
6103
|
case 0:
|
|
@@ -6038,10 +6106,11 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6038
6106
|
this.video.src = this.config.src;
|
|
6039
6107
|
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;
|
|
6040
6108
|
if (this.debug) {
|
|
6041
|
-
|
|
6109
|
+
adBehavior = this.isLiveStream ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
|
|
6110
|
+
console.log("[StormcloudVideoPlayer] Using native HLS playback:", {
|
|
6042
6111
|
isLive: this.isLiveStream,
|
|
6043
6112
|
allowNativeHls: this.config.allowNativeHls,
|
|
6044
|
-
adBehavior:
|
|
6113
|
+
adBehavior: adBehavior
|
|
6045
6114
|
});
|
|
6046
6115
|
}
|
|
6047
6116
|
if (!this.config.autoplay) return [
|
|
@@ -6450,6 +6519,14 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6450
6519
|
});
|
|
6451
6520
|
}
|
|
6452
6521
|
},
|
|
6522
|
+
{
|
|
6523
|
+
key: "getLiveSyncPosition",
|
|
6524
|
+
value: function getLiveSyncPosition() {
|
|
6525
|
+
var _this_hls;
|
|
6526
|
+
var pos = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.liveSyncPosition;
|
|
6527
|
+
return typeof pos === "number" && Number.isFinite(pos) ? pos : void 0;
|
|
6528
|
+
}
|
|
6529
|
+
},
|
|
6453
6530
|
{
|
|
6454
6531
|
key: "destroy",
|
|
6455
6532
|
value: function destroy() {
|
|
@@ -8024,6 +8101,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8024
8101
|
this.host.video.volume = restoredVolume;
|
|
8025
8102
|
}
|
|
8026
8103
|
if (this.host.shouldContinueLiveStreamDuringAds()) {
|
|
8104
|
+
var liveSyncPos = this.host.getLiveSyncPosition();
|
|
8105
|
+
if (liveSyncPos != null && liveSyncPos > this.host.video.currentTime) {
|
|
8106
|
+
if (this.debug) {
|
|
8107
|
+
console.log("[StormcloudVideoPlayer] Live break end — snapping to live edge: ".concat(this.host.video.currentTime.toFixed(2), "s → ").concat(liveSyncPos.toFixed(2), "s"));
|
|
8108
|
+
}
|
|
8109
|
+
this.host.video.currentTime = liveSyncPos;
|
|
8110
|
+
}
|
|
8027
8111
|
if (this.host.video.paused) {
|
|
8028
8112
|
var _this_host_video_play;
|
|
8029
8113
|
if (this.debug) console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
|
|
@@ -8166,6 +8250,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8166
8250
|
shouldContinueLiveStreamDuringAds: function shouldContinueLiveStreamDuringAds() {
|
|
8167
8251
|
return _this.shouldContinueLiveStreamDuringAds();
|
|
8168
8252
|
},
|
|
8253
|
+
getLiveSyncPosition: function getLiveSyncPosition() {
|
|
8254
|
+
return _this.hlsEngine.getLiveSyncPosition();
|
|
8255
|
+
},
|
|
8169
8256
|
generateVastUrls: function generateVastUrls(base, count) {
|
|
8170
8257
|
return _this.generateVastUrls(base, count);
|
|
8171
8258
|
}
|
|
@@ -8207,7 +8294,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8207
8294
|
// ───────────────────────────────────────────────────────────────
|
|
8208
8295
|
function load() {
|
|
8209
8296
|
return _async_to_generator(function() {
|
|
8210
|
-
var _this, _this_config_lowLatencyMode, error;
|
|
8297
|
+
var _this, _this_config_lowLatencyMode, error, continueLiveStreamDuringAds;
|
|
8211
8298
|
return _ts_generator(this, function(_state) {
|
|
8212
8299
|
switch(_state.label){
|
|
8213
8300
|
case 0:
|
|
@@ -8261,15 +8348,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8261
8348
|
3,
|
|
8262
8349
|
6
|
|
8263
8350
|
];
|
|
8264
|
-
this.adPlayer.destroy();
|
|
8265
|
-
this.adPlayer = this.createAdPlayer(false);
|
|
8266
|
-
this.adPlayer.initialize();
|
|
8267
8351
|
return [
|
|
8268
8352
|
4,
|
|
8269
8353
|
this.hlsEngine.setupNativeHls()
|
|
8270
8354
|
];
|
|
8271
8355
|
case 5:
|
|
8272
8356
|
_state.sent();
|
|
8357
|
+
continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
|
|
8358
|
+
if (this.debug) {
|
|
8359
|
+
console.log("[StormcloudVideoPlayer] Native HLS ad behavior:", {
|
|
8360
|
+
isLive: this.hlsEngine.isLiveStream,
|
|
8361
|
+
continueLiveStreamDuringAds: continueLiveStreamDuringAds
|
|
8362
|
+
});
|
|
8363
|
+
}
|
|
8364
|
+
this.adPlayer.destroy();
|
|
8365
|
+
this.adPlayer = this.createAdPlayer(continueLiveStreamDuringAds);
|
|
8366
|
+
this.adPlayer.initialize();
|
|
8273
8367
|
return [
|
|
8274
8368
|
2
|
|
8275
8369
|
];
|
|
@@ -8377,9 +8471,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8377
8471
|
{
|
|
8378
8472
|
key: "shouldContinueLiveStreamDuringAds",
|
|
8379
8473
|
value: function shouldContinueLiveStreamDuringAds() {
|
|
8380
|
-
if (this.
|
|
8381
|
-
|
|
8382
|
-
|
|
8474
|
+
if (this.hlsEngine.isLiveStream) {
|
|
8475
|
+
return true;
|
|
8476
|
+
}
|
|
8477
|
+
var duration = this.video.duration;
|
|
8478
|
+
if (!Number.isFinite(duration) || duration === Infinity) {
|
|
8479
|
+
return true;
|
|
8480
|
+
}
|
|
8481
|
+
return false;
|
|
8383
8482
|
}
|
|
8384
8483
|
},
|
|
8385
8484
|
{
|
|
@@ -8677,9 +8776,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8677
8776
|
this.adBreak.showAds = true;
|
|
8678
8777
|
this.adBreak.inAdBreak = true;
|
|
8679
8778
|
this.timing.currentAdBreakStartWallClockMs = Date.now();
|
|
8680
|
-
if (!this.video.paused) {
|
|
8681
|
-
this.video.pause();
|
|
8682
|
-
}
|
|
8683
8779
|
_state.label = 1;
|
|
8684
8780
|
case 1:
|
|
8685
8781
|
_state.trys.push([
|
|
@@ -8912,6 +9008,7 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
|
|
|
8912
9008
|
if (_this1.props.muted !== void 0) config.muted = _this1.props.muted;
|
|
8913
9009
|
if (_this1.props.lowLatencyMode !== void 0) config.lowLatencyMode = _this1.props.lowLatencyMode;
|
|
8914
9010
|
if (_this1.props.allowNativeHls !== void 0) config.allowNativeHls = _this1.props.allowNativeHls;
|
|
9011
|
+
if (_this1.props.isLiveStream !== void 0) config.isLiveStream = _this1.props.isLiveStream;
|
|
8915
9012
|
if (_this1.props.driftToleranceMs !== void 0) config.driftToleranceMs = _this1.props.driftToleranceMs;
|
|
8916
9013
|
if (_this1.props.immediateManifestAds !== void 0) config.immediateManifestAds = _this1.props.immediateManifestAds;
|
|
8917
9014
|
if (_this1.props.debugAdTiming !== void 0) config.debugAdTiming = _this1.props.debugAdTiming;
|