stormcloud-video-player 0.7.24 → 0.7.25

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/lib/index.cjs CHANGED
@@ -723,7 +723,7 @@ function isSupportedFormat(url, mimeType) {
723
723
  return false;
724
724
  }
725
725
  function createAdStormPlayer(contentVideo, options) {
726
- var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug;
726
+ var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug, channelId = options.channelId;
727
727
  var adPlaying = false;
728
728
  var originalMutedState = false;
729
729
  var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
@@ -929,8 +929,13 @@ function createAdStormPlayer(contentVideo, options) {
929
929
  adVideoElement.load();
930
930
  }
931
931
  function buildVastUrl(durationSeconds) {
932
- var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/nab/vast/pod";
933
- return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds));
932
+ var baseUrl = "https://adstorm.co/api/adstorm/nab/vast/pod";
933
+ var params = new URLSearchParams();
934
+ if (channelId != null) {
935
+ params.set("channel_id", String(channelId));
936
+ }
937
+ params.set("duration", String(Math.ceil(durationSeconds)));
938
+ return "".concat(baseUrl, "?").concat(params.toString());
934
939
  }
935
940
  function parseVastXml(xmlString) {
936
941
  var ads = [];
@@ -2953,10 +2958,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2953
2958
  logBrowserInfo(config.debugAdTiming);
2954
2959
  var browserForAdLayer = detectBrowser();
2955
2960
  var isSinglePipeline = browserForAdLayer.isSmartTV || !!this.config.singlePipelineMode;
2956
- this.adLayer = createAdStormPlayer(this.video, {
2961
+ this.adLayer = createAdStormPlayer(this.video, _object_spread({
2957
2962
  licenseKey: this.config.licenseKey || "",
2958
2963
  debug: !!config.debugAdTiming
2959
- });
2964
+ }, this.config.channelId != null && {
2965
+ channelId: this.config.channelId
2966
+ }));
2960
2967
  this.adLayer.updateOptions({
2961
2968
  continueLiveStreamDuringAds: !isSinglePipeline && this.shouldContinueLiveStreamDuringAds()
2962
2969
  });
@@ -7747,8 +7754,10 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
7747
7754
  if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
7748
7755
  if (disableAds !== void 0) cfg.disableAds = disableAds;
7749
7756
  cfg.disableFiller = disableFiller !== null && disableFiller !== void 0 ? disableFiller : true;
7750
- if (adcisionChannelId !== void 0) cfg.projectId = String(adcisionChannelId);
7751
- else if (swirlProjectId !== void 0) cfg.projectId = String(swirlProjectId);
7757
+ if (adcisionChannelId !== void 0) {
7758
+ cfg.projectId = String(adcisionChannelId);
7759
+ cfg.channelId = adcisionChannelId;
7760
+ } else if (swirlProjectId !== void 0) cfg.projectId = String(swirlProjectId);
7752
7761
  var player = new StormcloudVideoPlayer(cfg);
7753
7762
  playerRef.current = player;
7754
7763
  player.load().then(function() {