stormcloud-video-player 0.5.7 → 0.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +117 -25
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +117 -25
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +117 -25
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +2 -0
- package/lib/players/HlsPlayer.cjs +117 -25
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +117 -25
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/prebidController.cjs +4 -6
- package/lib/sdk/prebidController.cjs.map +1 -1
- package/lib/sdk/vastParser.cjs +3 -5
- package/lib/sdk/vastParser.cjs.map +1 -1
- package/lib/sdk/vastParser.d.cts +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +117 -25
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -526,8 +526,8 @@ function createEmptyTrackingState() {
|
|
|
526
526
|
complete: false
|
|
527
527
|
};
|
|
528
528
|
}
|
|
529
|
-
function fireTrackingPixels(urls, sessionId
|
|
530
|
-
var logPrefix = arguments.length >
|
|
529
|
+
function fireTrackingPixels(urls, sessionId) {
|
|
530
|
+
var logPrefix = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "[VastParser]";
|
|
531
531
|
if (!urls || urls.length === 0) return;
|
|
532
532
|
urls.forEach(function(url) {
|
|
533
533
|
try {
|
|
@@ -535,10 +535,8 @@ function fireTrackingPixels(urls, sessionId, licenseKey) {
|
|
|
535
535
|
if (sessionId) {
|
|
536
536
|
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "session_id=").concat(sessionId);
|
|
537
537
|
}
|
|
538
|
-
if (licenseKey) {
|
|
539
|
-
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "license_key=").concat(licenseKey);
|
|
540
|
-
}
|
|
541
538
|
var img = new Image(1, 1);
|
|
539
|
+
img.onerror = function() {};
|
|
542
540
|
img.src = trackingUrl;
|
|
543
541
|
console.log("".concat(logPrefix, " Fired tracking pixel: ").concat(trackingUrl));
|
|
544
542
|
} catch (error) {
|
|
@@ -939,7 +937,7 @@ function createPrebidController(contentVideo, options) {
|
|
|
939
937
|
return "session-".concat(Date.now(), "-").concat(Math.random().toString(36).substr(2, 9));
|
|
940
938
|
}
|
|
941
939
|
function fireTrackingPixels2(urls) {
|
|
942
|
-
fireTrackingPixels(urls, sessionId,
|
|
940
|
+
fireTrackingPixels(urls, sessionId, LOG);
|
|
943
941
|
}
|
|
944
942
|
function getMainStreamQuality() {
|
|
945
943
|
if (!mainHlsInstance || !mainHlsInstance.levels) {
|
|
@@ -2676,6 +2674,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2676
2674
|
this.totalAdRequestsInBreak = 0;
|
|
2677
2675
|
this.maxTotalAdRequestsPerBreak = 20;
|
|
2678
2676
|
this.pendingAdBreak = null;
|
|
2677
|
+
this.prefetchAdPromise = null;
|
|
2678
|
+
this.savedMutedStateBeforeScte = null;
|
|
2679
2679
|
this.consecutiveFailures = 0;
|
|
2680
2680
|
this.maxConsecutiveFailures = 5;
|
|
2681
2681
|
this.lastAdRequestTime = 0;
|
|
@@ -3151,6 +3151,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3151
3151
|
}
|
|
3152
3152
|
}
|
|
3153
3153
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
3154
|
+
_this.adController.stop().catch(function() {});
|
|
3154
3155
|
_this.handleAdFailure();
|
|
3155
3156
|
});
|
|
3156
3157
|
this.adController.on("content_pause", function() {
|
|
@@ -3193,6 +3194,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3193
3194
|
_this.activeAdRequestToken = null;
|
|
3194
3195
|
_this.showAds = false;
|
|
3195
3196
|
if (!_this.inAdBreak) {
|
|
3197
|
+
if (_this.config.debugAdTiming) {
|
|
3198
|
+
console.log("[StormcloudVideoPlayer] content_resume: break already ended (e.g. by CUE-IN or handleAdPodComplete), skipping next-ad path");
|
|
3199
|
+
}
|
|
3196
3200
|
return;
|
|
3197
3201
|
}
|
|
3198
3202
|
_this.consecutiveFailures = 0;
|
|
@@ -3205,6 +3209,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3205
3209
|
if (remaining > 500) {
|
|
3206
3210
|
_this.tryNextAvailableAdWithRateLimit();
|
|
3207
3211
|
} else {
|
|
3212
|
+
if (_this.config.debugAdTiming) {
|
|
3213
|
+
console.log("[StormcloudVideoPlayer] content_resume: remaining time too low to try next ad, ending ad pod");
|
|
3214
|
+
}
|
|
3208
3215
|
_this.handleAdPodComplete();
|
|
3209
3216
|
}
|
|
3210
3217
|
});
|
|
@@ -3213,6 +3220,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3213
3220
|
{
|
|
3214
3221
|
key: "recreateAdController",
|
|
3215
3222
|
value: function recreateAdController() {
|
|
3223
|
+
this.prefetchAdPromise = null;
|
|
3216
3224
|
var shouldShowPlaceholder = this.inAdBreak && this.showAds;
|
|
3217
3225
|
if (shouldShowPlaceholder && this.adController) {
|
|
3218
3226
|
this.showPlaceholderLayer();
|
|
@@ -3541,6 +3549,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3541
3549
|
if (marker.type === "start") {
|
|
3542
3550
|
var _this_config_immediateManifestAds;
|
|
3543
3551
|
var _this_pendingAdBreak;
|
|
3552
|
+
this.savedMutedStateBeforeScte = {
|
|
3553
|
+
muted: this.video.muted,
|
|
3554
|
+
volume: this.video.volume
|
|
3555
|
+
};
|
|
3556
|
+
this.adController.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
3544
3557
|
if (!this.video.muted) {
|
|
3545
3558
|
this.video.muted = true;
|
|
3546
3559
|
this.video.volume = 0;
|
|
@@ -3663,9 +3676,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3663
3676
|
activeAdRequest: this.activeAdRequestToken !== null
|
|
3664
3677
|
});
|
|
3665
3678
|
}
|
|
3666
|
-
if (adPlaying || remaining >
|
|
3679
|
+
if (adPlaying || remaining > 500) {
|
|
3667
3680
|
if (this.config.debugAdTiming) {
|
|
3668
|
-
console.log("[StormcloudVideoPlayer] Ignoring premature SCTE-35 end marker - ads still active");
|
|
3681
|
+
console.log("[StormcloudVideoPlayer] Ignoring premature SCTE-35 end marker - ads still active or time remaining");
|
|
3669
3682
|
}
|
|
3670
3683
|
return;
|
|
3671
3684
|
}
|
|
@@ -3982,6 +3995,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3982
3995
|
{
|
|
3983
3996
|
key: "startAdPrefetch",
|
|
3984
3997
|
value: function startAdPrefetch(marker, fragmentSn) {
|
|
3998
|
+
var _this = this;
|
|
3985
3999
|
if (this.pendingAdBreak || this.inAdBreak) {
|
|
3986
4000
|
return;
|
|
3987
4001
|
}
|
|
@@ -3993,8 +4007,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3993
4007
|
isFetching: false,
|
|
3994
4008
|
fetchStartTime: Date.now()
|
|
3995
4009
|
});
|
|
4010
|
+
this.prefetchAdPromise = this.adController.requestAds().catch(function() {
|
|
4011
|
+
if (_this.config.debugAdTiming) {
|
|
4012
|
+
console.log("[PREFETCH] Prebid auction prefetch failed, will request at playback time");
|
|
4013
|
+
}
|
|
4014
|
+
});
|
|
3996
4015
|
if (this.config.debugAdTiming) {
|
|
3997
|
-
console.log("[PREFETCH] Ad break marker registered, auction
|
|
4016
|
+
console.log("[PREFETCH] Ad break marker registered, auction prefetch started");
|
|
3998
4017
|
}
|
|
3999
4018
|
}
|
|
4000
4019
|
},
|
|
@@ -4005,6 +4024,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4005
4024
|
clearTimeout(this.prefetchTimerId);
|
|
4006
4025
|
this.prefetchTimerId = void 0;
|
|
4007
4026
|
}
|
|
4027
|
+
this.prefetchAdPromise = null;
|
|
4008
4028
|
this.pendingAdBreak = null;
|
|
4009
4029
|
}
|
|
4010
4030
|
},
|
|
@@ -4012,7 +4032,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4012
4032
|
key: "handleAdStart",
|
|
4013
4033
|
value: function handleAdStart(_marker) {
|
|
4014
4034
|
return _async_to_generator(function() {
|
|
4015
|
-
var adBreakDurationMs, mode,
|
|
4035
|
+
var _this_savedMutedStateBeforeScte, adBreakDurationMs, mode, state, unused, unused1, adLoadedInfo, adVolume, error;
|
|
4016
4036
|
return _ts_generator(this, function(_state) {
|
|
4017
4037
|
switch(_state.label){
|
|
4018
4038
|
case 0:
|
|
@@ -4025,9 +4045,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4025
4045
|
this.continuousFetchingActive = true;
|
|
4026
4046
|
this.isShowingPlaceholder = false;
|
|
4027
4047
|
this.totalAdRequestsInBreak = 0;
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4048
|
+
state = (_this_savedMutedStateBeforeScte = this.savedMutedStateBeforeScte) !== null && _this_savedMutedStateBeforeScte !== void 0 ? _this_savedMutedStateBeforeScte : {
|
|
4049
|
+
muted: this.video.muted,
|
|
4050
|
+
volume: this.video.volume
|
|
4051
|
+
};
|
|
4052
|
+
this.adController.updateOriginalMutedState(state.muted, state.volume);
|
|
4053
|
+
this.savedMutedStateBeforeScte = null;
|
|
4031
4054
|
if (!this.video.muted) {
|
|
4032
4055
|
this.video.muted = true;
|
|
4033
4056
|
this.video.volume = 0;
|
|
@@ -4046,25 +4069,94 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4046
4069
|
if (this.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
4047
4070
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
4048
4071
|
}
|
|
4049
|
-
this.clearPendingAdBreak();
|
|
4050
4072
|
if (this.config.debugAdTiming) {
|
|
4051
|
-
console.log("[CONTINUOUS-FETCH] \uD83D\uDCCB Prebid auction
|
|
4073
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDCCB Prebid auction (prefetch or requestAds)");
|
|
4052
4074
|
}
|
|
4053
4075
|
_state.label = 1;
|
|
4054
4076
|
case 1:
|
|
4055
4077
|
_state.trys.push([
|
|
4056
4078
|
1,
|
|
4057
|
-
|
|
4079
|
+
6,
|
|
4058
4080
|
,
|
|
4059
|
-
|
|
4081
|
+
12
|
|
4060
4082
|
]);
|
|
4061
4083
|
this.lastAdRequestTime = Date.now();
|
|
4084
|
+
if (!this.prefetchAdPromise) return [
|
|
4085
|
+
3,
|
|
4086
|
+
3
|
|
4087
|
+
];
|
|
4062
4088
|
return [
|
|
4063
4089
|
4,
|
|
4064
|
-
this.
|
|
4090
|
+
this.prefetchAdPromise
|
|
4065
4091
|
];
|
|
4066
4092
|
case 2:
|
|
4067
4093
|
_state.sent();
|
|
4094
|
+
this.prefetchAdPromise = null;
|
|
4095
|
+
return [
|
|
4096
|
+
3,
|
|
4097
|
+
5
|
|
4098
|
+
];
|
|
4099
|
+
case 3:
|
|
4100
|
+
return [
|
|
4101
|
+
4,
|
|
4102
|
+
this.adController.requestAds()
|
|
4103
|
+
];
|
|
4104
|
+
case 4:
|
|
4105
|
+
_state.sent();
|
|
4106
|
+
_state.label = 5;
|
|
4107
|
+
case 5:
|
|
4108
|
+
return [
|
|
4109
|
+
3,
|
|
4110
|
+
12
|
|
4111
|
+
];
|
|
4112
|
+
case 6:
|
|
4113
|
+
unused = _state.sent();
|
|
4114
|
+
_state.label = 7;
|
|
4115
|
+
case 7:
|
|
4116
|
+
_state.trys.push([
|
|
4117
|
+
7,
|
|
4118
|
+
9,
|
|
4119
|
+
,
|
|
4120
|
+
11
|
|
4121
|
+
]);
|
|
4122
|
+
return [
|
|
4123
|
+
4,
|
|
4124
|
+
this.adController.requestAds()
|
|
4125
|
+
];
|
|
4126
|
+
case 8:
|
|
4127
|
+
_state.sent();
|
|
4128
|
+
return [
|
|
4129
|
+
3,
|
|
4130
|
+
11
|
|
4131
|
+
];
|
|
4132
|
+
case 9:
|
|
4133
|
+
unused1 = _state.sent();
|
|
4134
|
+
this.clearPendingAdBreak();
|
|
4135
|
+
this.consecutiveFailures++;
|
|
4136
|
+
return [
|
|
4137
|
+
4,
|
|
4138
|
+
this.tryNextAvailableAdWithRateLimit()
|
|
4139
|
+
];
|
|
4140
|
+
case 10:
|
|
4141
|
+
_state.sent();
|
|
4142
|
+
return [
|
|
4143
|
+
2
|
|
4144
|
+
];
|
|
4145
|
+
case 11:
|
|
4146
|
+
return [
|
|
4147
|
+
3,
|
|
4148
|
+
12
|
|
4149
|
+
];
|
|
4150
|
+
case 12:
|
|
4151
|
+
this.clearPendingAdBreak();
|
|
4152
|
+
_state.label = 13;
|
|
4153
|
+
case 13:
|
|
4154
|
+
_state.trys.push([
|
|
4155
|
+
13,
|
|
4156
|
+
15,
|
|
4157
|
+
,
|
|
4158
|
+
17
|
|
4159
|
+
]);
|
|
4068
4160
|
if (this.config.licenseKey) {
|
|
4069
4161
|
adLoadedInfo = {
|
|
4070
4162
|
source: this.getAdSource(),
|
|
@@ -4081,19 +4173,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4081
4173
|
4,
|
|
4082
4174
|
this.adController.play()
|
|
4083
4175
|
];
|
|
4084
|
-
case
|
|
4176
|
+
case 14:
|
|
4085
4177
|
_state.sent();
|
|
4086
4178
|
if (this.expectedAdBreakDurationMs != null) {
|
|
4087
4179
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4088
4180
|
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4089
4181
|
}
|
|
4090
|
-
adVolume =
|
|
4182
|
+
adVolume = state.muted ? 0 : state.volume;
|
|
4091
4183
|
this.adController.setAdVolume(adVolume);
|
|
4092
4184
|
return [
|
|
4093
4185
|
3,
|
|
4094
|
-
|
|
4186
|
+
17
|
|
4095
4187
|
];
|
|
4096
|
-
case
|
|
4188
|
+
case 15:
|
|
4097
4189
|
error = _state.sent();
|
|
4098
4190
|
if (this.config.debugAdTiming) {
|
|
4099
4191
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
|
|
@@ -4103,13 +4195,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4103
4195
|
4,
|
|
4104
4196
|
this.tryNextAvailableAdWithRateLimit()
|
|
4105
4197
|
];
|
|
4106
|
-
case
|
|
4198
|
+
case 16:
|
|
4107
4199
|
_state.sent();
|
|
4108
4200
|
return [
|
|
4109
4201
|
3,
|
|
4110
|
-
|
|
4202
|
+
17
|
|
4111
4203
|
];
|
|
4112
|
-
case
|
|
4204
|
+
case 17:
|
|
4113
4205
|
return [
|
|
4114
4206
|
2
|
|
4115
4207
|
];
|