stormcloud-video-player 0.8.81 → 0.8.82
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/Player.d.cts +1 -1
- package/lib/StormcloudPlayer.cjs +79 -7
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/index.cjs +79 -7
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +79 -7
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +63 -3
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -0
- package/lib/player/AdConfigManager.cjs +7 -2
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +79 -7
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +79 -7
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +79 -7
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +13 -0
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/types.d.cts +1 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +79 -7
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/__tests__/adSignals.test.cjs +6 -2
- package/lib/utils/__tests__/adSignals.test.cjs.map +1 -1
- package/lib/utils/browserCompat.cjs +33 -0
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/browserCompat.d.cts +3 -1
- package/lib/utils/contentMetadata.cjs +15 -4
- package/lib/utils/contentMetadata.cjs.map +1 -1
- package/lib/utils/contentMetadata.d.cts +2 -0
- package/lib/utils/partnerSignals.cjs +3 -1
- package/lib/utils/partnerSignals.cjs.map +1 -1
- package/package.json +1 -1
package/lib/Player.d.cts
CHANGED
|
@@ -14,7 +14,7 @@ interface PlayerProps extends BaseStormcloudPlayerProps {
|
|
|
14
14
|
}
|
|
15
15
|
declare class Player extends Component<PlayerProps> {
|
|
16
16
|
static displayName: string;
|
|
17
|
-
static defaultProps: Required<Omit<BaseStormcloudPlayerProps, "
|
|
17
|
+
static defaultProps: Required<Omit<BaseStormcloudPlayerProps, "maxAdBreakExtensionMs" | "minRemainingMsToRequestAd" | "maxNoFillsPerBreak" | "vastTagUrl" | "ctvAdRequest" | keyof React.VideoHTMLAttributes<HTMLVideoElement> | "onReady">>;
|
|
18
18
|
private mounted;
|
|
19
19
|
private isReady;
|
|
20
20
|
private isPlaying;
|
package/lib/StormcloudPlayer.cjs
CHANGED
|
@@ -1341,7 +1341,9 @@ var BRIDGE_KEYS = {
|
|
|
1341
1341
|
],
|
|
1342
1342
|
contentRating: [
|
|
1343
1343
|
"contentRating",
|
|
1344
|
-
"ctr"
|
|
1344
|
+
"ctr",
|
|
1345
|
+
"programRating",
|
|
1346
|
+
"rating"
|
|
1345
1347
|
],
|
|
1346
1348
|
contentId: [
|
|
1347
1349
|
"contentId",
|
|
@@ -1353,7 +1355,9 @@ function sanitizeContentValue(value) {
|
|
|
1353
1355
|
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1354
1356
|
if (!cleaned) return void 0;
|
|
1355
1357
|
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
1356
|
-
if (/^(unknown|null|undefined|none|n\/a
|
|
1358
|
+
if (/^(unknown|null|undefined|none|n\/a|-|tbd|tba|to be (announced|determined))$/i.test(cleaned)) {
|
|
1359
|
+
return void 0;
|
|
1360
|
+
}
|
|
1357
1361
|
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
1358
1362
|
}
|
|
1359
1363
|
function sanitizeContentScalar(value) {
|
|
@@ -1479,6 +1483,7 @@ function resolveContentMetadata(config) {
|
|
|
1479
1483
|
} : {});
|
|
1480
1484
|
}
|
|
1481
1485
|
function applyContentMetadataUpdate(target, meta) {
|
|
1486
|
+
var _target_contentDetails;
|
|
1482
1487
|
var apply = function apply(key, value) {
|
|
1483
1488
|
if (value === void 0) return;
|
|
1484
1489
|
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
@@ -1488,9 +1493,15 @@ function applyContentMetadataUpdate(target, meta) {
|
|
|
1488
1493
|
apply("channelName", meta.channelName);
|
|
1489
1494
|
apply("programTitle", meta.programTitle);
|
|
1490
1495
|
apply("contentNetwork", meta.contentNetwork);
|
|
1491
|
-
if (meta.details === void 0) return;
|
|
1492
1496
|
if (meta.details === null) delete target.contentDetails;
|
|
1493
|
-
else target.contentDetails = _object_spread({}, meta.details);
|
|
1497
|
+
else if (meta.details !== void 0) target.contentDetails = _object_spread({}, meta.details);
|
|
1498
|
+
var rating = meta.programRating !== void 0 ? meta.programRating : meta.contentRating;
|
|
1499
|
+
if (rating === void 0) return;
|
|
1500
|
+
var cleanRating = rating === null ? void 0 : sanitizeContentValue(rating);
|
|
1501
|
+
var details = _object_spread({}, (_target_contentDetails = target.contentDetails) !== null && _target_contentDetails !== void 0 ? _target_contentDetails : {});
|
|
1502
|
+
if (cleanRating) details.rating = cleanRating;
|
|
1503
|
+
else delete details.rating;
|
|
1504
|
+
target.contentDetails = details;
|
|
1494
1505
|
}
|
|
1495
1506
|
function appendMissingContentParams(url, meta) {
|
|
1496
1507
|
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
@@ -2886,9 +2897,30 @@ function detectBrowser() {
|
|
|
2886
2897
|
};
|
|
2887
2898
|
}
|
|
2888
2899
|
var singleDecoderOverride;
|
|
2900
|
+
var LEARNED_SINGLE_DECODER_KEY = "stormcloud.singleDecoder.learned.v1";
|
|
2901
|
+
var learnedSingleDecoder;
|
|
2889
2902
|
function setSingleDecoderOverride(value) {
|
|
2890
2903
|
singleDecoderOverride = value;
|
|
2891
2904
|
}
|
|
2905
|
+
function readLearnedSingleDecoder() {
|
|
2906
|
+
if (learnedSingleDecoder !== void 0) return learnedSingleDecoder;
|
|
2907
|
+
try {
|
|
2908
|
+
var _window_localStorage;
|
|
2909
|
+
learnedSingleDecoder = typeof window !== "undefined" && ((_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(LEARNED_SINGLE_DECODER_KEY)) === "1";
|
|
2910
|
+
} catch (unused) {
|
|
2911
|
+
learnedSingleDecoder = false;
|
|
2912
|
+
}
|
|
2913
|
+
return learnedSingleDecoder;
|
|
2914
|
+
}
|
|
2915
|
+
function markSingleDecoderLearned() {
|
|
2916
|
+
if (readLearnedSingleDecoder()) return false;
|
|
2917
|
+
learnedSingleDecoder = true;
|
|
2918
|
+
try {
|
|
2919
|
+
var _window_localStorage;
|
|
2920
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(LEARNED_SINGLE_DECODER_KEY, "1");
|
|
2921
|
+
} catch (unused) {}
|
|
2922
|
+
return true;
|
|
2923
|
+
}
|
|
2892
2924
|
function requiresMediaPipelineResetAfterAds() {
|
|
2893
2925
|
var _browser_tizenVersion;
|
|
2894
2926
|
if (singleDecoderOverride != null) return singleDecoderOverride;
|
|
@@ -2896,6 +2928,7 @@ function requiresMediaPipelineResetAfterAds() {
|
|
|
2896
2928
|
var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
|
|
2897
2929
|
if (typeof globalOverride === "boolean") return globalOverride;
|
|
2898
2930
|
} catch (unused) {}
|
|
2931
|
+
if (readLearnedSingleDecoder()) return true;
|
|
2899
2932
|
var browser = detectBrowser();
|
|
2900
2933
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
2901
2934
|
}
|
|
@@ -9675,6 +9708,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9675
9708
|
ct_ch: content.channelName,
|
|
9676
9709
|
ct_ti: content.programTitle,
|
|
9677
9710
|
ct_ne: content.contentNetwork,
|
|
9711
|
+
rating: content.contentRating,
|
|
9678
9712
|
ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
|
|
9679
9713
|
live: isLive,
|
|
9680
9714
|
player: playerSize,
|
|
@@ -11358,6 +11392,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11358
11392
|
this.adDetectSentForCurrentBreak = false;
|
|
11359
11393
|
this.slotState = "IDLE";
|
|
11360
11394
|
this.unusableResponsesInBreak = 0;
|
|
11395
|
+
this.playedAdIdsInBreak = /* @__PURE__ */ new Set();
|
|
11361
11396
|
this.controllerGeneration = 0;
|
|
11362
11397
|
this.requestDiagnostics = /* @__PURE__ */ new Map();
|
|
11363
11398
|
this.breakFunnel = {};
|
|
@@ -11454,6 +11489,11 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11454
11489
|
_this.recordRequestDiagnostic(payload);
|
|
11455
11490
|
});
|
|
11456
11491
|
adPlayer.on("ad_impression", function() {
|
|
11492
|
+
var _this_host_getAdPlayer_getLoadedAdId, _this_host_getAdPlayer;
|
|
11493
|
+
var impressionAdId = (_this_host_getAdPlayer_getLoadedAdId = (_this_host_getAdPlayer = _this.host.getAdPlayer()).getLoadedAdId) === null || _this_host_getAdPlayer_getLoadedAdId === void 0 ? void 0 : _this_host_getAdPlayer_getLoadedAdId.call(_this_host_getAdPlayer);
|
|
11494
|
+
if (impressionAdId != null && impressionAdId !== "") {
|
|
11495
|
+
_this.playedAdIdsInBreak.add(String(impressionAdId));
|
|
11496
|
+
}
|
|
11457
11497
|
_this.timing.consecutiveFailures = 0;
|
|
11458
11498
|
_this.setSlotState("PLAYING", "impression");
|
|
11459
11499
|
if (!_this.playbackStartedForCurrentRequest) {
|
|
@@ -11645,6 +11685,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11645
11685
|
this.resetEdgeStateForBreak();
|
|
11646
11686
|
this.followUpBaseVastUrl = void 0;
|
|
11647
11687
|
this.unusableResponsesInBreak = 0;
|
|
11688
|
+
this.playedAdIdsInBreak.clear();
|
|
11648
11689
|
this.timing.totalAdRequestsInBreak = 0;
|
|
11649
11690
|
this.setSlotState("NEEDS_NEXT_AD", "vmap_break_start");
|
|
11650
11691
|
this.noteOpportunity("vmap", breakKey, position);
|
|
@@ -11695,6 +11736,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11695
11736
|
this.breakSource = "scte35";
|
|
11696
11737
|
this.followUpBaseVastUrl = baseVastUrl;
|
|
11697
11738
|
this.unusableResponsesInBreak = 0;
|
|
11739
|
+
this.playedAdIdsInBreak.clear();
|
|
11698
11740
|
this.resetEdgeStateForBreak();
|
|
11699
11741
|
this.setSlotState("NEEDS_NEXT_AD", "scte35_break_start");
|
|
11700
11742
|
if (this.adConfig.podAssignedByPrefetch) {
|
|
@@ -12534,6 +12576,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12534
12576
|
var outcome;
|
|
12535
12577
|
if (message.includes("ad_duration_exceeds_budget")) {
|
|
12536
12578
|
outcome = "discarded_budget";
|
|
12579
|
+
} else if (message.includes("ad_repeated_in_break")) {
|
|
12580
|
+
outcome = "discarded_duplicate";
|
|
12537
12581
|
} else if (message.includes("VAST fill rejected")) {
|
|
12538
12582
|
outcome = "fill_rejected";
|
|
12539
12583
|
} else if (/no ads available|no fill|nofill/i.test(message)) {
|
|
@@ -12548,7 +12592,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12548
12592
|
outcome = "request_failed";
|
|
12549
12593
|
}
|
|
12550
12594
|
this.timing.consecutiveFailures++;
|
|
12551
|
-
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget") {
|
|
12595
|
+
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget" || outcome === "discarded_duplicate") {
|
|
12552
12596
|
this.unusableResponsesInBreak++;
|
|
12553
12597
|
}
|
|
12554
12598
|
if (outcome === "no_fill") {
|
|
@@ -12562,7 +12606,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12562
12606
|
}) ? diag.dispatchedUrl : vastTagUrl;
|
|
12563
12607
|
if (this.timing.isTemporaryAdError(error)) {
|
|
12564
12608
|
this.timing.temporaryFailureUrls.set(failureKey, Date.now());
|
|
12565
|
-
} else if (outcome !== "discarded_budget") {
|
|
12609
|
+
} else if (outcome !== "discarded_budget" && outcome !== "discarded_duplicate") {
|
|
12566
12610
|
this.timing.failedVastUrls.add(failureKey);
|
|
12567
12611
|
}
|
|
12568
12612
|
this.countFunnelStage("request_outcome:".concat(outcome));
|
|
@@ -12934,7 +12978,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12934
12978
|
value: function playSingleAd(vastTagUrl) {
|
|
12935
12979
|
var trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "vmap";
|
|
12936
12980
|
return _async_to_generator(function() {
|
|
12937
|
-
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, finalizeRequestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12981
|
+
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, _ref, _ap_getLoadedAdId, _ap_getPodAdCount, finalizeRequestUrl, loadedAdId, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12938
12982
|
return _ts_generator(this, function(_state) {
|
|
12939
12983
|
switch(_state.label){
|
|
12940
12984
|
case 0:
|
|
@@ -13047,6 +13091,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13047
13091
|
vastUrl: (_this_currentVastUrl = this.currentVastUrl) !== null && _this_currentVastUrl !== void 0 ? _this_currentVastUrl : requestUrl,
|
|
13048
13092
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
13049
13093
|
}, this.analyticsContext).catch(function() {});
|
|
13094
|
+
loadedAdId = (_ap_getLoadedAdId = ap.getLoadedAdId) === null || _ap_getLoadedAdId === void 0 ? void 0 : _ap_getLoadedAdId.call(ap);
|
|
13095
|
+
if (!this.host.config.allowRepeatAdsInBreak && loadedAdId != null && loadedAdId !== "" && ((_ref = (_ap_getPodAdCount = ap.getPodAdCount) === null || _ap_getPodAdCount === void 0 ? void 0 : _ap_getPodAdCount.call(ap)) !== null && _ref !== void 0 ? _ref : 1) <= 1 && this.playedAdIdsInBreak.has(String(loadedAdId))) {
|
|
13096
|
+
if (this.debug) {
|
|
13097
|
+
console.log("[AD-DURATION] Rejected ad id=".concat(loadedAdId, ": already played in this break — requesting another ad"));
|
|
13098
|
+
}
|
|
13099
|
+
this.logOrchestratorFunnel("discarded_duplicate", {
|
|
13100
|
+
adId: String(loadedAdId)
|
|
13101
|
+
});
|
|
13102
|
+
throw new Error("ad_repeated_in_break");
|
|
13103
|
+
}
|
|
13050
13104
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
13051
13105
|
;
|
|
13052
13106
|
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
@@ -13100,6 +13154,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13100
13154
|
this.recordRequestFailure(error, vastTagUrl);
|
|
13101
13155
|
if ((error === null || error === void 0 ? void 0 : error.message) === "ad_duration_exceeds_budget") {
|
|
13102
13156
|
this.recreateAdController("discarded_budget");
|
|
13157
|
+
} else if ((error === null || error === void 0 ? void 0 : error.message) === "ad_repeated_in_break") {
|
|
13158
|
+
this.recreateAdController("discarded_duplicate");
|
|
13103
13159
|
}
|
|
13104
13160
|
throw error;
|
|
13105
13161
|
case 10:
|
|
@@ -13173,6 +13229,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13173
13229
|
tagAllowsAudio: count("tag_allows_audio"),
|
|
13174
13230
|
missingImpression: count("vast_missing_impression"),
|
|
13175
13231
|
discardedBudget: count("discarded_budget"),
|
|
13232
|
+
discardedDuplicate: count("discarded_duplicate"),
|
|
13176
13233
|
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
13177
13234
|
mediaRejected: count("media_candidate:rejected"),
|
|
13178
13235
|
mediaFallbacks: count("media_fallback"),
|
|
@@ -13248,6 +13305,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13248
13305
|
this.breakSource = void 0;
|
|
13249
13306
|
this.followUpBaseVastUrl = void 0;
|
|
13250
13307
|
this.unusableResponsesInBreak = 0;
|
|
13308
|
+
this.playedAdIdsInBreak.clear();
|
|
13251
13309
|
this.resetEdgeStateForBreak();
|
|
13252
13310
|
adPlayer.stop().catch(function() {});
|
|
13253
13311
|
if (!alreadyEnded) this.logBreakFunnel(reason);
|
|
@@ -13348,9 +13406,18 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13348
13406
|
var maxMonitorMs = 45e3;
|
|
13349
13407
|
var startTime = Date.now();
|
|
13350
13408
|
var baseline = resumeBaseline;
|
|
13409
|
+
var lastSeenTime = resumeBaseline;
|
|
13351
13410
|
var recoveries = 0;
|
|
13352
13411
|
var lastRecoveryAt = 0;
|
|
13353
13412
|
var video = this.host.video;
|
|
13413
|
+
var onDecodeError = function onDecodeError() {
|
|
13414
|
+
var _video_error;
|
|
13415
|
+
if (needsReset || ((_video_error = video.error) === null || _video_error === void 0 ? void 0 : _video_error.code) !== 3) return;
|
|
13416
|
+
if (markSingleDecoderLearned() && _this.debug) {
|
|
13417
|
+
console.warn("[StormcloudVideoPlayer] Decoder error while resuming after ads \u2014 using single-decoder mode on this device from the next break");
|
|
13418
|
+
}
|
|
13419
|
+
};
|
|
13420
|
+
video.addEventListener("error", onDecodeError);
|
|
13354
13421
|
var listenersAttached = false;
|
|
13355
13422
|
var onMediaEvent;
|
|
13356
13423
|
var diagEvents = [
|
|
@@ -13400,6 +13467,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13400
13467
|
console.log("[ResumeDiag] +0.0s monitor start — ".concat(this.describeVideoState()));
|
|
13401
13468
|
}
|
|
13402
13469
|
var cleanup = function cleanup() {
|
|
13470
|
+
video.removeEventListener("error", onDecodeError);
|
|
13403
13471
|
if (listenersAttached && onMediaEvent) {
|
|
13404
13472
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
13405
13473
|
try {
|
|
@@ -13430,6 +13498,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13430
13498
|
return;
|
|
13431
13499
|
}
|
|
13432
13500
|
var currentTime = video.currentTime;
|
|
13501
|
+
if (currentTime + 1 < lastSeenTime) {
|
|
13502
|
+
baseline = currentTime;
|
|
13503
|
+
}
|
|
13504
|
+
lastSeenTime = currentTime;
|
|
13433
13505
|
var advanced = currentTime > baseline + 0.5;
|
|
13434
13506
|
var playing = !video.paused && video.readyState >= 3;
|
|
13435
13507
|
if (advanced && playing) {
|