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.
@@ -737,28 +737,9 @@ function createAdStormPlayer(contentVideo, options) {
737
737
  adVideoElement.removeAttribute("src");
738
738
  adVideoElement.load();
739
739
  }
740
- function buildVastUrl(durationSeconds, metadata) {
741
- var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/vast/".concat(licenseKey, "/pod");
742
- var defaultMetadata = {
743
- video: {
744
- codec: "h264",
745
- width: contentVideo.videoWidth || 1280,
746
- height: contentVideo.videoHeight || 720,
747
- fps: 29.97,
748
- bitrate: 5e3,
749
- profile: "high",
750
- pix_fmt: "yuv420p",
751
- has_b_frames: 0
752
- },
753
- audio: {
754
- codec: "aac",
755
- sample_rate: 48e3,
756
- bitrate: 128
757
- }
758
- };
759
- var finalMetadata = metadata || defaultMetadata;
760
- var metadataStr = encodeURIComponent(JSON.stringify(finalMetadata));
761
- return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds), "&metadata=").concat(metadataStr);
740
+ function buildVastUrl(durationSeconds) {
741
+ var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/nab/vast/pod";
742
+ return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds));
762
743
  }
763
744
  function parseVastXml(xmlString) {
764
745
  var ads = [];
@@ -5876,6 +5857,50 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5876
5857
  return min;
5877
5858
  }
5878
5859
  },
5860
+ {
5861
+ key: "getCurrentHlsSegmentDurationMs",
5862
+ value: function getCurrentHlsSegmentDurationMs() {
5863
+ var fallbackMs = 4e3;
5864
+ if (this.nativeHlsMode) {
5865
+ return fallbackMs;
5866
+ }
5867
+ var hls = this.hls;
5868
+ if (!hls) return null;
5869
+ var levelCandidates = [
5870
+ hls.currentLevel,
5871
+ hls.nextLoadLevel,
5872
+ hls.loadLevel
5873
+ ];
5874
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5875
+ try {
5876
+ for(var _iterator = levelCandidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5877
+ var levelIndex = _step.value;
5878
+ var _hls_levels_levelIndex, _hls_levels;
5879
+ if (typeof levelIndex !== "number" || levelIndex < 0) continue;
5880
+ 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;
5881
+ if (!details) continue;
5882
+ var targetDurationSec = typeof details.partTarget === "number" && details.partTarget > 0 ? details.partTarget : typeof details.targetduration === "number" && details.targetduration > 0 ? details.targetduration : void 0;
5883
+ if (targetDurationSec !== void 0) {
5884
+ return Math.max(800, Math.floor(targetDurationSec * 1e3));
5885
+ }
5886
+ }
5887
+ } catch (err) {
5888
+ _didIteratorError = true;
5889
+ _iteratorError = err;
5890
+ } finally{
5891
+ try {
5892
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
5893
+ _iterator.return();
5894
+ }
5895
+ } finally{
5896
+ if (_didIteratorError) {
5897
+ throw _iteratorError;
5898
+ }
5899
+ }
5900
+ }
5901
+ return fallbackMs;
5902
+ }
5903
+ },
5879
5904
  {
5880
5905
  key: "videoElement",
5881
5906
  get: function get() {