stormcloud-video-player 0.7.11 → 0.7.12
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 +321 -773
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -31
- package/lib/index.d.ts +1 -31
- package/lib/index.js +322 -774
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +200 -739
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +2 -26
- package/lib/players/HlsPlayer.cjs +200 -739
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +200 -739
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/adstormPlayer.cjs +9 -1
- package/lib/sdk/adstormPlayer.cjs.map +1 -1
- package/lib/sdk/adstormPlayer.d.cts +1 -1
- package/lib/{types-jU4lq0ST.d.cts → types-DrBGHN4q.d.cts} +1 -7
- package/lib/ui/StormcloudVideoPlayer.cjs +321 -773
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/package.json +1 -1
|
@@ -1429,7 +1429,6 @@ function createAdStormPlayer(contentVideo, options) {
|
|
|
1429
1429
|
contentVideo.muted = originalMutedState;
|
|
1430
1430
|
contentVideo.volume = originalVolume;
|
|
1431
1431
|
currentAd = void 0;
|
|
1432
|
-
tornDown = false;
|
|
1433
1432
|
return [
|
|
1434
1433
|
2,
|
|
1435
1434
|
Promise.resolve()
|
|
@@ -1544,6 +1543,15 @@ function createAdStormPlayer(contentVideo, options) {
|
|
|
1544
1543
|
if (!token) return [
|
|
1545
1544
|
2
|
|
1546
1545
|
];
|
|
1546
|
+
if (currentAd) {
|
|
1547
|
+
preloadSlots.set(token, {
|
|
1548
|
+
ad: currentAd
|
|
1549
|
+
});
|
|
1550
|
+
currentAd = void 0;
|
|
1551
|
+
return [
|
|
1552
|
+
2
|
|
1553
|
+
];
|
|
1554
|
+
}
|
|
1547
1555
|
requestContext = typeof arg1 === "string" ? arg2 : arg1;
|
|
1548
1556
|
return [
|
|
1549
1557
|
4,
|
|
@@ -2037,56 +2045,6 @@ function sendInitialTracking(licenseKey) {
|
|
|
2037
2045
|
});
|
|
2038
2046
|
})();
|
|
2039
2047
|
}
|
|
2040
|
-
function sendAdDetectTracking(licenseKey, adDetectInfo) {
|
|
2041
|
-
return _async_to_generator(function() {
|
|
2042
|
-
var clientInfo, browserId, trackingData, error;
|
|
2043
|
-
return _ts_generator(this, function(_state) {
|
|
2044
|
-
switch(_state.label){
|
|
2045
|
-
case 0:
|
|
2046
|
-
_state.trys.push([
|
|
2047
|
-
0,
|
|
2048
|
-
3,
|
|
2049
|
-
,
|
|
2050
|
-
4
|
|
2051
|
-
]);
|
|
2052
|
-
clientInfo = getClientInfo();
|
|
2053
|
-
return [
|
|
2054
|
-
4,
|
|
2055
|
-
getBrowserID(clientInfo)
|
|
2056
|
-
];
|
|
2057
|
-
case 1:
|
|
2058
|
-
browserId = _state.sent();
|
|
2059
|
-
trackingData = _object_spread({
|
|
2060
|
-
browserId: browserId
|
|
2061
|
-
}, clientInfo);
|
|
2062
|
-
return [
|
|
2063
|
-
4,
|
|
2064
|
-
sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
|
|
2065
|
-
licenseKey: licenseKey,
|
|
2066
|
-
adDetectInfo: adDetectInfo
|
|
2067
|
-
}))
|
|
2068
|
-
];
|
|
2069
|
-
case 2:
|
|
2070
|
-
_state.sent();
|
|
2071
|
-
return [
|
|
2072
|
-
3,
|
|
2073
|
-
4
|
|
2074
|
-
];
|
|
2075
|
-
case 3:
|
|
2076
|
-
error = _state.sent();
|
|
2077
|
-
console.error("[StormcloudVideoPlayer] Error sending ad detect tracking:", error);
|
|
2078
|
-
return [
|
|
2079
|
-
3,
|
|
2080
|
-
4
|
|
2081
|
-
];
|
|
2082
|
-
case 4:
|
|
2083
|
-
return [
|
|
2084
|
-
2
|
|
2085
|
-
];
|
|
2086
|
-
}
|
|
2087
|
-
});
|
|
2088
|
-
})();
|
|
2089
|
-
}
|
|
2090
2048
|
function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
|
|
2091
2049
|
return _async_to_generator(function() {
|
|
2092
2050
|
var clientInfo, browserId, trackingData, error;
|
|
@@ -2771,7 +2729,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2771
2729
|
this.continuousFetchLoopPromise = null;
|
|
2772
2730
|
this.attached = false;
|
|
2773
2731
|
this.inAdBreak = false;
|
|
2774
|
-
this.ptsDriftEmaMs = 0;
|
|
2775
2732
|
this.adPodQueue = [];
|
|
2776
2733
|
this.lastHeartbeatTime = 0;
|
|
2777
2734
|
this.currentAdIndex = 0;
|
|
@@ -2795,7 +2752,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2795
2752
|
this.totalAdRequestsInBreak = 0;
|
|
2796
2753
|
this.maxTotalAdRequestsPerBreak = 20;
|
|
2797
2754
|
this.pendingAdBreak = null;
|
|
2798
|
-
this.
|
|
2755
|
+
this.savedMutedStateBeforeAd = null;
|
|
2799
2756
|
this.consecutiveFailures = 0;
|
|
2800
2757
|
this.maxConsecutiveFailures = 5;
|
|
2801
2758
|
this.lastAdRequestTime = 0;
|
|
@@ -2808,7 +2765,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2808
2765
|
this.adRequestRetryBackoffMs = 1500;
|
|
2809
2766
|
this.preloadedTokens = [];
|
|
2810
2767
|
this.debugLogEntries = [];
|
|
2811
|
-
this.scteMarkerHistory = [];
|
|
2812
2768
|
this.adInsertionDebugHistory = [];
|
|
2813
2769
|
initializePolyfills();
|
|
2814
2770
|
var browserOverrides = getBrowserConfigOverrides();
|
|
@@ -3097,18 +3053,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3097
3053
|
_this.pushAdInsertionDebug("ad_triggered", segmentName, {
|
|
3098
3054
|
detail: "ad break started (60s)"
|
|
3099
3055
|
});
|
|
3100
|
-
|
|
3101
|
-
type: "start",
|
|
3102
|
-
durationSeconds: 60,
|
|
3103
|
-
raw: {
|
|
3104
|
-
apiInsertionPoint: _this.lastAdInsertionPoint
|
|
3105
|
-
}
|
|
3106
|
-
};
|
|
3107
|
-
_this.onScte35Marker(marker);
|
|
3056
|
+
void _this.handleAdStart(60);
|
|
3108
3057
|
}, offsetMs);
|
|
3109
3058
|
}
|
|
3110
3059
|
}
|
|
3111
3060
|
});
|
|
3061
|
+
this.hls.on(import_hls.default.Events.FRAG_PARSING_USERDATA, function(_evt, data) {
|
|
3062
|
+
var _ref;
|
|
3063
|
+
var samples = (_ref = data === null || data === void 0 ? void 0 : data.samples) !== null && _ref !== void 0 ? _ref : [];
|
|
3064
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3065
|
+
try {
|
|
3066
|
+
for(var _iterator = samples[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3067
|
+
var sample = _step.value;
|
|
3068
|
+
var _ref1, _ref2;
|
|
3069
|
+
var _data_frag, _data_frag1;
|
|
3070
|
+
var bytes = sample === null || sample === void 0 ? void 0 : sample.data;
|
|
3071
|
+
if (!bytes || bytes.length < 5) continue;
|
|
3072
|
+
var isSCTE35 = bytes[0] === 252;
|
|
3073
|
+
if (!isSCTE35) continue;
|
|
3074
|
+
var segName = (_ref1 = (_ref2 = data === null || data === void 0 ? void 0 : (_data_frag = data.frag) === null || _data_frag === void 0 ? void 0 : _data_frag.relurl) !== null && _ref2 !== void 0 ? _ref2 : data === null || data === void 0 ? void 0 : (_data_frag1 = data.frag) === null || _data_frag1 === void 0 ? void 0 : _data_frag1.url) !== null && _ref1 !== void 0 ? _ref1 : "";
|
|
3075
|
+
_this.pushAdInsertionDebug("scte35_inserted", segName, {
|
|
3076
|
+
detail: "len=".concat(bytes.length, "B")
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
} catch (err) {
|
|
3080
|
+
_didIteratorError = true;
|
|
3081
|
+
_iteratorError = err;
|
|
3082
|
+
} finally{
|
|
3083
|
+
try {
|
|
3084
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3085
|
+
_iterator.return();
|
|
3086
|
+
}
|
|
3087
|
+
} finally{
|
|
3088
|
+
if (_didIteratorError) {
|
|
3089
|
+
throw _iteratorError;
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
});
|
|
3112
3094
|
this.hls.on(import_hls.default.Events.ERROR, function(_evt, data) {
|
|
3113
3095
|
if (data === null || data === void 0 ? void 0 : data.fatal) {
|
|
3114
3096
|
switch(data.type){
|
|
@@ -3183,8 +3165,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3183
3165
|
_this.activeAdRequestToken = null;
|
|
3184
3166
|
_this.showAds = true;
|
|
3185
3167
|
if (_this.config.disableFiller) {
|
|
3186
|
-
if (_this.
|
|
3187
|
-
_this.
|
|
3168
|
+
if (_this.savedMutedStateBeforeAd == null) {
|
|
3169
|
+
_this.savedMutedStateBeforeAd = {
|
|
3188
3170
|
muted: _this.video.muted,
|
|
3189
3171
|
volume: _this.video.volume
|
|
3190
3172
|
};
|
|
@@ -3212,10 +3194,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3212
3194
|
});
|
|
3213
3195
|
this.adLayer.on("content_resume", function() {
|
|
3214
3196
|
var _ref, _ref1;
|
|
3215
|
-
var
|
|
3197
|
+
var _this_savedMutedStateBeforeAd, _this_savedMutedStateBeforeAd1;
|
|
3216
3198
|
var remaining = _this.getRemainingAdMs();
|
|
3217
|
-
var breakMuted = (_ref = (
|
|
3218
|
-
var breakVolume = (_ref1 = (
|
|
3199
|
+
var breakMuted = (_ref = (_this_savedMutedStateBeforeAd = _this.savedMutedStateBeforeAd) === null || _this_savedMutedStateBeforeAd === void 0 ? void 0 : _this_savedMutedStateBeforeAd.muted) !== null && _ref !== void 0 ? _ref : _this.adLayer.getOriginalMutedState();
|
|
3200
|
+
var breakVolume = (_ref1 = (_this_savedMutedStateBeforeAd1 = _this.savedMutedStateBeforeAd) === null || _this_savedMutedStateBeforeAd1 === void 0 ? void 0 : _this_savedMutedStateBeforeAd1.volume) !== null && _ref1 !== void 0 ? _ref1 : _this.adLayer.getOriginalVolume();
|
|
3219
3201
|
if (_this.config.debugAdTiming) {
|
|
3220
3202
|
console.log("[StormcloudVideoPlayer] content_resume received, inAdBreak=%s, remaining=%s, preloadedTokens=%d, pendingNext=%s", _this.inAdBreak, remaining, _this.preloadedTokens.length, !!_this.pendingNextAdBids);
|
|
3221
3203
|
}
|
|
@@ -3292,7 +3274,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3292
3274
|
var remainingFinal = _this.getRemainingAdMs();
|
|
3293
3275
|
if (_this.inAdBreak && remainingFinal > _this.MIN_AD_REMAINING_MS) {
|
|
3294
3276
|
if (_this.config.debugAdTiming) {
|
|
3295
|
-
console.log("[StormcloudVideoPlayer] content_resume:
|
|
3277
|
+
console.log("[StormcloudVideoPlayer] content_resume: ad ended/failed with time remaining, showing filler and continuing fetch for", remainingFinal, "ms");
|
|
3296
3278
|
}
|
|
3297
3279
|
if (!_this.config.disableFiller) {
|
|
3298
3280
|
_this.showPlaceholderLayer();
|
|
@@ -3310,7 +3292,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3310
3292
|
(_this_video_play = _this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
|
|
3311
3293
|
}
|
|
3312
3294
|
}
|
|
3313
|
-
_this.
|
|
3295
|
+
_this.continuousFetchingActive = true;
|
|
3296
|
+
_this.startContinuousFetchLoop();
|
|
3314
3297
|
return;
|
|
3315
3298
|
}
|
|
3316
3299
|
if (_this.config.debugAdTiming) {
|
|
@@ -3457,547 +3440,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3457
3440
|
return !!(this.config.allowNativeHls && canNative);
|
|
3458
3441
|
}
|
|
3459
3442
|
},
|
|
3460
|
-
{
|
|
3461
|
-
key: "onId3Tag",
|
|
3462
|
-
value: function onId3Tag(tag) {
|
|
3463
|
-
if (typeof tag.ptsSeconds === "number") {
|
|
3464
|
-
this.updatePtsDrift(tag.ptsSeconds);
|
|
3465
|
-
}
|
|
3466
|
-
var marker = this.parseScte35FromId3(tag);
|
|
3467
|
-
if (marker) {
|
|
3468
|
-
this.onScte35Marker(marker);
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
},
|
|
3472
|
-
{
|
|
3473
|
-
key: "parseScte35FromId3",
|
|
3474
|
-
value: function parseScte35FromId3(tag) {
|
|
3475
|
-
var text = this.decodeId3ValueToText(tag.value);
|
|
3476
|
-
if (!text) return void 0;
|
|
3477
|
-
var cueOutMatch = text.match(/EXT-X-CUE-OUT(?::([^\r\n]*))?/i) || text.match(/CUE-OUT(?::([^\r\n]*))?/i);
|
|
3478
|
-
if (cueOutMatch) {
|
|
3479
|
-
var _cueOutMatch_;
|
|
3480
|
-
var arg = ((_cueOutMatch_ = cueOutMatch[1]) !== null && _cueOutMatch_ !== void 0 ? _cueOutMatch_ : "").trim();
|
|
3481
|
-
var dur = this.parseCueOutDuration(arg);
|
|
3482
|
-
var marker = _object_spread_props(_object_spread({
|
|
3483
|
-
type: "start"
|
|
3484
|
-
}, tag.ptsSeconds !== void 0 ? {
|
|
3485
|
-
ptsSeconds: tag.ptsSeconds
|
|
3486
|
-
} : {}, dur !== void 0 ? {
|
|
3487
|
-
durationSeconds: dur
|
|
3488
|
-
} : {}), {
|
|
3489
|
-
raw: {
|
|
3490
|
-
id3: text
|
|
3491
|
-
}
|
|
3492
|
-
});
|
|
3493
|
-
return marker;
|
|
3494
|
-
}
|
|
3495
|
-
var cueOutContMatch = text.match(/EXT-X-CUE-OUT-CONT:([^\r\n]*)/i);
|
|
3496
|
-
if (cueOutContMatch) {
|
|
3497
|
-
var _cueOutContMatch_;
|
|
3498
|
-
var arg1 = ((_cueOutContMatch_ = cueOutContMatch[1]) !== null && _cueOutContMatch_ !== void 0 ? _cueOutContMatch_ : "").trim();
|
|
3499
|
-
var cont = this.parseCueOutCont(arg1);
|
|
3500
|
-
var marker1 = _object_spread_props(_object_spread({
|
|
3501
|
-
type: "progress"
|
|
3502
|
-
}, tag.ptsSeconds !== void 0 ? {
|
|
3503
|
-
ptsSeconds: tag.ptsSeconds
|
|
3504
|
-
} : {}, (cont === null || cont === void 0 ? void 0 : cont.duration) !== void 0 ? {
|
|
3505
|
-
durationSeconds: cont.duration
|
|
3506
|
-
} : {}), {
|
|
3507
|
-
raw: {
|
|
3508
|
-
id3: text
|
|
3509
|
-
}
|
|
3510
|
-
});
|
|
3511
|
-
return marker1;
|
|
3512
|
-
}
|
|
3513
|
-
var cueInMatch = text.match(/EXT-X-CUE-IN\b/i) || text.match(/CUE-IN\b/i);
|
|
3514
|
-
if (cueInMatch) {
|
|
3515
|
-
var marker2 = _object_spread_props(_object_spread({
|
|
3516
|
-
type: "end"
|
|
3517
|
-
}, tag.ptsSeconds !== void 0 ? {
|
|
3518
|
-
ptsSeconds: tag.ptsSeconds
|
|
3519
|
-
} : {}), {
|
|
3520
|
-
raw: {
|
|
3521
|
-
id3: text
|
|
3522
|
-
}
|
|
3523
|
-
});
|
|
3524
|
-
return marker2;
|
|
3525
|
-
}
|
|
3526
|
-
var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
|
|
3527
|
-
if (daterangeMatch) {
|
|
3528
|
-
var _daterangeMatch_, _attrs_CLASS;
|
|
3529
|
-
var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
|
|
3530
|
-
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
3531
|
-
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
3532
|
-
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
3533
|
-
var duration = this.toNumber(attrs["DURATION"]);
|
|
3534
|
-
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
3535
|
-
var marker3 = _object_spread_props(_object_spread({
|
|
3536
|
-
type: "start"
|
|
3537
|
-
}, tag.ptsSeconds !== void 0 ? {
|
|
3538
|
-
ptsSeconds: tag.ptsSeconds
|
|
3539
|
-
} : {}, duration !== void 0 ? {
|
|
3540
|
-
durationSeconds: duration
|
|
3541
|
-
} : {}), {
|
|
3542
|
-
raw: {
|
|
3543
|
-
id3: text,
|
|
3544
|
-
attrs: attrs
|
|
3545
|
-
}
|
|
3546
|
-
});
|
|
3547
|
-
return marker3;
|
|
3548
|
-
}
|
|
3549
|
-
if (hasScteIn) {
|
|
3550
|
-
var marker4 = _object_spread_props(_object_spread({
|
|
3551
|
-
type: "end"
|
|
3552
|
-
}, tag.ptsSeconds !== void 0 ? {
|
|
3553
|
-
ptsSeconds: tag.ptsSeconds
|
|
3554
|
-
} : {}), {
|
|
3555
|
-
raw: {
|
|
3556
|
-
id3: text,
|
|
3557
|
-
attrs: attrs
|
|
3558
|
-
}
|
|
3559
|
-
});
|
|
3560
|
-
return marker4;
|
|
3561
|
-
}
|
|
3562
|
-
}
|
|
3563
|
-
if (/SCTE35-OUT/i.test(text)) {
|
|
3564
|
-
var marker5 = _object_spread_props(_object_spread({
|
|
3565
|
-
type: "start"
|
|
3566
|
-
}, tag.ptsSeconds !== void 0 ? {
|
|
3567
|
-
ptsSeconds: tag.ptsSeconds
|
|
3568
|
-
} : {}), {
|
|
3569
|
-
raw: {
|
|
3570
|
-
id3: text
|
|
3571
|
-
}
|
|
3572
|
-
});
|
|
3573
|
-
return marker5;
|
|
3574
|
-
}
|
|
3575
|
-
if (/SCTE35-IN/i.test(text)) {
|
|
3576
|
-
var marker6 = _object_spread_props(_object_spread({
|
|
3577
|
-
type: "end"
|
|
3578
|
-
}, tag.ptsSeconds !== void 0 ? {
|
|
3579
|
-
ptsSeconds: tag.ptsSeconds
|
|
3580
|
-
} : {}), {
|
|
3581
|
-
raw: {
|
|
3582
|
-
id3: text
|
|
3583
|
-
}
|
|
3584
|
-
});
|
|
3585
|
-
return marker6;
|
|
3586
|
-
}
|
|
3587
|
-
if (_instanceof(tag.value, Uint8Array)) {
|
|
3588
|
-
var bin = this.parseScte35Binary(tag.value);
|
|
3589
|
-
if (bin) return bin;
|
|
3590
|
-
}
|
|
3591
|
-
return void 0;
|
|
3592
|
-
}
|
|
3593
|
-
},
|
|
3594
|
-
{
|
|
3595
|
-
key: "decodeId3ValueToText",
|
|
3596
|
-
value: function decodeId3ValueToText(value) {
|
|
3597
|
-
try {
|
|
3598
|
-
if (typeof value === "string") return value;
|
|
3599
|
-
var decoder = new TextDecoder("utf-8", {
|
|
3600
|
-
fatal: false
|
|
3601
|
-
});
|
|
3602
|
-
var text = decoder.decode(value);
|
|
3603
|
-
if (text && /[\x20-\x7E]/.test(text)) return text;
|
|
3604
|
-
var out = "";
|
|
3605
|
-
for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
|
|
3606
|
-
return out;
|
|
3607
|
-
} catch (unused) {
|
|
3608
|
-
return void 0;
|
|
3609
|
-
}
|
|
3610
|
-
}
|
|
3611
|
-
},
|
|
3612
|
-
{
|
|
3613
|
-
key: "onScte35Marker",
|
|
3614
|
-
value: function onScte35Marker(marker) {
|
|
3615
|
-
var _this = this;
|
|
3616
|
-
if (this.config.disableAds) return;
|
|
3617
|
-
this.pushScteMarker(marker);
|
|
3618
|
-
this.pushDebugLog("info", "scte35", "SCTE-35 marker detected", {
|
|
3619
|
-
type: marker.type,
|
|
3620
|
-
ptsSeconds: marker.ptsSeconds,
|
|
3621
|
-
durationSeconds: marker.durationSeconds,
|
|
3622
|
-
currentTime: this.video.currentTime
|
|
3623
|
-
});
|
|
3624
|
-
if (this.config.debugAdTiming) {
|
|
3625
|
-
console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
|
|
3626
|
-
type: marker.type,
|
|
3627
|
-
ptsSeconds: marker.ptsSeconds,
|
|
3628
|
-
durationSeconds: marker.durationSeconds,
|
|
3629
|
-
currentTime: this.video.currentTime,
|
|
3630
|
-
raw: marker.raw,
|
|
3631
|
-
hasPendingAdBreak: !!this.pendingAdBreak
|
|
3632
|
-
});
|
|
3633
|
-
}
|
|
3634
|
-
if (marker.type === "start") {
|
|
3635
|
-
var _this_config_immediateManifestAds;
|
|
3636
|
-
var _this_pendingAdBreak;
|
|
3637
|
-
if (this.savedMutedStateBeforeScte == null) {
|
|
3638
|
-
this.savedMutedStateBeforeScte = {
|
|
3639
|
-
muted: this.video.muted,
|
|
3640
|
-
volume: this.video.volume
|
|
3641
|
-
};
|
|
3642
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
3643
|
-
}
|
|
3644
|
-
if (!this.config.disableFiller && !this.video.muted && !this.adLayer.isAdPlaying()) {
|
|
3645
|
-
this.video.muted = true;
|
|
3646
|
-
this.video.volume = 0;
|
|
3647
|
-
if (this.config.debugAdTiming) {
|
|
3648
|
-
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
3649
|
-
}
|
|
3650
|
-
}
|
|
3651
|
-
if (this.inAdBreak) {
|
|
3652
|
-
if (marker.durationSeconds != null) {
|
|
3653
|
-
var newDurationMs = marker.durationSeconds * 1e3;
|
|
3654
|
-
if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
|
|
3655
|
-
this.expectedAdBreakDurationMs = newDurationMs;
|
|
3656
|
-
var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
|
|
3657
|
-
var remainingMs = Math.max(0, newDurationMs - elapsedMs);
|
|
3658
|
-
this.scheduleAdStopCountdown(remainingMs);
|
|
3659
|
-
if (this.config.debugAdTiming) {
|
|
3660
|
-
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
|
|
3661
|
-
}
|
|
3662
|
-
}
|
|
3663
|
-
}
|
|
3664
|
-
return;
|
|
3665
|
-
}
|
|
3666
|
-
this.inAdBreak = true;
|
|
3667
|
-
var durationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : ((_this_pendingAdBreak = this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.marker.durationSeconds) != null ? this.pendingAdBreak.marker.durationSeconds * 1e3 : void 0;
|
|
3668
|
-
this.expectedAdBreakDurationMs = durationMs;
|
|
3669
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
3670
|
-
if (this.config.licenseKey) {
|
|
3671
|
-
var _this_pendingAdBreak1;
|
|
3672
|
-
var adDetectInfo = _object_spread({
|
|
3673
|
-
source: "scte35",
|
|
3674
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
3675
|
-
}, marker.durationSeconds != null && {
|
|
3676
|
-
durationSeconds: marker.durationSeconds
|
|
3677
|
-
}, marker.ptsSeconds != null && {
|
|
3678
|
-
ptsSeconds: marker.ptsSeconds
|
|
3679
|
-
}, ((_this_pendingAdBreak1 = this.pendingAdBreak) === null || _this_pendingAdBreak1 === void 0 ? void 0 : _this_pendingAdBreak1.detectedAtFragmentSn) != null && {
|
|
3680
|
-
detectedAtFragmentSn: this.pendingAdBreak.detectedAtFragmentSn
|
|
3681
|
-
});
|
|
3682
|
-
sendAdDetectTracking(this.config.licenseKey, adDetectInfo);
|
|
3683
|
-
}
|
|
3684
|
-
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
3685
|
-
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
3686
|
-
if (this.config.debugAdTiming) {
|
|
3687
|
-
console.log("[StormcloudVideoPlayer] Ad start decision:", {
|
|
3688
|
-
isManifestMarker: isManifestMarker,
|
|
3689
|
-
forceImmediate: forceImmediate,
|
|
3690
|
-
hasPts: typeof marker.ptsSeconds === "number"
|
|
3691
|
-
});
|
|
3692
|
-
}
|
|
3693
|
-
if (isManifestMarker && forceImmediate) {
|
|
3694
|
-
if (this.config.debugAdTiming) {
|
|
3695
|
-
console.log("[StormcloudVideoPlayer] Starting ad immediately (manifest-based)");
|
|
3696
|
-
}
|
|
3697
|
-
this.clearAdStartTimer();
|
|
3698
|
-
this.handleAdStart(marker);
|
|
3699
|
-
} else if (typeof marker.ptsSeconds === "number") {
|
|
3700
|
-
var _this_config_driftToleranceMs;
|
|
3701
|
-
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
3702
|
-
var nowMs = this.video.currentTime * 1e3;
|
|
3703
|
-
var estCurrentPtsMs = nowMs - this.ptsDriftEmaMs;
|
|
3704
|
-
var deltaMs = Math.floor(marker.ptsSeconds * 1e3 - estCurrentPtsMs);
|
|
3705
|
-
if (this.config.debugAdTiming) {
|
|
3706
|
-
console.log("[StormcloudVideoPlayer] PTS-based timing calculation:", {
|
|
3707
|
-
nowMs: nowMs,
|
|
3708
|
-
estCurrentPtsMs: estCurrentPtsMs,
|
|
3709
|
-
markerPtsMs: marker.ptsSeconds * 1e3,
|
|
3710
|
-
deltaMs: deltaMs,
|
|
3711
|
-
tolerance: tol
|
|
3712
|
-
});
|
|
3713
|
-
}
|
|
3714
|
-
if (deltaMs > tol) {
|
|
3715
|
-
if (this.config.debugAdTiming) {
|
|
3716
|
-
console.log("[StormcloudVideoPlayer] Scheduling ad start in ".concat(deltaMs, "ms"));
|
|
3717
|
-
}
|
|
3718
|
-
this.scheduleAdStartIn(deltaMs);
|
|
3719
|
-
} else {
|
|
3720
|
-
if (this.config.debugAdTiming) {
|
|
3721
|
-
console.log("[StormcloudVideoPlayer] Starting ad immediately (within tolerance)");
|
|
3722
|
-
}
|
|
3723
|
-
this.clearAdStartTimer();
|
|
3724
|
-
this.handleAdStart(marker);
|
|
3725
|
-
}
|
|
3726
|
-
} else {
|
|
3727
|
-
if (this.config.debugAdTiming) {
|
|
3728
|
-
console.log("[StormcloudVideoPlayer] Starting ad immediately (fallback)");
|
|
3729
|
-
}
|
|
3730
|
-
this.clearAdStartTimer();
|
|
3731
|
-
this.handleAdStart(marker);
|
|
3732
|
-
}
|
|
3733
|
-
if (this.expectedAdBreakDurationMs != null) {
|
|
3734
|
-
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
3735
|
-
}
|
|
3736
|
-
return;
|
|
3737
|
-
}
|
|
3738
|
-
if (marker.type === "progress" && this.inAdBreak) {
|
|
3739
|
-
if (marker.durationSeconds != null) {
|
|
3740
|
-
this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
|
|
3741
|
-
}
|
|
3742
|
-
if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
3743
|
-
var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
3744
|
-
var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
|
|
3745
|
-
this.scheduleAdStopCountdown(remainingMs1);
|
|
3746
|
-
}
|
|
3747
|
-
if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
|
|
3748
|
-
var bids = this.pendingNextAdBids;
|
|
3749
|
-
this.pendingNextAdBids = null;
|
|
3750
|
-
this.currentAdIndex++;
|
|
3751
|
-
this.adLayer.playAd(bids).catch(function() {
|
|
3752
|
-
return _this.handleAdFailure();
|
|
3753
|
-
});
|
|
3754
|
-
}
|
|
3755
|
-
return;
|
|
3756
|
-
}
|
|
3757
|
-
if (marker.type === "end") {
|
|
3758
|
-
var remaining = this.getRemainingAdMs();
|
|
3759
|
-
var adPlaying = this.adLayer.isAdPlaying();
|
|
3760
|
-
var hasQueuedAds = this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0;
|
|
3761
|
-
if (this.config.debugAdTiming) {
|
|
3762
|
-
console.log("[StormcloudVideoPlayer] SCTE-35 end marker received:", {
|
|
3763
|
-
inAdBreak: this.inAdBreak,
|
|
3764
|
-
remaining: remaining,
|
|
3765
|
-
adPlaying: adPlaying,
|
|
3766
|
-
hasQueuedAds: hasQueuedAds,
|
|
3767
|
-
activeAdRequest: this.activeAdRequestToken !== null
|
|
3768
|
-
});
|
|
3769
|
-
}
|
|
3770
|
-
if (!this.inAdBreak) {
|
|
3771
|
-
if (this.config.debugAdTiming) {
|
|
3772
|
-
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end marker - not in ad break");
|
|
3773
|
-
}
|
|
3774
|
-
return;
|
|
3775
|
-
}
|
|
3776
|
-
if (adPlaying || remaining > 500) {
|
|
3777
|
-
if (this.config.debugAdTiming) {
|
|
3778
|
-
console.log("[StormcloudVideoPlayer] Ignoring premature SCTE-35 end marker - ads still active or time remaining");
|
|
3779
|
-
}
|
|
3780
|
-
return;
|
|
3781
|
-
}
|
|
3782
|
-
this.inAdBreak = false;
|
|
3783
|
-
this.expectedAdBreakDurationMs = void 0;
|
|
3784
|
-
this.currentAdBreakStartWallClockMs = void 0;
|
|
3785
|
-
this.clearAdStartTimer();
|
|
3786
|
-
this.clearAdStopTimer();
|
|
3787
|
-
if (adPlaying) {
|
|
3788
|
-
this.adLayer.stop().catch(function() {});
|
|
3789
|
-
}
|
|
3790
|
-
this.handleAdPodComplete();
|
|
3791
|
-
return;
|
|
3792
|
-
}
|
|
3793
|
-
}
|
|
3794
|
-
},
|
|
3795
|
-
{
|
|
3796
|
-
key: "parseCueOutDuration",
|
|
3797
|
-
value: function parseCueOutDuration(value) {
|
|
3798
|
-
var num = parseFloat(value.trim());
|
|
3799
|
-
if (!Number.isNaN(num)) return num;
|
|
3800
|
-
var match = value.match(/(?:^|[,\s])DURATION\s*=\s*([0-9.]+)/i) || value.match(/Duration\s*=\s*([0-9.]+)/i);
|
|
3801
|
-
if (match && match[1] != null) {
|
|
3802
|
-
var dStr = match[1];
|
|
3803
|
-
var d = parseFloat(dStr);
|
|
3804
|
-
return Number.isNaN(d) ? void 0 : d;
|
|
3805
|
-
}
|
|
3806
|
-
return void 0;
|
|
3807
|
-
}
|
|
3808
|
-
},
|
|
3809
|
-
{
|
|
3810
|
-
key: "parseCueOutCont",
|
|
3811
|
-
value: function parseCueOutCont(value) {
|
|
3812
|
-
var res = {};
|
|
3813
|
-
var elapsedMatch = value.match(/Elapsed\s*=\s*([0-9.]+)/i);
|
|
3814
|
-
var durationMatch = value.match(/Duration\s*=\s*([0-9.]+)/i);
|
|
3815
|
-
if (elapsedMatch && elapsedMatch[1] != null) {
|
|
3816
|
-
var e = parseFloat(elapsedMatch[1]);
|
|
3817
|
-
if (!Number.isNaN(e)) res.elapsed = e;
|
|
3818
|
-
}
|
|
3819
|
-
if (durationMatch && durationMatch[1] != null) {
|
|
3820
|
-
var d = parseFloat(durationMatch[1]);
|
|
3821
|
-
if (!Number.isNaN(d)) res.duration = d;
|
|
3822
|
-
}
|
|
3823
|
-
if (!("elapsed" in res) || !("duration" in res)) {
|
|
3824
|
-
var slashMatch = value.match(/([0-9.]+)\s*\/\s*([0-9.]+)/);
|
|
3825
|
-
if (slashMatch && slashMatch[1] && slashMatch[2]) {
|
|
3826
|
-
var elapsed = parseFloat(slashMatch[1]);
|
|
3827
|
-
var duration = parseFloat(slashMatch[2]);
|
|
3828
|
-
if (!Number.isNaN(elapsed) && !("elapsed" in res)) res.elapsed = elapsed;
|
|
3829
|
-
if (!Number.isNaN(duration) && !("duration" in res)) res.duration = duration;
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
|
-
if ("elapsed" in res || "duration" in res) return res;
|
|
3833
|
-
return void 0;
|
|
3834
|
-
}
|
|
3835
|
-
},
|
|
3836
|
-
{
|
|
3837
|
-
key: "parseAttributeList",
|
|
3838
|
-
value: function parseAttributeList(value) {
|
|
3839
|
-
var attrs = {};
|
|
3840
|
-
var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
|
|
3841
|
-
var match;
|
|
3842
|
-
while((match = regex.exec(value)) !== null){
|
|
3843
|
-
var _match_, _ref, _match_1;
|
|
3844
|
-
var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
|
|
3845
|
-
var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
|
|
3846
|
-
if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
|
|
3847
|
-
rawVal = rawVal.slice(1, -1);
|
|
3848
|
-
}
|
|
3849
|
-
if (key) {
|
|
3850
|
-
attrs[key] = rawVal;
|
|
3851
|
-
}
|
|
3852
|
-
}
|
|
3853
|
-
return attrs;
|
|
3854
|
-
}
|
|
3855
|
-
},
|
|
3856
|
-
{
|
|
3857
|
-
key: "toNumber",
|
|
3858
|
-
value: function toNumber(val) {
|
|
3859
|
-
if (val == null) return void 0;
|
|
3860
|
-
var n = typeof val === "string" ? parseFloat(val) : Number(val);
|
|
3861
|
-
return Number.isNaN(n) ? void 0 : n;
|
|
3862
|
-
}
|
|
3863
|
-
},
|
|
3864
|
-
{
|
|
3865
|
-
key: "isManifestBasedMarker",
|
|
3866
|
-
value: function isManifestBasedMarker(marker) {
|
|
3867
|
-
var raw = marker.raw;
|
|
3868
|
-
if (!raw) return false;
|
|
3869
|
-
if (raw.tag) {
|
|
3870
|
-
var tag = String(raw.tag);
|
|
3871
|
-
return tag.includes("EXT-X-CUE-OUT") || tag.includes("EXT-X-CUE-IN") || tag.includes("EXT-X-DATERANGE");
|
|
3872
|
-
}
|
|
3873
|
-
if (raw.id3) return false;
|
|
3874
|
-
if (raw.splice_command_type) return false;
|
|
3875
|
-
return false;
|
|
3876
|
-
}
|
|
3877
|
-
},
|
|
3878
|
-
{
|
|
3879
|
-
key: "parseScte35Binary",
|
|
3880
|
-
value: function parseScte35Binary(data) {
|
|
3881
|
-
var BitReader = /*#__PURE__*/ function() {
|
|
3882
|
-
function BitReader(buf) {
|
|
3883
|
-
_class_call_check(this, BitReader);
|
|
3884
|
-
this.buf = buf;
|
|
3885
|
-
this.bytePos = 0;
|
|
3886
|
-
this.bitPos = 0;
|
|
3887
|
-
}
|
|
3888
|
-
_create_class(BitReader, [
|
|
3889
|
-
{
|
|
3890
|
-
key: "readBits",
|
|
3891
|
-
value: function readBits(numBits) {
|
|
3892
|
-
var result = 0;
|
|
3893
|
-
while(numBits > 0){
|
|
3894
|
-
if (this.bytePos >= this.buf.length) return result;
|
|
3895
|
-
var remainingInByte = 8 - this.bitPos;
|
|
3896
|
-
var toRead = Math.min(numBits, remainingInByte);
|
|
3897
|
-
var currentByte = this.buf[this.bytePos];
|
|
3898
|
-
var shift = remainingInByte - toRead;
|
|
3899
|
-
var mask = (1 << toRead) - 1 & 255;
|
|
3900
|
-
var bits = currentByte >> shift & mask;
|
|
3901
|
-
result = result << toRead | bits;
|
|
3902
|
-
this.bitPos += toRead;
|
|
3903
|
-
if (this.bitPos >= 8) {
|
|
3904
|
-
this.bitPos = 0;
|
|
3905
|
-
this.bytePos += 1;
|
|
3906
|
-
}
|
|
3907
|
-
numBits -= toRead;
|
|
3908
|
-
}
|
|
3909
|
-
return result >>> 0;
|
|
3910
|
-
}
|
|
3911
|
-
},
|
|
3912
|
-
{
|
|
3913
|
-
key: "skipBits",
|
|
3914
|
-
value: function skipBits(n) {
|
|
3915
|
-
this.readBits(n);
|
|
3916
|
-
}
|
|
3917
|
-
}
|
|
3918
|
-
]);
|
|
3919
|
-
return BitReader;
|
|
3920
|
-
}();
|
|
3921
|
-
var r = new BitReader(data);
|
|
3922
|
-
var tableId = r.readBits(8);
|
|
3923
|
-
if (tableId !== 252) return void 0;
|
|
3924
|
-
r.readBits(1);
|
|
3925
|
-
r.readBits(1);
|
|
3926
|
-
r.readBits(2);
|
|
3927
|
-
var sectionLength = r.readBits(12);
|
|
3928
|
-
r.readBits(8);
|
|
3929
|
-
r.readBits(1);
|
|
3930
|
-
r.readBits(6);
|
|
3931
|
-
var ptsAdjHigh = r.readBits(1);
|
|
3932
|
-
var ptsAdjLow = r.readBits(32);
|
|
3933
|
-
void ptsAdjHigh;
|
|
3934
|
-
void ptsAdjLow;
|
|
3935
|
-
r.readBits(8);
|
|
3936
|
-
r.readBits(12);
|
|
3937
|
-
var spliceCommandLength = r.readBits(12);
|
|
3938
|
-
var spliceCommandType = r.readBits(8);
|
|
3939
|
-
if (spliceCommandType !== 5) {
|
|
3940
|
-
return void 0;
|
|
3941
|
-
}
|
|
3942
|
-
r.readBits(32);
|
|
3943
|
-
var cancel = r.readBits(1) === 1;
|
|
3944
|
-
r.readBits(7);
|
|
3945
|
-
if (cancel) return void 0;
|
|
3946
|
-
var outOfNetwork = r.readBits(1) === 1;
|
|
3947
|
-
var programSpliceFlag = r.readBits(1) === 1;
|
|
3948
|
-
var durationFlag = r.readBits(1) === 1;
|
|
3949
|
-
var spliceImmediateFlag = r.readBits(1) === 1;
|
|
3950
|
-
r.readBits(4);
|
|
3951
|
-
if (programSpliceFlag && !spliceImmediateFlag) {
|
|
3952
|
-
var timeSpecifiedFlag = r.readBits(1) === 1;
|
|
3953
|
-
if (timeSpecifiedFlag) {
|
|
3954
|
-
r.readBits(6);
|
|
3955
|
-
r.readBits(33);
|
|
3956
|
-
} else {
|
|
3957
|
-
r.readBits(7);
|
|
3958
|
-
}
|
|
3959
|
-
} else if (!programSpliceFlag) {
|
|
3960
|
-
var componentCount = r.readBits(8);
|
|
3961
|
-
for(var i = 0; i < componentCount; i++){
|
|
3962
|
-
r.readBits(8);
|
|
3963
|
-
if (!spliceImmediateFlag) {
|
|
3964
|
-
var timeSpecifiedFlag1 = r.readBits(1) === 1;
|
|
3965
|
-
if (timeSpecifiedFlag1) {
|
|
3966
|
-
r.readBits(6);
|
|
3967
|
-
r.readBits(33);
|
|
3968
|
-
} else {
|
|
3969
|
-
r.readBits(7);
|
|
3970
|
-
}
|
|
3971
|
-
}
|
|
3972
|
-
}
|
|
3973
|
-
}
|
|
3974
|
-
var durationSeconds = void 0;
|
|
3975
|
-
if (durationFlag) {
|
|
3976
|
-
r.readBits(6);
|
|
3977
|
-
r.readBits(1);
|
|
3978
|
-
var high = r.readBits(1);
|
|
3979
|
-
var low = r.readBits(32);
|
|
3980
|
-
var durationTicks = high * 4294967296 + low;
|
|
3981
|
-
durationSeconds = durationTicks / 9e4;
|
|
3982
|
-
}
|
|
3983
|
-
r.readBits(16);
|
|
3984
|
-
r.readBits(8);
|
|
3985
|
-
r.readBits(8);
|
|
3986
|
-
if (outOfNetwork) {
|
|
3987
|
-
var marker = _object_spread_props(_object_spread({
|
|
3988
|
-
type: "start"
|
|
3989
|
-
}, durationSeconds !== void 0 ? {
|
|
3990
|
-
durationSeconds: durationSeconds
|
|
3991
|
-
} : {}), {
|
|
3992
|
-
raw: {
|
|
3993
|
-
splice_command_type: 5
|
|
3994
|
-
}
|
|
3995
|
-
});
|
|
3996
|
-
return marker;
|
|
3997
|
-
}
|
|
3998
|
-
return void 0;
|
|
3999
|
-
}
|
|
4000
|
-
},
|
|
4001
3443
|
{
|
|
4002
3444
|
key: "initializeTracking",
|
|
4003
3445
|
value: function initializeTracking() {
|
|
@@ -4119,35 +3561,35 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4119
3561
|
},
|
|
4120
3562
|
{
|
|
4121
3563
|
key: "startAdPrefetch",
|
|
4122
|
-
value: function startAdPrefetch(
|
|
3564
|
+
value: function startAdPrefetch(durationSeconds, fragmentSn) {
|
|
4123
3565
|
if (this.config.disableAds) return;
|
|
4124
3566
|
if (this.pendingAdBreak || this.inAdBreak) {
|
|
4125
3567
|
return;
|
|
4126
3568
|
}
|
|
4127
|
-
this.pendingAdBreak = _object_spread_props(_object_spread({
|
|
4128
|
-
|
|
4129
|
-
}, fragmentSn !== void 0 ? {
|
|
3569
|
+
this.pendingAdBreak = _object_spread_props(_object_spread({}, durationSeconds !== void 0 ? {
|
|
3570
|
+
durationSeconds: durationSeconds
|
|
3571
|
+
} : {}, fragmentSn !== void 0 ? {
|
|
4130
3572
|
detectedAtFragmentSn: fragmentSn
|
|
4131
3573
|
} : {}), {
|
|
4132
3574
|
isFetching: false,
|
|
4133
3575
|
fetchStartTime: Date.now()
|
|
4134
3576
|
});
|
|
4135
|
-
void this.runAdPrefetch(
|
|
3577
|
+
void this.runAdPrefetch(durationSeconds);
|
|
4136
3578
|
if (this.config.debugAdTiming) {
|
|
4137
|
-
console.log("[PREFETCH] Ad break
|
|
3579
|
+
console.log("[PREFETCH] Ad break registered, multi-ad prefetch started");
|
|
4138
3580
|
}
|
|
4139
3581
|
}
|
|
4140
3582
|
},
|
|
4141
3583
|
{
|
|
4142
3584
|
key: "runAdPrefetch",
|
|
4143
|
-
value: function runAdPrefetch(
|
|
3585
|
+
value: function runAdPrefetch(durationSeconds) {
|
|
4144
3586
|
return _async_to_generator(function() {
|
|
4145
|
-
var _this,
|
|
3587
|
+
var _this, _ref, _firstBids_, durSec, context, firstBids, unused, adDurationSec, estimatedCount, firstToken, unused1, remaining, results, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, result, token, unused2, err;
|
|
4146
3588
|
return _ts_generator(this, function(_state) {
|
|
4147
3589
|
switch(_state.label){
|
|
4148
3590
|
case 0:
|
|
4149
3591
|
_this = this;
|
|
4150
|
-
durSec =
|
|
3592
|
+
durSec = durationSeconds !== null && durationSeconds !== void 0 ? durationSeconds : 60;
|
|
4151
3593
|
context = {
|
|
4152
3594
|
breakDurationSec: durSec,
|
|
4153
3595
|
remainingBreakSec: durSec
|
|
@@ -4197,14 +3639,43 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4197
3639
|
console.log("[PREFETCH] Ad duration=".concat(adDurationSec, "s, break=").concat(durSec, "s → ").concat(estimatedCount, " ad(s) needed"));
|
|
4198
3640
|
}
|
|
4199
3641
|
firstToken = "preload_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 7));
|
|
4200
|
-
|
|
4201
|
-
|
|
3642
|
+
_state.label = 5;
|
|
3643
|
+
case 5:
|
|
3644
|
+
_state.trys.push([
|
|
3645
|
+
5,
|
|
3646
|
+
7,
|
|
3647
|
+
,
|
|
3648
|
+
8
|
|
3649
|
+
]);
|
|
3650
|
+
return [
|
|
3651
|
+
4,
|
|
3652
|
+
this.adLayer.preloadAd(firstBids, firstToken)
|
|
3653
|
+
];
|
|
3654
|
+
case 6:
|
|
3655
|
+
_state.sent();
|
|
3656
|
+
if (!this.inAdBreak) {
|
|
3657
|
+
this.preloadedTokens.push(firstToken);
|
|
3658
|
+
if (this.config.debugAdTiming) {
|
|
3659
|
+
console.log("[PREFETCH] First ad preloaded and queued, token=".concat(firstToken));
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
return [
|
|
3663
|
+
3,
|
|
3664
|
+
8
|
|
3665
|
+
];
|
|
3666
|
+
case 7:
|
|
3667
|
+
unused1 = _state.sent();
|
|
4202
3668
|
if (this.config.debugAdTiming) {
|
|
4203
|
-
console.
|
|
3669
|
+
console.warn("[PREFETCH] First ad preload failed, token=".concat(firstToken));
|
|
4204
3670
|
}
|
|
3671
|
+
return [
|
|
3672
|
+
3,
|
|
3673
|
+
8
|
|
3674
|
+
];
|
|
3675
|
+
case 8:
|
|
4205
3676
|
if (!(estimatedCount > 1)) return [
|
|
4206
3677
|
3,
|
|
4207
|
-
|
|
3678
|
+
19
|
|
4208
3679
|
];
|
|
4209
3680
|
remaining = Array.from({
|
|
4210
3681
|
length: estimatedCount - 1
|
|
@@ -4226,38 +3697,100 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4226
3697
|
4,
|
|
4227
3698
|
Promise.all(remaining)
|
|
4228
3699
|
];
|
|
4229
|
-
case
|
|
3700
|
+
case 9:
|
|
4230
3701
|
results = _state.sent();
|
|
4231
3702
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3703
|
+
_state.label = 10;
|
|
3704
|
+
case 10:
|
|
3705
|
+
_state.trys.push([
|
|
3706
|
+
10,
|
|
3707
|
+
17,
|
|
3708
|
+
18,
|
|
3709
|
+
19
|
|
3710
|
+
]);
|
|
3711
|
+
_iterator = results[Symbol.iterator]();
|
|
3712
|
+
_state.label = 11;
|
|
3713
|
+
case 11:
|
|
3714
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
3715
|
+
3,
|
|
3716
|
+
16
|
|
3717
|
+
];
|
|
3718
|
+
result = _step.value;
|
|
3719
|
+
if (this.inAdBreak) return [
|
|
3720
|
+
3,
|
|
3721
|
+
16
|
|
3722
|
+
];
|
|
3723
|
+
if (!(result.ok && result.value.length > 0)) return [
|
|
3724
|
+
3,
|
|
3725
|
+
15
|
|
3726
|
+
];
|
|
3727
|
+
token = "preload_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 7));
|
|
3728
|
+
_state.label = 12;
|
|
3729
|
+
case 12:
|
|
3730
|
+
_state.trys.push([
|
|
3731
|
+
12,
|
|
3732
|
+
14,
|
|
3733
|
+
,
|
|
3734
|
+
15
|
|
3735
|
+
]);
|
|
3736
|
+
return [
|
|
3737
|
+
4,
|
|
3738
|
+
this.adLayer.preloadAd(result.value, token)
|
|
3739
|
+
];
|
|
3740
|
+
case 13:
|
|
3741
|
+
_state.sent();
|
|
3742
|
+
if (!this.inAdBreak) {
|
|
3743
|
+
this.preloadedTokens.push(token);
|
|
3744
|
+
if (this.config.debugAdTiming) {
|
|
3745
|
+
console.log("[PREFETCH] Additional ad preloaded and queued, token=".concat(token));
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
return [
|
|
3749
|
+
3,
|
|
3750
|
+
15
|
|
3751
|
+
];
|
|
3752
|
+
case 14:
|
|
3753
|
+
unused2 = _state.sent();
|
|
3754
|
+
if (this.config.debugAdTiming) {
|
|
3755
|
+
console.warn("[PREFETCH] Additional ad preload failed, token=".concat(token));
|
|
3756
|
+
}
|
|
3757
|
+
return [
|
|
3758
|
+
3,
|
|
3759
|
+
15
|
|
3760
|
+
];
|
|
3761
|
+
case 15:
|
|
3762
|
+
_iteratorNormalCompletion = true;
|
|
3763
|
+
return [
|
|
3764
|
+
3,
|
|
3765
|
+
11
|
|
3766
|
+
];
|
|
3767
|
+
case 16:
|
|
3768
|
+
return [
|
|
3769
|
+
3,
|
|
3770
|
+
19
|
|
3771
|
+
];
|
|
3772
|
+
case 17:
|
|
3773
|
+
err = _state.sent();
|
|
3774
|
+
_didIteratorError = true;
|
|
3775
|
+
_iteratorError = err;
|
|
3776
|
+
return [
|
|
3777
|
+
3,
|
|
3778
|
+
19
|
|
3779
|
+
];
|
|
3780
|
+
case 18:
|
|
4232
3781
|
try {
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
if (this.inAdBreak) break;
|
|
4236
|
-
if (result.ok && result.value.length > 0) {
|
|
4237
|
-
token = "preload_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 7));
|
|
4238
|
-
this.preloadedTokens.push(token);
|
|
4239
|
-
void this.adLayer.preloadAd(result.value, token);
|
|
4240
|
-
if (this.config.debugAdTiming) {
|
|
4241
|
-
console.log("[PREFETCH] Additional ad preloading, token=".concat(token));
|
|
4242
|
-
}
|
|
4243
|
-
}
|
|
3782
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3783
|
+
_iterator.return();
|
|
4244
3784
|
}
|
|
4245
|
-
} catch (err) {
|
|
4246
|
-
_didIteratorError = true;
|
|
4247
|
-
_iteratorError = err;
|
|
4248
3785
|
} finally{
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
_iterator.return();
|
|
4252
|
-
}
|
|
4253
|
-
} finally{
|
|
4254
|
-
if (_didIteratorError) {
|
|
4255
|
-
throw _iteratorError;
|
|
4256
|
-
}
|
|
3786
|
+
if (_didIteratorError) {
|
|
3787
|
+
throw _iteratorError;
|
|
4257
3788
|
}
|
|
4258
3789
|
}
|
|
4259
|
-
|
|
4260
|
-
|
|
3790
|
+
return [
|
|
3791
|
+
7
|
|
3792
|
+
];
|
|
3793
|
+
case 19:
|
|
4261
3794
|
if (this.config.debugAdTiming) {
|
|
4262
3795
|
console.log("[PREFETCH] Pre-fetch complete: ".concat(this.preloadedTokens.length, " ad(s) queued"));
|
|
4263
3796
|
}
|
|
@@ -4422,15 +3955,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4422
3955
|
if (this.config.debugAdTiming) {
|
|
4423
3956
|
console.log('[StormcloudVideoPlayer] Ad insertion segment "'.concat(segmentName, '" found in manifest — starting pre-fetch'));
|
|
4424
3957
|
}
|
|
4425
|
-
|
|
4426
|
-
type: "start",
|
|
4427
|
-
durationSeconds: 60,
|
|
4428
|
-
raw: {
|
|
4429
|
-
apiInsertionPoint: this.lastAdInsertionPoint,
|
|
4430
|
-
earlyDetection: true
|
|
4431
|
-
}
|
|
4432
|
-
};
|
|
4433
|
-
this.startAdPrefetch(marker, frag === null || frag === void 0 ? void 0 : frag.sn);
|
|
3958
|
+
this.startAdPrefetch(60, frag === null || frag === void 0 ? void 0 : frag.sn);
|
|
4434
3959
|
return;
|
|
4435
3960
|
}
|
|
4436
3961
|
}
|
|
@@ -4468,8 +3993,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4468
3993
|
{
|
|
4469
3994
|
key: "fragmentMatchesSegment",
|
|
4470
3995
|
value: function fragmentMatchesSegment(frag, segmentName) {
|
|
4471
|
-
var
|
|
4472
|
-
|
|
3996
|
+
var _rawUrl_split_;
|
|
3997
|
+
var rawUrl = (frag === null || frag === void 0 ? void 0 : frag.url) || (frag === null || frag === void 0 ? void 0 : frag.relurl) || "";
|
|
3998
|
+
var url = (_rawUrl_split_ = rawUrl.split("?")[0]) !== null && _rawUrl_split_ !== void 0 ? _rawUrl_split_ : "";
|
|
3999
|
+
var name = segmentName.startsWith("/") ? segmentName : "/" + segmentName;
|
|
4000
|
+
return url.endsWith(name) || url.includes(name);
|
|
4473
4001
|
}
|
|
4474
4002
|
},
|
|
4475
4003
|
{
|
|
@@ -4806,13 +4334,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4806
4334
|
},
|
|
4807
4335
|
{
|
|
4808
4336
|
key: "handleAdStart",
|
|
4809
|
-
value: function handleAdStart(
|
|
4337
|
+
value: function handleAdStart(durationSeconds) {
|
|
4810
4338
|
return _async_to_generator(function() {
|
|
4811
|
-
var
|
|
4339
|
+
var _this_savedMutedStateBeforeAd, adBreakDurationMs, mode, state, adBreakToken, adVolume, token, remaining, err;
|
|
4812
4340
|
return _ts_generator(this, function(_state) {
|
|
4813
4341
|
switch(_state.label){
|
|
4814
4342
|
case 0:
|
|
4815
|
-
adBreakDurationMs =
|
|
4343
|
+
adBreakDurationMs = durationSeconds != null ? durationSeconds * 1e3 : void 0;
|
|
4816
4344
|
if (this.config.debugAdTiming) {
|
|
4817
4345
|
mode = this.isLiveStream ? "LIVE" : "VOD";
|
|
4818
4346
|
console.log("[CONTINUOUS-FETCH] \uD83D\uDCFA ".concat(mode, " MODE: Target duration=").concat(adBreakDurationMs, "ms"));
|
|
@@ -4823,13 +4351,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4823
4351
|
this.pendingNextAdBids = null;
|
|
4824
4352
|
this.isShowingPlaceholder = false;
|
|
4825
4353
|
this.totalAdRequestsInBreak = 0;
|
|
4826
|
-
if (this.
|
|
4827
|
-
this.
|
|
4354
|
+
if (this.savedMutedStateBeforeAd == null && !this.video.muted) {
|
|
4355
|
+
this.savedMutedStateBeforeAd = {
|
|
4828
4356
|
muted: false,
|
|
4829
4357
|
volume: this.video.volume
|
|
4830
4358
|
};
|
|
4831
4359
|
}
|
|
4832
|
-
state = (
|
|
4360
|
+
state = (_this_savedMutedStateBeforeAd = this.savedMutedStateBeforeAd) !== null && _this_savedMutedStateBeforeAd !== void 0 ? _this_savedMutedStateBeforeAd : {
|
|
4833
4361
|
muted: this.video.muted,
|
|
4834
4362
|
volume: this.video.volume
|
|
4835
4363
|
};
|
|
@@ -4856,6 +4384,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4856
4384
|
if (this.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
4857
4385
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
4858
4386
|
}
|
|
4387
|
+
if (this.expectedAdBreakDurationMs != null) {
|
|
4388
|
+
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4389
|
+
}
|
|
4859
4390
|
this.clearPendingAdBreak();
|
|
4860
4391
|
adBreakToken = Date.now();
|
|
4861
4392
|
this.activeAdRequestToken = adBreakToken;
|
|
@@ -5354,49 +4885,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5354
4885
|
this.handleAdPodComplete();
|
|
5355
4886
|
}
|
|
5356
4887
|
},
|
|
5357
|
-
{
|
|
5358
|
-
key: "scheduleAdStartIn",
|
|
5359
|
-
value: function scheduleAdStartIn(delayMs) {
|
|
5360
|
-
var _this = this;
|
|
5361
|
-
this.clearAdStartTimer();
|
|
5362
|
-
var ms = Math.max(0, Math.floor(delayMs));
|
|
5363
|
-
if (ms === 0) {
|
|
5364
|
-
this.handleAdStart({
|
|
5365
|
-
type: "start"
|
|
5366
|
-
}).catch(function() {});
|
|
5367
|
-
return;
|
|
5368
|
-
}
|
|
5369
|
-
this.adStartTimerId = window.setTimeout(function() {
|
|
5370
|
-
_this.handleAdStart({
|
|
5371
|
-
type: "start"
|
|
5372
|
-
}).catch(function() {});
|
|
5373
|
-
}, ms);
|
|
5374
|
-
}
|
|
5375
|
-
},
|
|
5376
|
-
{
|
|
5377
|
-
key: "clearAdStartTimer",
|
|
5378
|
-
value: function clearAdStartTimer() {
|
|
5379
|
-
if (this.adStartTimerId != null) {
|
|
5380
|
-
clearTimeout(this.adStartTimerId);
|
|
5381
|
-
this.adStartTimerId = void 0;
|
|
5382
|
-
}
|
|
5383
|
-
}
|
|
5384
|
-
},
|
|
5385
|
-
{
|
|
5386
|
-
key: "updatePtsDrift",
|
|
5387
|
-
value: function updatePtsDrift(ptsSecondsSample) {
|
|
5388
|
-
var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
|
|
5389
|
-
if (!Number.isFinite(sampleMs) || Math.abs(sampleMs) > 6e4) return;
|
|
5390
|
-
var alpha = 0.1;
|
|
5391
|
-
this.ptsDriftEmaMs = this.ptsDriftEmaMs * (1 - alpha) + sampleMs * alpha;
|
|
5392
|
-
}
|
|
5393
|
-
},
|
|
5394
4888
|
{
|
|
5395
4889
|
key: "handleAdPodComplete",
|
|
5396
4890
|
value: function handleAdPodComplete() {
|
|
5397
4891
|
var _this = this;
|
|
5398
4892
|
var _ref, _ref1;
|
|
5399
|
-
var
|
|
4893
|
+
var _this_savedMutedStateBeforeAd, _this_savedMutedStateBeforeAd1;
|
|
5400
4894
|
if (this.config.debugAdTiming) {
|
|
5401
4895
|
console.log("[StormcloudVideoPlayer] \uD83C\uDFC1 Ad pod complete - cleaning up");
|
|
5402
4896
|
}
|
|
@@ -5418,7 +4912,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5418
4912
|
this.inAdBreak = false;
|
|
5419
4913
|
this.expectedAdBreakDurationMs = void 0;
|
|
5420
4914
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
5421
|
-
this.clearAdStartTimer();
|
|
5422
4915
|
this.clearAdStopTimer();
|
|
5423
4916
|
this.adPodQueue = [];
|
|
5424
4917
|
this.showAds = false;
|
|
@@ -5426,8 +4919,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5426
4919
|
this.totalAdsInBreak = 0;
|
|
5427
4920
|
this.totalAdRequestsInBreak = 0;
|
|
5428
4921
|
this.consecutiveFailures = 0;
|
|
5429
|
-
var restoredMuted = (_ref = (
|
|
5430
|
-
var restoredVolume = (_ref1 = (
|
|
4922
|
+
var restoredMuted = (_ref = (_this_savedMutedStateBeforeAd = this.savedMutedStateBeforeAd) === null || _this_savedMutedStateBeforeAd === void 0 ? void 0 : _this_savedMutedStateBeforeAd.muted) !== null && _ref !== void 0 ? _ref : this.adLayer.getOriginalMutedState();
|
|
4923
|
+
var restoredVolume = (_ref1 = (_this_savedMutedStateBeforeAd1 = this.savedMutedStateBeforeAd) === null || _this_savedMutedStateBeforeAd1 === void 0 ? void 0 : _this_savedMutedStateBeforeAd1.volume) !== null && _ref1 !== void 0 ? _ref1 : this.adLayer.getOriginalVolume();
|
|
5431
4924
|
this.adLayer.updateOriginalMutedState(restoredMuted, restoredVolume);
|
|
5432
4925
|
this.adLayer.stop().catch(function() {});
|
|
5433
4926
|
if (this.video.muted !== restoredMuted) {
|
|
@@ -5536,7 +5029,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5536
5029
|
}, delay);
|
|
5537
5030
|
});
|
|
5538
5031
|
}
|
|
5539
|
-
this.
|
|
5032
|
+
this.savedMutedStateBeforeAd = null;
|
|
5540
5033
|
}
|
|
5541
5034
|
},
|
|
5542
5035
|
{
|
|
@@ -5686,19 +5179,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5686
5179
|
return Math.max(0, this.expectedAdBreakDurationMs - elapsed);
|
|
5687
5180
|
}
|
|
5688
5181
|
},
|
|
5689
|
-
{
|
|
5690
|
-
key: "pushScteMarker",
|
|
5691
|
-
value: function pushScteMarker(marker) {
|
|
5692
|
-
if (!this.config.debugAdTiming) return;
|
|
5693
|
-
this.scteMarkerHistory.push({
|
|
5694
|
-
timestampMs: Date.now(),
|
|
5695
|
-
marker: marker
|
|
5696
|
-
});
|
|
5697
|
-
if (this.scteMarkerHistory.length > DEBUG_HISTORY_LIMIT) {
|
|
5698
|
-
this.scteMarkerHistory = this.scteMarkerHistory.slice(-DEBUG_HISTORY_LIMIT);
|
|
5699
|
-
}
|
|
5700
|
-
}
|
|
5701
|
-
},
|
|
5702
5182
|
{
|
|
5703
5183
|
key: "pushDebugLog",
|
|
5704
5184
|
value: function pushDebugLog(level, category, message, details) {
|
|
@@ -5716,23 +5196,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5716
5196
|
}
|
|
5717
5197
|
}
|
|
5718
5198
|
},
|
|
5719
|
-
{
|
|
5720
|
-
key: "getRecentScteMarkers",
|
|
5721
|
-
value: function getRecentScteMarkers() {
|
|
5722
|
-
return this.scteMarkerHistory.map(function(entry) {
|
|
5723
|
-
return _object_spread({
|
|
5724
|
-
timestampMs: entry.timestampMs,
|
|
5725
|
-
type: entry.marker.type
|
|
5726
|
-
}, entry.marker.ptsSeconds !== void 0 ? {
|
|
5727
|
-
ptsSeconds: entry.marker.ptsSeconds
|
|
5728
|
-
} : {}, entry.marker.durationSeconds !== void 0 ? {
|
|
5729
|
-
durationSeconds: entry.marker.durationSeconds
|
|
5730
|
-
} : {}, entry.marker.raw !== void 0 ? {
|
|
5731
|
-
raw: entry.marker.raw
|
|
5732
|
-
} : {});
|
|
5733
|
-
});
|
|
5734
|
-
}
|
|
5735
|
-
},
|
|
5736
5199
|
{
|
|
5737
5200
|
key: "pushAdInsertionDebug",
|
|
5738
5201
|
value: function pushAdInsertionDebug(event, segmentName, opts) {
|
|
@@ -6029,7 +5492,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6029
5492
|
this.clearAdInsertionOffsetTimer();
|
|
6030
5493
|
this.stopContinuousFetching();
|
|
6031
5494
|
this.stopFillerBreakTimer();
|
|
6032
|
-
this.clearAdStartTimer();
|
|
6033
5495
|
this.clearAdStopTimer();
|
|
6034
5496
|
this.clearAdFailsafeTimer();
|
|
6035
5497
|
this.clearAdRequestWatchdog();
|
|
@@ -6057,7 +5519,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6057
5519
|
(_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
|
|
6058
5520
|
this.consecutiveFailures = 0;
|
|
6059
5521
|
this.debugLogEntries = [];
|
|
6060
|
-
this.scteMarkerHistory = [];
|
|
6061
5522
|
this.adInsertionDebugHistory = [];
|
|
6062
5523
|
}
|
|
6063
5524
|
}
|
|
@@ -7534,6 +6995,11 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7534
6995
|
label: "API",
|
|
7535
6996
|
color: "#60a5fa"
|
|
7536
6997
|
};
|
|
6998
|
+
case "scte35_inserted":
|
|
6999
|
+
return {
|
|
7000
|
+
label: "SCTE-35",
|
|
7001
|
+
color: "#f43f5e"
|
|
7002
|
+
};
|
|
7537
7003
|
case "segment_found":
|
|
7538
7004
|
return {
|
|
7539
7005
|
label: "FOUND",
|
|
@@ -7704,6 +7170,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7704
7170
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
7705
7171
|
if (disableAds !== void 0) cfg.disableAds = disableAds;
|
|
7706
7172
|
cfg.disableFiller = disableFiller !== null && disableFiller !== void 0 ? disableFiller : true;
|
|
7173
|
+
if (swirlProjectId !== void 0) cfg.projectId = String(swirlProjectId);
|
|
7707
7174
|
var player = new StormcloudVideoPlayer(cfg);
|
|
7708
7175
|
playerRef.current = player;
|
|
7709
7176
|
player.load().then(function() {
|
|
@@ -8577,9 +8044,13 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8577
8044
|
overflowX: "hidden",
|
|
8578
8045
|
height: "calc(100% - 46px)",
|
|
8579
8046
|
display: "grid",
|
|
8580
|
-
gap: "12px"
|
|
8047
|
+
gap: "12px",
|
|
8048
|
+
minWidth: 0
|
|
8581
8049
|
},
|
|
8582
8050
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", {
|
|
8051
|
+
style: {
|
|
8052
|
+
minWidth: 0
|
|
8053
|
+
},
|
|
8583
8054
|
children: [
|
|
8584
8055
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", {
|
|
8585
8056
|
style: {
|
|
@@ -8595,7 +8066,8 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8595
8066
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", {
|
|
8596
8067
|
style: {
|
|
8597
8068
|
display: "grid",
|
|
8598
|
-
gap: "6px"
|
|
8069
|
+
gap: "6px",
|
|
8070
|
+
minWidth: 0
|
|
8599
8071
|
},
|
|
8600
8072
|
children: debugMarkers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", {
|
|
8601
8073
|
style: {
|
|
@@ -8605,53 +8077,129 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8605
8077
|
children: "No ad insertion events yet."
|
|
8606
8078
|
}) : debugMarkers.map(function(entry, idx) {
|
|
8607
8079
|
var evt = formatAdInsertionEvent(entry.event);
|
|
8080
|
+
var fileName = entry.segmentName ? entry.segmentName.split("/").pop() || entry.segmentName : "";
|
|
8608
8081
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", {
|
|
8609
8082
|
style: {
|
|
8610
|
-
|
|
8611
|
-
gridTemplateColumns: "56px 54px 1fr",
|
|
8612
|
-
gap: "8px",
|
|
8613
|
-
alignItems: "center",
|
|
8083
|
+
minWidth: 0,
|
|
8614
8084
|
fontFamily: "'SF Mono', 'Cascadia Code', monospace",
|
|
8615
8085
|
fontSize: "11px",
|
|
8616
8086
|
background: "rgba(255,255,255,0.05)",
|
|
8617
8087
|
border: "1px solid rgba(255,255,255,0.08)",
|
|
8618
8088
|
borderRadius: "8px",
|
|
8619
|
-
padding: "6px 8px"
|
|
8089
|
+
padding: "6px 8px",
|
|
8090
|
+
display: "flex",
|
|
8091
|
+
flexDirection: "column",
|
|
8092
|
+
gap: "4px"
|
|
8620
8093
|
},
|
|
8621
8094
|
children: [
|
|
8622
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
8095
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", {
|
|
8623
8096
|
style: {
|
|
8624
|
-
|
|
8097
|
+
display: "grid",
|
|
8098
|
+
gridTemplateColumns: "56px 54px minmax(0, 1fr) 20px",
|
|
8099
|
+
gap: "6px",
|
|
8100
|
+
alignItems: "center",
|
|
8101
|
+
minWidth: 0
|
|
8625
8102
|
},
|
|
8626
|
-
children:
|
|
8103
|
+
children: [
|
|
8104
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
|
|
8105
|
+
style: {
|
|
8106
|
+
color: "rgba(255,255,255,0.68)"
|
|
8107
|
+
},
|
|
8108
|
+
children: formatDebugClock(entry.timestampMs)
|
|
8109
|
+
}),
|
|
8110
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
|
|
8111
|
+
style: {
|
|
8112
|
+
fontWeight: 700,
|
|
8113
|
+
color: evt.color,
|
|
8114
|
+
fontSize: "10px"
|
|
8115
|
+
},
|
|
8116
|
+
children: evt.label
|
|
8117
|
+
}),
|
|
8118
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
|
|
8119
|
+
style: {
|
|
8120
|
+
color: "rgba(255,255,255,0.88)",
|
|
8121
|
+
overflow: "hidden",
|
|
8122
|
+
textOverflow: "ellipsis",
|
|
8123
|
+
whiteSpace: "nowrap",
|
|
8124
|
+
minWidth: 0
|
|
8125
|
+
},
|
|
8126
|
+
title: entry.segmentName,
|
|
8127
|
+
children: fileName
|
|
8128
|
+
}),
|
|
8129
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", {
|
|
8130
|
+
onClick: function onClick() {
|
|
8131
|
+
return navigator.clipboard.writeText(entry.segmentName);
|
|
8132
|
+
},
|
|
8133
|
+
title: entry.segmentName,
|
|
8134
|
+
style: {
|
|
8135
|
+
background: "none",
|
|
8136
|
+
border: "none",
|
|
8137
|
+
cursor: "pointer",
|
|
8138
|
+
padding: "2px",
|
|
8139
|
+
color: "rgba(255,255,255,0.45)",
|
|
8140
|
+
display: "flex",
|
|
8141
|
+
alignItems: "center",
|
|
8142
|
+
justifyContent: "center",
|
|
8143
|
+
borderRadius: "4px",
|
|
8144
|
+
flexShrink: 0
|
|
8145
|
+
},
|
|
8146
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
8147
|
+
return e.currentTarget.style.color = "rgba(255,255,255,0.9)";
|
|
8148
|
+
},
|
|
8149
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
8150
|
+
return e.currentTarget.style.color = "rgba(255,255,255,0.45)";
|
|
8151
|
+
},
|
|
8152
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_fa.FaCopy, {
|
|
8153
|
+
size: 10
|
|
8154
|
+
})
|
|
8155
|
+
})
|
|
8156
|
+
]
|
|
8627
8157
|
}),
|
|
8628
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
8158
|
+
(entry.offsetSeconds != null || entry.detail || entry.updatedAt) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", {
|
|
8629
8159
|
style: {
|
|
8630
|
-
|
|
8631
|
-
|
|
8160
|
+
display: "flex",
|
|
8161
|
+
flexWrap: "wrap",
|
|
8162
|
+
gap: "6px",
|
|
8163
|
+
paddingLeft: "0px",
|
|
8632
8164
|
fontSize: "10px"
|
|
8633
8165
|
},
|
|
8634
|
-
children:
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8166
|
+
children: [
|
|
8167
|
+
entry.offsetSeconds != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", {
|
|
8168
|
+
style: {
|
|
8169
|
+
color: "rgba(255,255,255,0.55)",
|
|
8170
|
+
background: "rgba(255,255,255,0.06)",
|
|
8171
|
+
borderRadius: "4px",
|
|
8172
|
+
padding: "1px 5px"
|
|
8173
|
+
},
|
|
8174
|
+
children: [
|
|
8175
|
+
"+",
|
|
8176
|
+
entry.offsetSeconds.toFixed(2),
|
|
8177
|
+
"s"
|
|
8178
|
+
]
|
|
8179
|
+
}),
|
|
8180
|
+
entry.detail && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
|
|
8181
|
+
style: {
|
|
8182
|
+
color: "rgba(255,255,255,0.55)",
|
|
8183
|
+
background: "rgba(255,255,255,0.06)",
|
|
8184
|
+
borderRadius: "4px",
|
|
8185
|
+
padding: "1px 5px",
|
|
8186
|
+
overflow: "hidden",
|
|
8187
|
+
textOverflow: "ellipsis",
|
|
8188
|
+
whiteSpace: "nowrap",
|
|
8189
|
+
maxWidth: "100%"
|
|
8190
|
+
},
|
|
8191
|
+
children: entry.detail
|
|
8192
|
+
}),
|
|
8193
|
+
entry.updatedAt && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
|
|
8194
|
+
style: {
|
|
8195
|
+
color: "rgba(255,255,255,0.38)",
|
|
8196
|
+
background: "rgba(255,255,255,0.04)",
|
|
8197
|
+
borderRadius: "4px",
|
|
8198
|
+
padding: "1px 5px"
|
|
8199
|
+
},
|
|
8200
|
+
children: formatAiRelativeTime(entry.updatedAt)
|
|
8201
|
+
})
|
|
8202
|
+
]
|
|
8655
8203
|
})
|
|
8656
8204
|
]
|
|
8657
8205
|
}, "".concat(entry.timestampMs, "-").concat(idx));
|