stormcloud-video-player 0.7.24 → 0.7.26

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.d.cts CHANGED
@@ -36,6 +36,7 @@ interface StormcloudVideoPlayerConfig {
36
36
  adTransitionGapMs?: number;
37
37
  singlePipelineMode?: boolean;
38
38
  projectId?: string;
39
+ channelId?: number;
39
40
  }
40
41
  interface AdController {
41
42
  initialize: () => void;
@@ -4111,6 +4112,7 @@ declare function supportsFeature(feature: string): boolean;
4111
4112
  interface AdStormPlayerOptions {
4112
4113
  licenseKey: string;
4113
4114
  debug?: boolean;
4115
+ channelId?: number;
4114
4116
  }
4115
4117
  interface AdStormLayerOptionsUpdate {
4116
4118
  continueLiveStreamDuringAds?: boolean;
package/lib/index.d.ts CHANGED
@@ -36,6 +36,7 @@ interface StormcloudVideoPlayerConfig {
36
36
  adTransitionGapMs?: number;
37
37
  singlePipelineMode?: boolean;
38
38
  projectId?: string;
39
+ channelId?: number;
39
40
  }
40
41
  interface AdController {
41
42
  initialize: () => void;
@@ -4111,6 +4112,7 @@ declare function supportsFeature(feature: string): boolean;
4111
4112
  interface AdStormPlayerOptions {
4112
4113
  licenseKey: string;
4113
4114
  debug?: boolean;
4115
+ channelId?: number;
4114
4116
  }
4115
4117
  interface AdStormLayerOptionsUpdate {
4116
4118
  continueLiveStreamDuringAds?: boolean;
package/lib/index.js CHANGED
@@ -554,7 +554,7 @@ function isSupportedFormat(url, mimeType) {
554
554
  return false;
555
555
  }
556
556
  function createAdStormPlayer(contentVideo, options) {
557
- var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug;
557
+ var licenseKey = options.licenseKey, _options_debug = options.debug, debug = _options_debug === void 0 ? false : _options_debug, channelId = options.channelId;
558
558
  var adPlaying = false;
559
559
  var originalMutedState = false;
560
560
  var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
@@ -761,7 +761,12 @@ function createAdStormPlayer(contentVideo, options) {
761
761
  }
762
762
  function buildVastUrl(durationSeconds) {
763
763
  var baseUrl = "https://adstorm.co/api-adstorm-dev/adstorm/nab/vast/pod";
764
- return "".concat(baseUrl, "?duration=").concat(Math.ceil(durationSeconds));
764
+ var params = new URLSearchParams();
765
+ if (channelId != null) {
766
+ params.set("channel_id", String(channelId));
767
+ }
768
+ params.set("duration", String(Math.ceil(durationSeconds)));
769
+ return "".concat(baseUrl, "?").concat(params.toString());
765
770
  }
766
771
  function parseVastXml(xmlString) {
767
772
  var ads = [];
@@ -2787,10 +2792,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2787
2792
  logBrowserInfo(config.debugAdTiming);
2788
2793
  var browserForAdLayer = detectBrowser();
2789
2794
  var isSinglePipeline = browserForAdLayer.isSmartTV || !!this.config.singlePipelineMode;
2790
- this.adLayer = createAdStormPlayer(this.video, {
2795
+ this.adLayer = createAdStormPlayer(this.video, _object_spread({
2791
2796
  licenseKey: this.config.licenseKey || "",
2792
2797
  debug: !!config.debugAdTiming
2793
- });
2798
+ }, this.config.channelId != null && {
2799
+ channelId: this.config.channelId
2800
+ }));
2794
2801
  this.adLayer.updateOptions({
2795
2802
  continueLiveStreamDuringAds: !isSinglePipeline && this.shouldContinueLiveStreamDuringAds()
2796
2803
  });
@@ -7581,8 +7588,10 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
7581
7588
  if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
7582
7589
  if (disableAds !== void 0) cfg.disableAds = disableAds;
7583
7590
  cfg.disableFiller = disableFiller !== null && disableFiller !== void 0 ? disableFiller : true;
7584
- if (adcisionChannelId !== void 0) cfg.projectId = String(adcisionChannelId);
7585
- else if (swirlProjectId !== void 0) cfg.projectId = String(swirlProjectId);
7591
+ if (adcisionChannelId !== void 0) {
7592
+ cfg.projectId = String(adcisionChannelId);
7593
+ cfg.channelId = adcisionChannelId;
7594
+ } else if (swirlProjectId !== void 0) cfg.projectId = String(swirlProjectId);
7586
7595
  var player = new StormcloudVideoPlayer(cfg);
7587
7596
  playerRef.current = player;
7588
7597
  player.load().then(function() {