stormcloud-video-player 0.8.43 → 0.8.45
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 +115 -7
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +115 -7
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +109 -5
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +115 -7
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +115 -7
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +115 -7
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +6 -2
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +115 -7
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -1273,7 +1273,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1273
1273
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
1274
1274
|
if (contentVideo.paused) {
|
|
1275
1275
|
console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback");
|
|
1276
|
-
contentVideo.play().catch(function() {
|
|
1276
|
+
contentVideo.play().catch(function(error) {
|
|
1277
|
+
console.error("[HlsAdPlayer] Error resuming content playback in live mode:", error);
|
|
1278
|
+
});
|
|
1277
1279
|
} else {
|
|
1278
1280
|
console.log("[HlsAdPlayer] Content video already playing in live mode");
|
|
1279
1281
|
}
|
|
@@ -1507,7 +1509,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1507
1509
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
1508
1510
|
if (contentVideo.paused) {
|
|
1509
1511
|
console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback on stop");
|
|
1510
|
-
contentVideo.play().catch(function() {
|
|
1512
|
+
contentVideo.play().catch(function(error) {
|
|
1513
|
+
console.error("[HlsAdPlayer] Error resuming content playback in live mode on stop:", error);
|
|
1514
|
+
});
|
|
1511
1515
|
}
|
|
1512
1516
|
}
|
|
1513
1517
|
if (adHls) {
|
|
@@ -8097,6 +8101,34 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8097
8101
|
return 0;
|
|
8098
8102
|
}
|
|
8099
8103
|
},
|
|
8104
|
+
{
|
|
8105
|
+
key: "describeVideoState",
|
|
8106
|
+
value: function describeVideoState() {
|
|
8107
|
+
var _networkStates_v_networkState, _readyStates_v_readyState;
|
|
8108
|
+
var v = this.host.video;
|
|
8109
|
+
var networkStates = [
|
|
8110
|
+
"EMPTY",
|
|
8111
|
+
"IDLE",
|
|
8112
|
+
"LOADING",
|
|
8113
|
+
"NO_SOURCE"
|
|
8114
|
+
];
|
|
8115
|
+
var readyStates = [
|
|
8116
|
+
"HAVE_NOTHING",
|
|
8117
|
+
"HAVE_METADATA",
|
|
8118
|
+
"HAVE_CURRENT_DATA",
|
|
8119
|
+
"HAVE_FUTURE_DATA",
|
|
8120
|
+
"HAVE_ENOUGH_DATA"
|
|
8121
|
+
];
|
|
8122
|
+
var net = (_networkStates_v_networkState = networkStates[v.networkState]) !== null && _networkStates_v_networkState !== void 0 ? _networkStates_v_networkState : String(v.networkState);
|
|
8123
|
+
var ready = (_readyStates_v_readyState = readyStates[v.readyState]) !== null && _readyStates_v_readyState !== void 0 ? _readyStates_v_readyState : String(v.readyState);
|
|
8124
|
+
var err = v.error ? "code=".concat(v.error.code).concat(v.error.message ? " (".concat(v.error.message, ")") : "") : "none";
|
|
8125
|
+
var ranges = [];
|
|
8126
|
+
for(var i = 0; i < v.buffered.length; i++){
|
|
8127
|
+
ranges.push("[".concat(v.buffered.start(i).toFixed(2), "–").concat(v.buffered.end(i).toFixed(2), "]"));
|
|
8128
|
+
}
|
|
8129
|
+
return "t=".concat(v.currentTime.toFixed(2), "s paused=").concat(v.paused, " ended=").concat(v.ended, " seeking=").concat(v.seeking, " readyState=").concat(ready, " networkState=").concat(net, " error=").concat(err, " buffered=").concat(ranges.length ? ranges.join(",") : "none");
|
|
8130
|
+
}
|
|
8131
|
+
},
|
|
8100
8132
|
{
|
|
8101
8133
|
key: "monitorLiveResumeStall",
|
|
8102
8134
|
value: function monitorLiveResumeStall(resumeBaseline) {
|
|
@@ -8110,18 +8142,93 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8110
8142
|
var baseline = resumeBaseline;
|
|
8111
8143
|
var recoveries = 0;
|
|
8112
8144
|
var lastRecoveryAt = 0;
|
|
8145
|
+
var video = this.host.video;
|
|
8146
|
+
var listenersAttached = false;
|
|
8147
|
+
var onMediaEvent;
|
|
8148
|
+
var diagEvents = [
|
|
8149
|
+
"loadstart",
|
|
8150
|
+
"loadedmetadata",
|
|
8151
|
+
"loadeddata",
|
|
8152
|
+
"canplay",
|
|
8153
|
+
"canplaythrough",
|
|
8154
|
+
"play",
|
|
8155
|
+
"playing",
|
|
8156
|
+
"pause",
|
|
8157
|
+
"waiting",
|
|
8158
|
+
"stalled",
|
|
8159
|
+
"suspend",
|
|
8160
|
+
"seeking",
|
|
8161
|
+
"seeked",
|
|
8162
|
+
"emptied",
|
|
8163
|
+
"error",
|
|
8164
|
+
"ended"
|
|
8165
|
+
];
|
|
8166
|
+
if (this.debug) {
|
|
8167
|
+
onMediaEvent = function onMediaEvent(e) {
|
|
8168
|
+
var dt = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
8169
|
+
console.log("[ResumeDiag] +".concat(dt, "s event=").concat(e.type, " — ").concat(_this.describeVideoState()));
|
|
8170
|
+
};
|
|
8171
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8172
|
+
try {
|
|
8173
|
+
for(var _iterator = diagEvents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8174
|
+
var name = _step.value;
|
|
8175
|
+
video.addEventListener(name, onMediaEvent);
|
|
8176
|
+
}
|
|
8177
|
+
} catch (err) {
|
|
8178
|
+
_didIteratorError = true;
|
|
8179
|
+
_iteratorError = err;
|
|
8180
|
+
} finally{
|
|
8181
|
+
try {
|
|
8182
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8183
|
+
_iterator.return();
|
|
8184
|
+
}
|
|
8185
|
+
} finally{
|
|
8186
|
+
if (_didIteratorError) {
|
|
8187
|
+
throw _iteratorError;
|
|
8188
|
+
}
|
|
8189
|
+
}
|
|
8190
|
+
}
|
|
8191
|
+
listenersAttached = true;
|
|
8192
|
+
console.log("[ResumeDiag] +0.0s monitor start — ".concat(this.describeVideoState()));
|
|
8193
|
+
}
|
|
8194
|
+
var cleanup = function cleanup() {
|
|
8195
|
+
if (listenersAttached && onMediaEvent) {
|
|
8196
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8197
|
+
try {
|
|
8198
|
+
for(var _iterator = diagEvents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8199
|
+
var name = _step.value;
|
|
8200
|
+
video.removeEventListener(name, onMediaEvent);
|
|
8201
|
+
}
|
|
8202
|
+
} catch (err) {
|
|
8203
|
+
_didIteratorError = true;
|
|
8204
|
+
_iteratorError = err;
|
|
8205
|
+
} finally{
|
|
8206
|
+
try {
|
|
8207
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8208
|
+
_iterator.return();
|
|
8209
|
+
}
|
|
8210
|
+
} finally{
|
|
8211
|
+
if (_didIteratorError) {
|
|
8212
|
+
throw _iteratorError;
|
|
8213
|
+
}
|
|
8214
|
+
}
|
|
8215
|
+
}
|
|
8216
|
+
listenersAttached = false;
|
|
8217
|
+
}
|
|
8218
|
+
};
|
|
8113
8219
|
var poll = function poll1() {
|
|
8114
8220
|
if (_this.inAdBreak) {
|
|
8221
|
+
cleanup();
|
|
8115
8222
|
return;
|
|
8116
8223
|
}
|
|
8117
|
-
var video = _this.host.video;
|
|
8118
8224
|
var currentTime = video.currentTime;
|
|
8119
8225
|
var advanced = currentTime > baseline + 0.5;
|
|
8120
8226
|
var playing = !video.paused && video.readyState >= 3;
|
|
8121
8227
|
if (advanced && playing) {
|
|
8122
8228
|
if (_this.debug) {
|
|
8123
|
-
console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break");
|
|
8229
|
+
console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break — ".concat(_this.describeVideoState()));
|
|
8124
8230
|
}
|
|
8231
|
+
cleanup();
|
|
8125
8232
|
return;
|
|
8126
8233
|
}
|
|
8127
8234
|
if (video.paused) {
|
|
@@ -8133,8 +8240,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8133
8240
|
var wedged = bufferedAhead < 0.5 && !advanced;
|
|
8134
8241
|
if (elapsed >= maxMonitorMs) {
|
|
8135
8242
|
if (_this.debug && !advanced) {
|
|
8136
|
-
console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat((maxMonitorMs / 1e3).toFixed(0), "s
|
|
8243
|
+
console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat((maxMonitorMs / 1e3).toFixed(0), "s — ").concat(_this.describeVideoState()));
|
|
8137
8244
|
}
|
|
8245
|
+
cleanup();
|
|
8138
8246
|
return;
|
|
8139
8247
|
}
|
|
8140
8248
|
var canRecover = wedged && elapsed >= graceMs && Date.now() - lastRecoveryAt >= recoveryCooldownMs && recoveries < maxRecoveries;
|
|
@@ -8146,7 +8254,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8146
8254
|
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
8147
8255
|
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
8148
8256
|
if (_this.debug) {
|
|
8149
|
-
console.warn("[StormcloudVideoPlayer] Content wedged after ad break
|
|
8257
|
+
console.warn("[StormcloudVideoPlayer] Content wedged after ad break — restarting HLS load at ".concat(reloadPos.toFixed(2), "s (recovery ").concat(recoveries, "/").concat(maxRecoveries, ") — ").concat(_this.describeVideoState()));
|
|
8150
8258
|
}
|
|
8151
8259
|
if (liveSyncPos != null && liveSyncPos > currentTime) {
|
|
8152
8260
|
video.currentTime = liveSyncPos;
|
|
@@ -8154,7 +8262,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8154
8262
|
_this.host.restartHlsLoad(reloadPos);
|
|
8155
8263
|
} else {
|
|
8156
8264
|
if (_this.debug) {
|
|
8157
|
-
console.warn("[StormcloudVideoPlayer] Content still wedged after ad break
|
|
8265
|
+
console.warn("[StormcloudVideoPlayer] Content still wedged after ad break — hard-reloading live stream (recovery ".concat(recoveries, "/").concat(maxRecoveries, ") — ").concat(_this.describeVideoState()));
|
|
8158
8266
|
}
|
|
8159
8267
|
_this.host.reloadLiveStream();
|
|
8160
8268
|
}
|