stormcloud-video-player 0.5.7 → 0.5.8
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 +109 -23
- 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 +109 -23
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +109 -23
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +2 -0
- package/lib/players/HlsPlayer.cjs +109 -23
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +109 -23
- 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 +109 -23
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/players/index.cjs
CHANGED
|
@@ -614,8 +614,8 @@ function createEmptyTrackingState() {
|
|
|
614
614
|
complete: false
|
|
615
615
|
};
|
|
616
616
|
}
|
|
617
|
-
function fireTrackingPixels(urls, sessionId
|
|
618
|
-
var logPrefix = arguments.length >
|
|
617
|
+
function fireTrackingPixels(urls, sessionId) {
|
|
618
|
+
var logPrefix = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "[VastParser]";
|
|
619
619
|
if (!urls || urls.length === 0) return;
|
|
620
620
|
urls.forEach(function(url) {
|
|
621
621
|
try {
|
|
@@ -623,10 +623,8 @@ function fireTrackingPixels(urls, sessionId, licenseKey) {
|
|
|
623
623
|
if (sessionId) {
|
|
624
624
|
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "session_id=").concat(sessionId);
|
|
625
625
|
}
|
|
626
|
-
if (licenseKey) {
|
|
627
|
-
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "license_key=").concat(licenseKey);
|
|
628
|
-
}
|
|
629
626
|
var img = new Image(1, 1);
|
|
627
|
+
img.onerror = function() {};
|
|
630
628
|
img.src = trackingUrl;
|
|
631
629
|
console.log("".concat(logPrefix, " Fired tracking pixel: ").concat(trackingUrl));
|
|
632
630
|
} catch (error) {
|
|
@@ -1027,7 +1025,7 @@ function createPrebidController(contentVideo, options) {
|
|
|
1027
1025
|
return "session-".concat(Date.now(), "-").concat(Math.random().toString(36).substr(2, 9));
|
|
1028
1026
|
}
|
|
1029
1027
|
function fireTrackingPixels2(urls) {
|
|
1030
|
-
fireTrackingPixels(urls, sessionId,
|
|
1028
|
+
fireTrackingPixels(urls, sessionId, LOG);
|
|
1031
1029
|
}
|
|
1032
1030
|
function getMainStreamQuality() {
|
|
1033
1031
|
if (!mainHlsInstance || !mainHlsInstance.levels) {
|
|
@@ -2764,6 +2762,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2764
2762
|
this.totalAdRequestsInBreak = 0;
|
|
2765
2763
|
this.maxTotalAdRequestsPerBreak = 20;
|
|
2766
2764
|
this.pendingAdBreak = null;
|
|
2765
|
+
this.prefetchAdPromise = null;
|
|
2766
|
+
this.savedMutedStateBeforeScte = null;
|
|
2767
2767
|
this.consecutiveFailures = 0;
|
|
2768
2768
|
this.maxConsecutiveFailures = 5;
|
|
2769
2769
|
this.lastAdRequestTime = 0;
|
|
@@ -3239,6 +3239,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3239
3239
|
}
|
|
3240
3240
|
}
|
|
3241
3241
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
3242
|
+
_this.adController.stop().catch(function() {});
|
|
3242
3243
|
_this.handleAdFailure();
|
|
3243
3244
|
});
|
|
3244
3245
|
this.adController.on("content_pause", function() {
|
|
@@ -3301,6 +3302,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3301
3302
|
{
|
|
3302
3303
|
key: "recreateAdController",
|
|
3303
3304
|
value: function recreateAdController() {
|
|
3305
|
+
this.prefetchAdPromise = null;
|
|
3304
3306
|
var shouldShowPlaceholder = this.inAdBreak && this.showAds;
|
|
3305
3307
|
if (shouldShowPlaceholder && this.adController) {
|
|
3306
3308
|
this.showPlaceholderLayer();
|
|
@@ -3629,6 +3631,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3629
3631
|
if (marker.type === "start") {
|
|
3630
3632
|
var _this_config_immediateManifestAds;
|
|
3631
3633
|
var _this_pendingAdBreak;
|
|
3634
|
+
this.savedMutedStateBeforeScte = {
|
|
3635
|
+
muted: this.video.muted,
|
|
3636
|
+
volume: this.video.volume
|
|
3637
|
+
};
|
|
3638
|
+
this.adController.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
3632
3639
|
if (!this.video.muted) {
|
|
3633
3640
|
this.video.muted = true;
|
|
3634
3641
|
this.video.volume = 0;
|
|
@@ -4070,6 +4077,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4070
4077
|
{
|
|
4071
4078
|
key: "startAdPrefetch",
|
|
4072
4079
|
value: function startAdPrefetch(marker, fragmentSn) {
|
|
4080
|
+
var _this = this;
|
|
4073
4081
|
if (this.pendingAdBreak || this.inAdBreak) {
|
|
4074
4082
|
return;
|
|
4075
4083
|
}
|
|
@@ -4081,8 +4089,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4081
4089
|
isFetching: false,
|
|
4082
4090
|
fetchStartTime: Date.now()
|
|
4083
4091
|
});
|
|
4092
|
+
this.prefetchAdPromise = this.adController.requestAds().catch(function() {
|
|
4093
|
+
if (_this.config.debugAdTiming) {
|
|
4094
|
+
console.log("[PREFETCH] Prebid auction prefetch failed, will request at playback time");
|
|
4095
|
+
}
|
|
4096
|
+
});
|
|
4084
4097
|
if (this.config.debugAdTiming) {
|
|
4085
|
-
console.log("[PREFETCH] Ad break marker registered, auction
|
|
4098
|
+
console.log("[PREFETCH] Ad break marker registered, auction prefetch started");
|
|
4086
4099
|
}
|
|
4087
4100
|
}
|
|
4088
4101
|
},
|
|
@@ -4093,6 +4106,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4093
4106
|
clearTimeout(this.prefetchTimerId);
|
|
4094
4107
|
this.prefetchTimerId = void 0;
|
|
4095
4108
|
}
|
|
4109
|
+
this.prefetchAdPromise = null;
|
|
4096
4110
|
this.pendingAdBreak = null;
|
|
4097
4111
|
}
|
|
4098
4112
|
},
|
|
@@ -4100,7 +4114,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4100
4114
|
key: "handleAdStart",
|
|
4101
4115
|
value: function handleAdStart(_marker) {
|
|
4102
4116
|
return _async_to_generator(function() {
|
|
4103
|
-
var adBreakDurationMs, mode,
|
|
4117
|
+
var _this_savedMutedStateBeforeScte, adBreakDurationMs, mode, state, unused, unused1, adLoadedInfo, adVolume, error;
|
|
4104
4118
|
return _ts_generator(this, function(_state) {
|
|
4105
4119
|
switch(_state.label){
|
|
4106
4120
|
case 0:
|
|
@@ -4113,9 +4127,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4113
4127
|
this.continuousFetchingActive = true;
|
|
4114
4128
|
this.isShowingPlaceholder = false;
|
|
4115
4129
|
this.totalAdRequestsInBreak = 0;
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4130
|
+
state = (_this_savedMutedStateBeforeScte = this.savedMutedStateBeforeScte) !== null && _this_savedMutedStateBeforeScte !== void 0 ? _this_savedMutedStateBeforeScte : {
|
|
4131
|
+
muted: this.video.muted,
|
|
4132
|
+
volume: this.video.volume
|
|
4133
|
+
};
|
|
4134
|
+
this.adController.updateOriginalMutedState(state.muted, state.volume);
|
|
4135
|
+
this.savedMutedStateBeforeScte = null;
|
|
4119
4136
|
if (!this.video.muted) {
|
|
4120
4137
|
this.video.muted = true;
|
|
4121
4138
|
this.video.volume = 0;
|
|
@@ -4134,25 +4151,94 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4134
4151
|
if (this.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
4135
4152
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
4136
4153
|
}
|
|
4137
|
-
this.clearPendingAdBreak();
|
|
4138
4154
|
if (this.config.debugAdTiming) {
|
|
4139
|
-
console.log("[CONTINUOUS-FETCH] \uD83D\uDCCB Prebid auction
|
|
4155
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDCCB Prebid auction (prefetch or requestAds)");
|
|
4140
4156
|
}
|
|
4141
4157
|
_state.label = 1;
|
|
4142
4158
|
case 1:
|
|
4143
4159
|
_state.trys.push([
|
|
4144
4160
|
1,
|
|
4145
|
-
|
|
4161
|
+
6,
|
|
4146
4162
|
,
|
|
4147
|
-
|
|
4163
|
+
12
|
|
4148
4164
|
]);
|
|
4149
4165
|
this.lastAdRequestTime = Date.now();
|
|
4166
|
+
if (!this.prefetchAdPromise) return [
|
|
4167
|
+
3,
|
|
4168
|
+
3
|
|
4169
|
+
];
|
|
4150
4170
|
return [
|
|
4151
4171
|
4,
|
|
4152
|
-
this.
|
|
4172
|
+
this.prefetchAdPromise
|
|
4153
4173
|
];
|
|
4154
4174
|
case 2:
|
|
4155
4175
|
_state.sent();
|
|
4176
|
+
this.prefetchAdPromise = null;
|
|
4177
|
+
return [
|
|
4178
|
+
3,
|
|
4179
|
+
5
|
|
4180
|
+
];
|
|
4181
|
+
case 3:
|
|
4182
|
+
return [
|
|
4183
|
+
4,
|
|
4184
|
+
this.adController.requestAds()
|
|
4185
|
+
];
|
|
4186
|
+
case 4:
|
|
4187
|
+
_state.sent();
|
|
4188
|
+
_state.label = 5;
|
|
4189
|
+
case 5:
|
|
4190
|
+
return [
|
|
4191
|
+
3,
|
|
4192
|
+
12
|
|
4193
|
+
];
|
|
4194
|
+
case 6:
|
|
4195
|
+
unused = _state.sent();
|
|
4196
|
+
_state.label = 7;
|
|
4197
|
+
case 7:
|
|
4198
|
+
_state.trys.push([
|
|
4199
|
+
7,
|
|
4200
|
+
9,
|
|
4201
|
+
,
|
|
4202
|
+
11
|
|
4203
|
+
]);
|
|
4204
|
+
return [
|
|
4205
|
+
4,
|
|
4206
|
+
this.adController.requestAds()
|
|
4207
|
+
];
|
|
4208
|
+
case 8:
|
|
4209
|
+
_state.sent();
|
|
4210
|
+
return [
|
|
4211
|
+
3,
|
|
4212
|
+
11
|
|
4213
|
+
];
|
|
4214
|
+
case 9:
|
|
4215
|
+
unused1 = _state.sent();
|
|
4216
|
+
this.clearPendingAdBreak();
|
|
4217
|
+
this.consecutiveFailures++;
|
|
4218
|
+
return [
|
|
4219
|
+
4,
|
|
4220
|
+
this.tryNextAvailableAdWithRateLimit()
|
|
4221
|
+
];
|
|
4222
|
+
case 10:
|
|
4223
|
+
_state.sent();
|
|
4224
|
+
return [
|
|
4225
|
+
2
|
|
4226
|
+
];
|
|
4227
|
+
case 11:
|
|
4228
|
+
return [
|
|
4229
|
+
3,
|
|
4230
|
+
12
|
|
4231
|
+
];
|
|
4232
|
+
case 12:
|
|
4233
|
+
this.clearPendingAdBreak();
|
|
4234
|
+
_state.label = 13;
|
|
4235
|
+
case 13:
|
|
4236
|
+
_state.trys.push([
|
|
4237
|
+
13,
|
|
4238
|
+
15,
|
|
4239
|
+
,
|
|
4240
|
+
17
|
|
4241
|
+
]);
|
|
4156
4242
|
if (this.config.licenseKey) {
|
|
4157
4243
|
adLoadedInfo = {
|
|
4158
4244
|
source: this.getAdSource(),
|
|
@@ -4169,19 +4255,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4169
4255
|
4,
|
|
4170
4256
|
this.adController.play()
|
|
4171
4257
|
];
|
|
4172
|
-
case
|
|
4258
|
+
case 14:
|
|
4173
4259
|
_state.sent();
|
|
4174
4260
|
if (this.expectedAdBreakDurationMs != null) {
|
|
4175
4261
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4176
4262
|
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4177
4263
|
}
|
|
4178
|
-
adVolume =
|
|
4264
|
+
adVolume = state.muted ? 0 : state.volume;
|
|
4179
4265
|
this.adController.setAdVolume(adVolume);
|
|
4180
4266
|
return [
|
|
4181
4267
|
3,
|
|
4182
|
-
|
|
4268
|
+
17
|
|
4183
4269
|
];
|
|
4184
|
-
case
|
|
4270
|
+
case 15:
|
|
4185
4271
|
error = _state.sent();
|
|
4186
4272
|
if (this.config.debugAdTiming) {
|
|
4187
4273
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
|
|
@@ -4191,13 +4277,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4191
4277
|
4,
|
|
4192
4278
|
this.tryNextAvailableAdWithRateLimit()
|
|
4193
4279
|
];
|
|
4194
|
-
case
|
|
4280
|
+
case 16:
|
|
4195
4281
|
_state.sent();
|
|
4196
4282
|
return [
|
|
4197
4283
|
3,
|
|
4198
|
-
|
|
4284
|
+
17
|
|
4199
4285
|
];
|
|
4200
|
-
case
|
|
4286
|
+
case 17:
|
|
4201
4287
|
return [
|
|
4202
4288
|
2
|
|
4203
4289
|
];
|