stormcloud-video-player 0.8.44 → 0.8.46
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 +88 -47
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +88 -47
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +36 -8
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +2 -1
- package/lib/player/AdConfigManager.d.cts +1 -1
- package/lib/player/AdTimingService.d.cts +1 -1
- package/lib/player/HlsEngine.cjs +18 -1
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +2 -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 +88 -47
- 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 +88 -47
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +88 -47
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +31 -38
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +88 -47
- 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
- package/lib/types-iDjS8f_7.d.cts +0 -133
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { a as StormcloudVideoPlayerConfig } from '../types-cTqIKw_D.cjs';
|
|
3
3
|
|
|
4
4
|
interface HlsPlayerProps extends StormcloudVideoPlayerConfig {
|
|
5
5
|
onMount?: (player: any) => void;
|
package/lib/players/index.cjs
CHANGED
|
@@ -1292,16 +1292,34 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
}, STALL_CHECK_INTERVAL_MS);
|
|
1294
1294
|
}
|
|
1295
|
+
function releaseAdDecoder() {
|
|
1296
|
+
if (adHls) {
|
|
1297
|
+
adHls.destroy();
|
|
1298
|
+
adHls = void 0;
|
|
1299
|
+
}
|
|
1300
|
+
if (adVideoElement) {
|
|
1301
|
+
adVideoElement.pause();
|
|
1302
|
+
adVideoElement.removeAttribute("src");
|
|
1303
|
+
try {
|
|
1304
|
+
adVideoElement.load();
|
|
1305
|
+
} catch (error) {
|
|
1306
|
+
console.warn("[HlsAdPlayer] adVideoElement.load() threw after src removal:", error);
|
|
1307
|
+
}
|
|
1308
|
+
adVideoElement.remove();
|
|
1309
|
+
adVideoElement = void 0;
|
|
1310
|
+
}
|
|
1311
|
+
if (adContainerEl) {
|
|
1312
|
+
adContainerEl.style.display = "none";
|
|
1313
|
+
adContainerEl.style.pointerEvents = "none";
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1295
1316
|
function handleAdComplete() {
|
|
1296
1317
|
console.log("[HlsAdPlayer] Handling ad completion");
|
|
1297
1318
|
clearStallWatchdog();
|
|
1298
1319
|
adPlaying = false;
|
|
1299
1320
|
setAdPlayingFlag(false);
|
|
1300
1321
|
contentVideo.muted = true;
|
|
1301
|
-
|
|
1302
|
-
adContainerEl.style.display = "none";
|
|
1303
|
-
adContainerEl.style.pointerEvents = "none";
|
|
1304
|
-
}
|
|
1322
|
+
releaseAdDecoder();
|
|
1305
1323
|
if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
1306
1324
|
contentVideo.style.visibility = "visible";
|
|
1307
1325
|
contentVideo.style.opacity = "1";
|
|
@@ -1309,7 +1327,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1309
1327
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
1310
1328
|
if (contentVideo.paused) {
|
|
1311
1329
|
console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback");
|
|
1312
|
-
contentVideo.play().catch(function() {
|
|
1330
|
+
contentVideo.play().catch(function(error) {
|
|
1331
|
+
console.error("[HlsAdPlayer] Error resuming content playback in live mode:", error);
|
|
1332
|
+
});
|
|
1313
1333
|
} else {
|
|
1314
1334
|
console.log("[HlsAdPlayer] Content video already playing in live mode");
|
|
1315
1335
|
}
|
|
@@ -1322,10 +1342,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1322
1342
|
adPlaying = false;
|
|
1323
1343
|
setAdPlayingFlag(false);
|
|
1324
1344
|
contentVideo.muted = true;
|
|
1325
|
-
|
|
1326
|
-
adContainerEl.style.display = "none";
|
|
1327
|
-
adContainerEl.style.pointerEvents = "none";
|
|
1328
|
-
}
|
|
1345
|
+
releaseAdDecoder();
|
|
1329
1346
|
if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
1330
1347
|
contentVideo.style.visibility = "visible";
|
|
1331
1348
|
contentVideo.style.opacity = "1";
|
|
@@ -1534,29 +1551,17 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1534
1551
|
contentVideo.muted = originalMutedState;
|
|
1535
1552
|
contentVideo.volume = Math.max(0, Math.min(1, originalVolume));
|
|
1536
1553
|
console.log("[HlsAdPlayer] Restored mute state on stop: ".concat(previousMutedState, " -> ").concat(originalMutedState, ", volume: ").concat(contentVideo.volume));
|
|
1537
|
-
|
|
1538
|
-
adContainerEl.style.display = "none";
|
|
1539
|
-
adContainerEl.style.pointerEvents = "none";
|
|
1540
|
-
}
|
|
1554
|
+
releaseAdDecoder();
|
|
1541
1555
|
contentVideo.style.visibility = "visible";
|
|
1542
1556
|
contentVideo.style.opacity = "1";
|
|
1543
1557
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
1544
1558
|
if (contentVideo.paused) {
|
|
1545
1559
|
console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback on stop");
|
|
1546
|
-
contentVideo.play().catch(function() {
|
|
1560
|
+
contentVideo.play().catch(function(error) {
|
|
1561
|
+
console.error("[HlsAdPlayer] Error resuming content playback in live mode on stop:", error);
|
|
1562
|
+
});
|
|
1547
1563
|
}
|
|
1548
1564
|
}
|
|
1549
|
-
if (adHls) {
|
|
1550
|
-
adHls.destroy();
|
|
1551
|
-
adHls = void 0;
|
|
1552
|
-
}
|
|
1553
|
-
if (adVideoElement) {
|
|
1554
|
-
adVideoElement.pause();
|
|
1555
|
-
adVideoElement.removeAttribute("src");
|
|
1556
|
-
try {
|
|
1557
|
-
adVideoElement.load();
|
|
1558
|
-
} catch (unused) {}
|
|
1559
|
-
}
|
|
1560
1565
|
currentAd = void 0;
|
|
1561
1566
|
podAds = [];
|
|
1562
1567
|
podIndex = 0;
|
|
@@ -1595,19 +1600,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1595
1600
|
setAdPlayingFlag(false);
|
|
1596
1601
|
contentVideo.muted = originalMutedState;
|
|
1597
1602
|
contentVideo.volume = Math.max(0, Math.min(1, originalVolume));
|
|
1598
|
-
|
|
1599
|
-
adHls.destroy();
|
|
1600
|
-
adHls = void 0;
|
|
1601
|
-
}
|
|
1602
|
-
if (adVideoElement) {
|
|
1603
|
-
adVideoElement.pause();
|
|
1604
|
-
adVideoElement.removeAttribute("src");
|
|
1605
|
-
try {
|
|
1606
|
-
adVideoElement.load();
|
|
1607
|
-
} catch (unused) {}
|
|
1608
|
-
adVideoElement.remove();
|
|
1609
|
-
adVideoElement = void 0;
|
|
1610
|
-
}
|
|
1603
|
+
releaseAdDecoder();
|
|
1611
1604
|
if (adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.parentElement) {
|
|
1612
1605
|
adContainerEl.parentElement.removeChild(adContainerEl);
|
|
1613
1606
|
}
|
|
@@ -6767,6 +6760,21 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6767
6760
|
}
|
|
6768
6761
|
}
|
|
6769
6762
|
},
|
|
6763
|
+
{
|
|
6764
|
+
key: "recoverMediaError",
|
|
6765
|
+
value: function recoverMediaError() {
|
|
6766
|
+
if (!this.hls) {
|
|
6767
|
+
return;
|
|
6768
|
+
}
|
|
6769
|
+
try {
|
|
6770
|
+
this.hls.recoverMediaError();
|
|
6771
|
+
} catch (error) {
|
|
6772
|
+
if (this.debug) {
|
|
6773
|
+
console.warn("[StormcloudVideoPlayer] recoverMediaError() failed:", error);
|
|
6774
|
+
}
|
|
6775
|
+
}
|
|
6776
|
+
}
|
|
6777
|
+
},
|
|
6770
6778
|
{
|
|
6771
6779
|
key: "reloadLiveStream",
|
|
6772
6780
|
value: function reloadLiveStream() {
|
|
@@ -6784,7 +6792,9 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6784
6792
|
try {
|
|
6785
6793
|
this.video.removeAttribute("src");
|
|
6786
6794
|
this.video.load();
|
|
6787
|
-
} catch (
|
|
6795
|
+
} catch (error) {
|
|
6796
|
+
console.warn("[StormcloudVideoPlayer] video.load() threw after src removal:", error);
|
|
6797
|
+
}
|
|
6788
6798
|
hls.attachMedia(this.video);
|
|
6789
6799
|
} catch (error) {
|
|
6790
6800
|
this.reloadingLiveStream = false;
|
|
@@ -8168,8 +8178,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8168
8178
|
var pollIntervalMs = 1e3;
|
|
8169
8179
|
var graceMs = 5e3;
|
|
8170
8180
|
var recoveryCooldownMs = 5e3;
|
|
8171
|
-
var maxRecoveries =
|
|
8172
|
-
var maxMonitorMs =
|
|
8181
|
+
var maxRecoveries = 3;
|
|
8182
|
+
var maxMonitorMs = 45e3;
|
|
8173
8183
|
var startTime = Date.now();
|
|
8174
8184
|
var baseline = resumeBaseline;
|
|
8175
8185
|
var recoveries = 0;
|
|
@@ -8281,8 +8291,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8281
8291
|
if (canRecover) {
|
|
8282
8292
|
recoveries++;
|
|
8283
8293
|
lastRecoveryAt = Date.now();
|
|
8284
|
-
|
|
8285
|
-
|
|
8294
|
+
if (recoveries === 1) {
|
|
8295
|
+
if (_this.debug) {
|
|
8296
|
+
console.warn("[StormcloudVideoPlayer] Content wedged after ad break — calling recoverMediaError() (recovery ".concat(recoveries, "/").concat(maxRecoveries, ") — ").concat(_this.describeVideoState()));
|
|
8297
|
+
}
|
|
8298
|
+
_this.host.recoverMediaError();
|
|
8299
|
+
} else if (recoveries === 2) {
|
|
8286
8300
|
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
8287
8301
|
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
8288
8302
|
if (_this.debug) {
|
|
@@ -8314,17 +8328,41 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8314
8328
|
value: function resumeContentPlayback() {
|
|
8315
8329
|
var _this = this;
|
|
8316
8330
|
var attempt = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
8317
|
-
var maxAttempts =
|
|
8318
|
-
|
|
8331
|
+
var maxAttempts = 5;
|
|
8332
|
+
var video = this.host.video;
|
|
8333
|
+
if (!video.paused) {
|
|
8319
8334
|
if (this.debug && attempt === 0) {
|
|
8320
8335
|
console.log("[StormcloudVideoPlayer] Content video already playing after ads");
|
|
8321
8336
|
}
|
|
8322
8337
|
return;
|
|
8323
8338
|
}
|
|
8324
8339
|
if (this.debug) {
|
|
8325
|
-
console.log("[StormcloudVideoPlayer] Resuming content playback after ads (attempt ".concat(attempt + 1, "/").concat(maxAttempts, ")"));
|
|
8340
|
+
console.log("[StormcloudVideoPlayer] Resuming content playback after ads (attempt ".concat(attempt + 1, "/").concat(maxAttempts, ", readyState=").concat(video.readyState, ")"));
|
|
8326
8341
|
}
|
|
8327
|
-
|
|
8342
|
+
if (video.readyState < 3) {
|
|
8343
|
+
if (attempt + 1 >= maxAttempts) {
|
|
8344
|
+
var _video_play;
|
|
8345
|
+
if (this.debug) {
|
|
8346
|
+
console.warn("[StormcloudVideoPlayer] readyState never reached HAVE_FUTURE_DATA, forcing play()");
|
|
8347
|
+
}
|
|
8348
|
+
(_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
|
|
8349
|
+
return;
|
|
8350
|
+
}
|
|
8351
|
+
var onReady = function onReady1() {
|
|
8352
|
+
video.removeEventListener("canplay", onReady);
|
|
8353
|
+
_this.resumeContentPlayback(attempt + 1);
|
|
8354
|
+
};
|
|
8355
|
+
video.addEventListener("canplay", onReady);
|
|
8356
|
+
var backoffMs = 500 * (attempt + 1);
|
|
8357
|
+
window.setTimeout(function() {
|
|
8358
|
+
video.removeEventListener("canplay", onReady);
|
|
8359
|
+
if (video.paused) {
|
|
8360
|
+
_this.resumeContentPlayback(attempt + 1);
|
|
8361
|
+
}
|
|
8362
|
+
}, backoffMs);
|
|
8363
|
+
return;
|
|
8364
|
+
}
|
|
8365
|
+
var playResult = video.play();
|
|
8328
8366
|
if (playResult && typeof playResult.catch === "function") {
|
|
8329
8367
|
playResult.catch(function(error) {
|
|
8330
8368
|
if (attempt + 1 >= maxAttempts) {
|
|
@@ -8463,6 +8501,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8463
8501
|
reloadLiveStream: function reloadLiveStream() {
|
|
8464
8502
|
return _this.hlsEngine.reloadLiveStream();
|
|
8465
8503
|
},
|
|
8504
|
+
recoverMediaError: function recoverMediaError() {
|
|
8505
|
+
return _this.hlsEngine.recoverMediaError();
|
|
8506
|
+
},
|
|
8466
8507
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8467
8508
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
8468
8509
|
}
|