stormcloud-video-player 0.8.42 → 0.8.44
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 +172 -20
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +172 -20
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +132 -20
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +3 -1
- package/lib/player/AdConfigManager.d.cts +1 -1
- package/lib/player/AdTimingService.d.cts +1 -1
- package/lib/player/HlsEngine.cjs +29 -0
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +3 -1
- package/lib/player/PlayerControls.d.cts +1 -1
- package/lib/player/Scte35CueManager.d.cts +1 -1
- package/lib/player/Scte35Parser.d.cts +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +172 -20
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/player/playerTypes.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +172 -20
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +172 -20
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/types-iDjS8f_7.d.cts +133 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +172 -20
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AdController } from '../types-
|
|
1
|
+
import { A as AdController } from '../types-iDjS8f_7.cjs';
|
|
2
2
|
|
|
3
3
|
declare function getAdAudioVolume(adPlayer: AdController): number;
|
|
4
4
|
declare function toggleMute(video: HTMLVideoElement, adPlayer: AdController, debug: boolean): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as Scte35Marker, I as Id3TagInfo } from '../types-iDjS8f_7.cjs';
|
|
2
2
|
|
|
3
3
|
declare function parseCueOutDuration(value: string): number | undefined;
|
|
4
4
|
declare function parseCueOutCont(value: string): {
|
|
@@ -6201,6 +6201,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6201
6201
|
this.isLiveStream = false;
|
|
6202
6202
|
this.nativeHlsMode = false;
|
|
6203
6203
|
this.videoSrcProtection = null;
|
|
6204
|
+
this.reloadingLiveStream = false;
|
|
6204
6205
|
this.bufferedSegmentsCount = 0;
|
|
6205
6206
|
this.shouldAutoplayAfterBuffering = false;
|
|
6206
6207
|
this.hasInitialBufferCompleted = false;
|
|
@@ -6334,6 +6335,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6334
6335
|
_state.sent();
|
|
6335
6336
|
_state.label = 3;
|
|
6336
6337
|
case 3:
|
|
6338
|
+
this.reloadingLiveStream = false;
|
|
6337
6339
|
return [
|
|
6338
6340
|
2
|
|
6339
6341
|
];
|
|
@@ -6678,6 +6680,33 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6678
6680
|
}
|
|
6679
6681
|
}
|
|
6680
6682
|
},
|
|
6683
|
+
{
|
|
6684
|
+
key: "reloadLiveStream",
|
|
6685
|
+
value: function reloadLiveStream() {
|
|
6686
|
+
var hls = this.hls;
|
|
6687
|
+
if (!hls) {
|
|
6688
|
+
return;
|
|
6689
|
+
}
|
|
6690
|
+
if (this.debug) {
|
|
6691
|
+
console.log("[StormcloudVideoPlayer] Hard-reloading live stream (detach \u2192 reset video \u2192 re-attach)");
|
|
6692
|
+
}
|
|
6693
|
+
try {
|
|
6694
|
+
this.reloadingLiveStream = true;
|
|
6695
|
+
hls.stopLoad();
|
|
6696
|
+
hls.detachMedia();
|
|
6697
|
+
try {
|
|
6698
|
+
this.video.removeAttribute("src");
|
|
6699
|
+
this.video.load();
|
|
6700
|
+
} catch (unused) {}
|
|
6701
|
+
hls.attachMedia(this.video);
|
|
6702
|
+
} catch (error) {
|
|
6703
|
+
this.reloadingLiveStream = false;
|
|
6704
|
+
if (this.debug) {
|
|
6705
|
+
console.warn("[StormcloudVideoPlayer] Failed to hard-reload live stream:", error);
|
|
6706
|
+
}
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
},
|
|
6681
6710
|
{
|
|
6682
6711
|
key: "destroy",
|
|
6683
6712
|
value: function destroy() {
|
|
@@ -8017,31 +8046,134 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8017
8046
|
return 0;
|
|
8018
8047
|
}
|
|
8019
8048
|
},
|
|
8049
|
+
{
|
|
8050
|
+
key: "describeVideoState",
|
|
8051
|
+
value: function describeVideoState() {
|
|
8052
|
+
var _networkStates_v_networkState, _readyStates_v_readyState;
|
|
8053
|
+
var v = this.host.video;
|
|
8054
|
+
var networkStates = [
|
|
8055
|
+
"EMPTY",
|
|
8056
|
+
"IDLE",
|
|
8057
|
+
"LOADING",
|
|
8058
|
+
"NO_SOURCE"
|
|
8059
|
+
];
|
|
8060
|
+
var readyStates = [
|
|
8061
|
+
"HAVE_NOTHING",
|
|
8062
|
+
"HAVE_METADATA",
|
|
8063
|
+
"HAVE_CURRENT_DATA",
|
|
8064
|
+
"HAVE_FUTURE_DATA",
|
|
8065
|
+
"HAVE_ENOUGH_DATA"
|
|
8066
|
+
];
|
|
8067
|
+
var net = (_networkStates_v_networkState = networkStates[v.networkState]) !== null && _networkStates_v_networkState !== void 0 ? _networkStates_v_networkState : String(v.networkState);
|
|
8068
|
+
var ready = (_readyStates_v_readyState = readyStates[v.readyState]) !== null && _readyStates_v_readyState !== void 0 ? _readyStates_v_readyState : String(v.readyState);
|
|
8069
|
+
var err = v.error ? "code=".concat(v.error.code).concat(v.error.message ? " (".concat(v.error.message, ")") : "") : "none";
|
|
8070
|
+
var ranges = [];
|
|
8071
|
+
for(var i = 0; i < v.buffered.length; i++){
|
|
8072
|
+
ranges.push("[".concat(v.buffered.start(i).toFixed(2), "–").concat(v.buffered.end(i).toFixed(2), "]"));
|
|
8073
|
+
}
|
|
8074
|
+
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");
|
|
8075
|
+
}
|
|
8076
|
+
},
|
|
8020
8077
|
{
|
|
8021
8078
|
key: "monitorLiveResumeStall",
|
|
8022
8079
|
value: function monitorLiveResumeStall(resumeBaseline) {
|
|
8023
8080
|
var _this = this;
|
|
8024
8081
|
var pollIntervalMs = 1e3;
|
|
8025
8082
|
var graceMs = 5e3;
|
|
8026
|
-
var
|
|
8027
|
-
var
|
|
8028
|
-
var maxMonitorMs =
|
|
8083
|
+
var recoveryCooldownMs = 5e3;
|
|
8084
|
+
var maxRecoveries = 2;
|
|
8085
|
+
var maxMonitorMs = 3e4;
|
|
8029
8086
|
var startTime = Date.now();
|
|
8030
8087
|
var baseline = resumeBaseline;
|
|
8031
|
-
var
|
|
8032
|
-
var
|
|
8088
|
+
var recoveries = 0;
|
|
8089
|
+
var lastRecoveryAt = 0;
|
|
8090
|
+
var video = this.host.video;
|
|
8091
|
+
var listenersAttached = false;
|
|
8092
|
+
var onMediaEvent;
|
|
8093
|
+
var diagEvents = [
|
|
8094
|
+
"loadstart",
|
|
8095
|
+
"loadedmetadata",
|
|
8096
|
+
"loadeddata",
|
|
8097
|
+
"canplay",
|
|
8098
|
+
"canplaythrough",
|
|
8099
|
+
"play",
|
|
8100
|
+
"playing",
|
|
8101
|
+
"pause",
|
|
8102
|
+
"waiting",
|
|
8103
|
+
"stalled",
|
|
8104
|
+
"suspend",
|
|
8105
|
+
"seeking",
|
|
8106
|
+
"seeked",
|
|
8107
|
+
"emptied",
|
|
8108
|
+
"error",
|
|
8109
|
+
"ended"
|
|
8110
|
+
];
|
|
8111
|
+
if (this.debug) {
|
|
8112
|
+
onMediaEvent = function onMediaEvent(e) {
|
|
8113
|
+
var dt = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
8114
|
+
console.log("[ResumeDiag] +".concat(dt, "s event=").concat(e.type, " — ").concat(_this.describeVideoState()));
|
|
8115
|
+
};
|
|
8116
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8117
|
+
try {
|
|
8118
|
+
for(var _iterator = diagEvents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8119
|
+
var name = _step.value;
|
|
8120
|
+
video.addEventListener(name, onMediaEvent);
|
|
8121
|
+
}
|
|
8122
|
+
} catch (err) {
|
|
8123
|
+
_didIteratorError = true;
|
|
8124
|
+
_iteratorError = err;
|
|
8125
|
+
} finally{
|
|
8126
|
+
try {
|
|
8127
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8128
|
+
_iterator.return();
|
|
8129
|
+
}
|
|
8130
|
+
} finally{
|
|
8131
|
+
if (_didIteratorError) {
|
|
8132
|
+
throw _iteratorError;
|
|
8133
|
+
}
|
|
8134
|
+
}
|
|
8135
|
+
}
|
|
8136
|
+
listenersAttached = true;
|
|
8137
|
+
console.log("[ResumeDiag] +0.0s monitor start — ".concat(this.describeVideoState()));
|
|
8138
|
+
}
|
|
8139
|
+
var cleanup = function cleanup() {
|
|
8140
|
+
if (listenersAttached && onMediaEvent) {
|
|
8141
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8142
|
+
try {
|
|
8143
|
+
for(var _iterator = diagEvents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8144
|
+
var name = _step.value;
|
|
8145
|
+
video.removeEventListener(name, onMediaEvent);
|
|
8146
|
+
}
|
|
8147
|
+
} catch (err) {
|
|
8148
|
+
_didIteratorError = true;
|
|
8149
|
+
_iteratorError = err;
|
|
8150
|
+
} finally{
|
|
8151
|
+
try {
|
|
8152
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8153
|
+
_iterator.return();
|
|
8154
|
+
}
|
|
8155
|
+
} finally{
|
|
8156
|
+
if (_didIteratorError) {
|
|
8157
|
+
throw _iteratorError;
|
|
8158
|
+
}
|
|
8159
|
+
}
|
|
8160
|
+
}
|
|
8161
|
+
listenersAttached = false;
|
|
8162
|
+
}
|
|
8163
|
+
};
|
|
8033
8164
|
var poll = function poll1() {
|
|
8034
8165
|
if (_this.inAdBreak) {
|
|
8166
|
+
cleanup();
|
|
8035
8167
|
return;
|
|
8036
8168
|
}
|
|
8037
|
-
var video = _this.host.video;
|
|
8038
8169
|
var currentTime = video.currentTime;
|
|
8039
8170
|
var advanced = currentTime > baseline + 0.5;
|
|
8040
8171
|
var playing = !video.paused && video.readyState >= 3;
|
|
8041
8172
|
if (advanced && playing) {
|
|
8042
8173
|
if (_this.debug) {
|
|
8043
|
-
console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break");
|
|
8174
|
+
console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break — ".concat(_this.describeVideoState()));
|
|
8044
8175
|
}
|
|
8176
|
+
cleanup();
|
|
8045
8177
|
return;
|
|
8046
8178
|
}
|
|
8047
8179
|
if (video.paused) {
|
|
@@ -8053,23 +8185,32 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8053
8185
|
var wedged = bufferedAhead < 0.5 && !advanced;
|
|
8054
8186
|
if (elapsed >= maxMonitorMs) {
|
|
8055
8187
|
if (_this.debug && !advanced) {
|
|
8056
|
-
console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat((maxMonitorMs / 1e3).toFixed(0), "s
|
|
8188
|
+
console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat((maxMonitorMs / 1e3).toFixed(0), "s — ").concat(_this.describeVideoState()));
|
|
8057
8189
|
}
|
|
8190
|
+
cleanup();
|
|
8058
8191
|
return;
|
|
8059
8192
|
}
|
|
8060
|
-
var
|
|
8061
|
-
if (
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
var
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8193
|
+
var canRecover = wedged && elapsed >= graceMs && Date.now() - lastRecoveryAt >= recoveryCooldownMs && recoveries < maxRecoveries;
|
|
8194
|
+
if (canRecover) {
|
|
8195
|
+
recoveries++;
|
|
8196
|
+
lastRecoveryAt = Date.now();
|
|
8197
|
+
var isFinalAttempt = recoveries >= maxRecoveries;
|
|
8198
|
+
if (!isFinalAttempt) {
|
|
8199
|
+
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
8200
|
+
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
8201
|
+
if (_this.debug) {
|
|
8202
|
+
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()));
|
|
8203
|
+
}
|
|
8204
|
+
if (liveSyncPos != null && liveSyncPos > currentTime) {
|
|
8205
|
+
video.currentTime = liveSyncPos;
|
|
8206
|
+
}
|
|
8207
|
+
_this.host.restartHlsLoad(reloadPos);
|
|
8208
|
+
} else {
|
|
8209
|
+
if (_this.debug) {
|
|
8210
|
+
console.warn("[StormcloudVideoPlayer] Content still wedged after ad break — hard-reloading live stream (recovery ".concat(recoveries, "/").concat(maxRecoveries, ") — ").concat(_this.describeVideoState()));
|
|
8211
|
+
}
|
|
8212
|
+
_this.host.reloadLiveStream();
|
|
8071
8213
|
}
|
|
8072
|
-
_this.host.restartHlsLoad(reloadPos);
|
|
8073
8214
|
baseline = video.currentTime;
|
|
8074
8215
|
if (video.paused) {
|
|
8075
8216
|
var _video_play1;
|
|
@@ -8232,6 +8373,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8232
8373
|
restartHlsLoad: function restartHlsLoad(position) {
|
|
8233
8374
|
return _this.hlsEngine.restartLoadAt(position);
|
|
8234
8375
|
},
|
|
8376
|
+
reloadLiveStream: function reloadLiveStream() {
|
|
8377
|
+
return _this.hlsEngine.reloadLiveStream();
|
|
8378
|
+
},
|
|
8235
8379
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8236
8380
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
8237
8381
|
}
|
|
@@ -8363,6 +8507,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8363
8507
|
return _async_to_generator(function() {
|
|
8364
8508
|
var prerollKey, adBehavior;
|
|
8365
8509
|
return _ts_generator(this, function(_state) {
|
|
8510
|
+
if (this.hlsEngine.reloadingLiveStream) {
|
|
8511
|
+
if (this.debug) {
|
|
8512
|
+
console.log("[StormcloudVideoPlayer] Manifest re-parsed after hard reload \u2014 skipping ad-player setup");
|
|
8513
|
+
}
|
|
8514
|
+
return [
|
|
8515
|
+
2
|
|
8516
|
+
];
|
|
8517
|
+
}
|
|
8366
8518
|
if (!this.adConfig.isVmapEnabled() && !isLive && this.adConfig.vmapBreaks.length === 0 && this.adConfig.apiVastTagUrl) {
|
|
8367
8519
|
prerollKey = "synthetic-vod-preroll";
|
|
8368
8520
|
if (!this.adConfig.consumedVmapBreakIds.has(prerollKey)) {
|