stormcloud-video-player 0.8.53 → 0.8.54
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 +80 -9
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +80 -9
- package/lib/index.js.map +1 -1
- package/lib/player/HlsEngine.cjs +74 -9
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +5 -0
- package/lib/player/StormcloudVideoPlayer.cjs +80 -9
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/players/HlsPlayer.cjs +80 -9
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +80 -9
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +80 -9
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/player/HlsEngine.cjs
CHANGED
|
@@ -1036,6 +1036,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
1036
1036
|
this.bufferedSegmentsCount = 0;
|
|
1037
1037
|
this.shouldAutoplayAfterBuffering = false;
|
|
1038
1038
|
this.hasInitialBufferCompleted = false;
|
|
1039
|
+
this.latencyProfileApplied = false;
|
|
1039
1040
|
this.config = config;
|
|
1040
1041
|
this.video = video;
|
|
1041
1042
|
this.cueManager = cueManager;
|
|
@@ -1104,24 +1105,21 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
1104
1105
|
key: "setupHls",
|
|
1105
1106
|
value: function setupHls() {
|
|
1106
1107
|
var _this = this;
|
|
1107
|
-
this.hls = new import_hls.default(
|
|
1108
|
+
this.hls = new import_hls.default({
|
|
1108
1109
|
enableWorker: true,
|
|
1109
1110
|
backBufferLength: 30,
|
|
1110
1111
|
liveDurationInfinity: true,
|
|
1111
1112
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
1112
|
-
maxLiveSyncPlaybackRate:
|
|
1113
|
-
}, this.config.lowLatencyMode ? {
|
|
1114
|
-
liveSyncDuration: 2
|
|
1115
|
-
} : {}), {
|
|
1113
|
+
maxLiveSyncPlaybackRate: 1.1,
|
|
1116
1114
|
maxBufferLength: 30,
|
|
1117
1115
|
maxMaxBufferLength: 600,
|
|
1118
1116
|
maxBufferSize: 60 * 1e3 * 1e3,
|
|
1119
|
-
maxBufferHole:
|
|
1117
|
+
maxBufferHole: 1,
|
|
1120
1118
|
highBufferWatchdogPeriod: 2,
|
|
1121
|
-
nudgeOffset: 0.
|
|
1122
|
-
nudgeMaxRetry:
|
|
1119
|
+
nudgeOffset: 0.2,
|
|
1120
|
+
nudgeMaxRetry: 5,
|
|
1123
1121
|
startPosition: -1
|
|
1124
|
-
})
|
|
1122
|
+
});
|
|
1125
1123
|
this.hls.on(import_hls.default.Events.MEDIA_ATTACHED, function() {
|
|
1126
1124
|
var _this_hls;
|
|
1127
1125
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
@@ -1145,6 +1143,8 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
1145
1143
|
this.bufferedSegmentsCount = 0;
|
|
1146
1144
|
this.hasInitialBufferCompleted = false;
|
|
1147
1145
|
this.shouldAutoplayAfterBuffering = !!this.config.autoplay;
|
|
1146
|
+
this.latencyProfileApplied = false;
|
|
1147
|
+
this.detectedLowLatencyStream = void 0;
|
|
1148
1148
|
minSegments = (_this_config_minSegmentsBeforePlay = this.config.minSegmentsBeforePlay) !== null && _this_config_minSegmentsBeforePlay !== void 0 ? _this_config_minSegmentsBeforePlay : 2;
|
|
1149
1149
|
if (this.debug) {
|
|
1150
1150
|
console.log("[StormcloudVideoPlayer] Waiting for", minSegments, "segments to buffer before playback");
|
|
@@ -1175,6 +1175,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
1175
1175
|
}).call(_this);
|
|
1176
1176
|
});
|
|
1177
1177
|
this.hls.on(import_hls.default.Events.LEVEL_LOADED, function(_evt, data) {
|
|
1178
|
+
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
1178
1179
|
if (_this.callbacks.isInAdBreak() || _this.callbacks.hasPendingAdBreak()) {
|
|
1179
1180
|
return;
|
|
1180
1181
|
}
|
|
@@ -1448,6 +1449,70 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
1448
1449
|
this.hls.attachMedia(this.video);
|
|
1449
1450
|
}
|
|
1450
1451
|
},
|
|
1452
|
+
{
|
|
1453
|
+
key: "isLowLatencyStream",
|
|
1454
|
+
value: function isLowLatencyStream() {
|
|
1455
|
+
return this.detectedLowLatencyStream;
|
|
1456
|
+
}
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
key: "applyStreamLatencyProfile",
|
|
1460
|
+
value: function applyStreamLatencyProfile(details) {
|
|
1461
|
+
if (this.latencyProfileApplied || !this.hls) {
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
if (!details) {
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1467
|
+
if (details.live !== true) {
|
|
1468
|
+
this.latencyProfileApplied = true;
|
|
1469
|
+
this.detectedLowLatencyStream = false;
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
var isLowLatencyManifest = this.isLowLatencyManifest(details);
|
|
1473
|
+
var useLowLatency = isLowLatencyManifest && !!this.config.lowLatencyMode;
|
|
1474
|
+
this.detectedLowLatencyStream = useLowLatency;
|
|
1475
|
+
this.latencyProfileApplied = true;
|
|
1476
|
+
var cfg = this.hls.config;
|
|
1477
|
+
if (useLowLatency) {
|
|
1478
|
+
cfg.maxLiveSyncPlaybackRate = 1.5;
|
|
1479
|
+
cfg.maxBufferHole = 0.5;
|
|
1480
|
+
delete cfg.liveSyncDuration;
|
|
1481
|
+
} else {
|
|
1482
|
+
cfg.maxLiveSyncPlaybackRate = 1.1;
|
|
1483
|
+
cfg.maxBufferHole = 1;
|
|
1484
|
+
delete cfg.liveSyncDuration;
|
|
1485
|
+
cfg.liveSyncDurationCount = 3;
|
|
1486
|
+
}
|
|
1487
|
+
if (this.debug) {
|
|
1488
|
+
var _details_targetduration;
|
|
1489
|
+
console.log("[StormcloudVideoPlayer] Live latency profile: ".concat(useLowLatency ? "LL-HLS (low latency)" : "standard live (stability)"), {
|
|
1490
|
+
isLowLatencyManifest: isLowLatencyManifest,
|
|
1491
|
+
lowLatencyModeRequested: !!this.config.lowLatencyMode,
|
|
1492
|
+
canBlockReload: details.canBlockReload,
|
|
1493
|
+
partTarget: details.partTarget,
|
|
1494
|
+
partHoldBack: details.partHoldBack,
|
|
1495
|
+
partListLength: Array.isArray(details.partList) ? details.partList.length : 0,
|
|
1496
|
+
targetDuration: (_details_targetduration = details.targetduration) !== null && _details_targetduration !== void 0 ? _details_targetduration : details.targetDuration,
|
|
1497
|
+
maxLiveSyncPlaybackRate: cfg.maxLiveSyncPlaybackRate,
|
|
1498
|
+
maxBufferHole: cfg.maxBufferHole
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
key: "isLowLatencyManifest",
|
|
1505
|
+
value: function isLowLatencyManifest(details) {
|
|
1506
|
+
if (!details) {
|
|
1507
|
+
return false;
|
|
1508
|
+
}
|
|
1509
|
+
var hasParts = Array.isArray(details.partList) && details.partList.length > 0;
|
|
1510
|
+
var hasPartTarget = typeof details.partTarget === "number" && details.partTarget > 0;
|
|
1511
|
+
var hasPartHoldBack = typeof details.partHoldBack === "number" && details.partHoldBack > 0;
|
|
1512
|
+
var canBlockReload = details.canBlockReload === true;
|
|
1513
|
+
return hasParts || hasPartTarget || hasPartHoldBack || canBlockReload;
|
|
1514
|
+
}
|
|
1515
|
+
},
|
|
1451
1516
|
{
|
|
1452
1517
|
key: "onId3Tag",
|
|
1453
1518
|
value: function onId3Tag(tag) {
|