stormcloud-video-player 0.2.26 → 0.2.27

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.
@@ -3493,6 +3493,26 @@ var StormcloudVideoPlayer = class {
3493
3493
  console.log("[StormcloudVideoPlayer] setMuted called:", muted);
3494
3494
  }
3495
3495
  }
3496
+ setVolume(volume) {
3497
+ const clampedVolume = Math.max(0, Math.min(1, volume));
3498
+ const adPlaying = this.ima.isAdPlaying();
3499
+ if (adPlaying) {
3500
+ this.ima.setAdVolume(clampedVolume);
3501
+ this.ima.updateOriginalMutedState(clampedVolume === 0, clampedVolume);
3502
+ if (this.config.debugAdTiming) {
3503
+ console.log("[StormcloudVideoPlayer] setVolume applied during ad", {
3504
+ volume: clampedVolume
3505
+ });
3506
+ }
3507
+ } else {
3508
+ this.video.volume = clampedVolume;
3509
+ this.video.muted = clampedVolume === 0;
3510
+ this.ima.updateOriginalMutedState(clampedVolume === 0, clampedVolume);
3511
+ if (this.config.debugAdTiming) {
3512
+ console.log("[StormcloudVideoPlayer] setVolume called:", clampedVolume);
3513
+ }
3514
+ }
3515
+ }
3496
3516
  isFullscreen() {
3497
3517
  return !!document.fullscreenElement;
3498
3518
  }
@@ -3664,10 +3684,9 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(
3664
3684
  }
3665
3685
  };
3666
3686
  const handleVolumeChange = (newVolume) => {
3667
- if (videoRef.current && isFinite(newVolume)) {
3687
+ if (playerRef.current && isFinite(newVolume)) {
3668
3688
  const clampedVolume = Math.max(0, Math.min(1, newVolume));
3669
- videoRef.current.volume = clampedVolume;
3670
- videoRef.current.muted = clampedVolume === 0;
3689
+ playerRef.current.setVolume(clampedVolume);
3671
3690
  }
3672
3691
  };
3673
3692
  const handlePlaybackRateChange = (rate) => {
@@ -3769,7 +3788,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(
3769
3788
  if (autoplay !== void 0 && playerRef.current.videoElement) {
3770
3789
  playerRef.current.videoElement.autoplay = autoplay;
3771
3790
  }
3772
- if (muted !== void 0) {
3791
+ if (muted !== void 0 && !playerRef.current.isShowingAds()) {
3773
3792
  playerRef.current.setMuted(muted);
3774
3793
  }
3775
3794
  } catch (error) {