stormcloud-video-player 0.7.5 → 0.7.7

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.
@@ -146,6 +146,7 @@ declare class StormcloudVideoPlayer {
146
146
  width: number;
147
147
  height: number;
148
148
  } | null;
149
+ getCurrentHlsSegmentDurationMs(): number | null;
149
150
  get videoElement(): HTMLVideoElement;
150
151
  resize(): void;
151
152
  destroy(): void;
@@ -5928,6 +5928,50 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5928
5928
  return min;
5929
5929
  }
5930
5930
  },
5931
+ {
5932
+ key: "getCurrentHlsSegmentDurationMs",
5933
+ value: function getCurrentHlsSegmentDurationMs() {
5934
+ var fallbackMs = 4e3;
5935
+ if (this.nativeHlsMode) {
5936
+ return fallbackMs;
5937
+ }
5938
+ var hls = this.hls;
5939
+ if (!hls) return null;
5940
+ var levelCandidates = [
5941
+ hls.currentLevel,
5942
+ hls.nextLoadLevel,
5943
+ hls.loadLevel
5944
+ ];
5945
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5946
+ try {
5947
+ for(var _iterator = levelCandidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5948
+ var levelIndex = _step.value;
5949
+ var _hls_levels_levelIndex, _hls_levels;
5950
+ if (typeof levelIndex !== "number" || levelIndex < 0) continue;
5951
+ var details = (_hls_levels = hls.levels) === null || _hls_levels === void 0 ? void 0 : (_hls_levels_levelIndex = _hls_levels[levelIndex]) === null || _hls_levels_levelIndex === void 0 ? void 0 : _hls_levels_levelIndex.details;
5952
+ if (!details) continue;
5953
+ var targetDurationSec = typeof details.partTarget === "number" && details.partTarget > 0 ? details.partTarget : typeof details.targetduration === "number" && details.targetduration > 0 ? details.targetduration : void 0;
5954
+ if (targetDurationSec !== void 0) {
5955
+ return Math.max(800, Math.floor(targetDurationSec * 1e3));
5956
+ }
5957
+ }
5958
+ } catch (err) {
5959
+ _didIteratorError = true;
5960
+ _iteratorError = err;
5961
+ } finally{
5962
+ try {
5963
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
5964
+ _iterator.return();
5965
+ }
5966
+ } finally{
5967
+ if (_didIteratorError) {
5968
+ throw _iteratorError;
5969
+ }
5970
+ }
5971
+ }
5972
+ return fallbackMs;
5973
+ }
5974
+ },
5931
5975
  {
5932
5976
  key: "videoElement",
5933
5977
  get: function get() {