stormcloud-video-player 0.7.6 → 0.7.8

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.
@@ -825,28 +825,9 @@ function createAdStormPlayer(contentVideo, options) {
825
825
  adVideoElement.removeAttribute("src");
826
826
  adVideoElement.load();
827
827
  }
828
- function buildVastUrl(durationSeconds, metadata) {
829
- var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/vast/".concat(licenseKey, "/pod");
830
- var defaultMetadata = {
831
- video: {
832
- codec: "h264",
833
- width: contentVideo.videoWidth || 1280,
834
- height: contentVideo.videoHeight || 720,
835
- fps: 29.97,
836
- bitrate: 5e3,
837
- profile: "high",
838
- pix_fmt: "yuv420p",
839
- has_b_frames: 0
840
- },
841
- audio: {
842
- codec: "aac",
843
- sample_rate: 48e3,
844
- bitrate: 128
845
- }
846
- };
847
- var finalMetadata = metadata || defaultMetadata;
848
- var metadataStr = encodeURIComponent(JSON.stringify(finalMetadata));
849
- return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds), "&metadata=").concat(metadataStr);
828
+ function buildVastUrl(durationSeconds) {
829
+ var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/nab/vast/pod";
830
+ return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds));
850
831
  }
851
832
  function parseVastXml(xmlString) {
852
833
  var ads = [];
@@ -5964,6 +5945,50 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5964
5945
  return min;
5965
5946
  }
5966
5947
  },
5948
+ {
5949
+ key: "getCurrentHlsSegmentDurationMs",
5950
+ value: function getCurrentHlsSegmentDurationMs() {
5951
+ var fallbackMs = 4e3;
5952
+ if (this.nativeHlsMode) {
5953
+ return fallbackMs;
5954
+ }
5955
+ var hls = this.hls;
5956
+ if (!hls) return null;
5957
+ var levelCandidates = [
5958
+ hls.currentLevel,
5959
+ hls.nextLoadLevel,
5960
+ hls.loadLevel
5961
+ ];
5962
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5963
+ try {
5964
+ for(var _iterator = levelCandidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5965
+ var levelIndex = _step.value;
5966
+ var _hls_levels_levelIndex, _hls_levels;
5967
+ if (typeof levelIndex !== "number" || levelIndex < 0) continue;
5968
+ 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;
5969
+ if (!details) continue;
5970
+ var targetDurationSec = typeof details.partTarget === "number" && details.partTarget > 0 ? details.partTarget : typeof details.targetduration === "number" && details.targetduration > 0 ? details.targetduration : void 0;
5971
+ if (targetDurationSec !== void 0) {
5972
+ return Math.max(800, Math.floor(targetDurationSec * 1e3));
5973
+ }
5974
+ }
5975
+ } catch (err) {
5976
+ _didIteratorError = true;
5977
+ _iteratorError = err;
5978
+ } finally{
5979
+ try {
5980
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
5981
+ _iterator.return();
5982
+ }
5983
+ } finally{
5984
+ if (_didIteratorError) {
5985
+ throw _iteratorError;
5986
+ }
5987
+ }
5988
+ }
5989
+ return fallbackMs;
5990
+ }
5991
+ },
5967
5992
  {
5968
5993
  key: "videoElement",
5969
5994
  get: function get() {