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.
package/lib/index.cjs CHANGED
@@ -3557,6 +3557,26 @@ var StormcloudVideoPlayer = class {
3557
3557
  console.log("[StormcloudVideoPlayer] setMuted called:", muted);
3558
3558
  }
3559
3559
  }
3560
+ setVolume(volume) {
3561
+ const clampedVolume = Math.max(0, Math.min(1, volume));
3562
+ const adPlaying = this.ima.isAdPlaying();
3563
+ if (adPlaying) {
3564
+ this.ima.setAdVolume(clampedVolume);
3565
+ this.ima.updateOriginalMutedState(clampedVolume === 0, clampedVolume);
3566
+ if (this.config.debugAdTiming) {
3567
+ console.log("[StormcloudVideoPlayer] setVolume applied during ad", {
3568
+ volume: clampedVolume
3569
+ });
3570
+ }
3571
+ } else {
3572
+ this.video.volume = clampedVolume;
3573
+ this.video.muted = clampedVolume === 0;
3574
+ this.ima.updateOriginalMutedState(clampedVolume === 0, clampedVolume);
3575
+ if (this.config.debugAdTiming) {
3576
+ console.log("[StormcloudVideoPlayer] setVolume called:", clampedVolume);
3577
+ }
3578
+ }
3579
+ }
3560
3580
  isFullscreen() {
3561
3581
  return !!document.fullscreenElement;
3562
3582
  }
@@ -3728,10 +3748,9 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(
3728
3748
  }
3729
3749
  };
3730
3750
  const handleVolumeChange = (newVolume) => {
3731
- if (videoRef.current && isFinite(newVolume)) {
3751
+ if (playerRef.current && isFinite(newVolume)) {
3732
3752
  const clampedVolume = Math.max(0, Math.min(1, newVolume));
3733
- videoRef.current.volume = clampedVolume;
3734
- videoRef.current.muted = clampedVolume === 0;
3753
+ playerRef.current.setVolume(clampedVolume);
3735
3754
  }
3736
3755
  };
3737
3756
  const handlePlaybackRateChange = (rate) => {
@@ -3833,7 +3852,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(
3833
3852
  if (autoplay !== void 0 && playerRef.current.videoElement) {
3834
3853
  playerRef.current.videoElement.autoplay = autoplay;
3835
3854
  }
3836
- if (muted !== void 0) {
3855
+ if (muted !== void 0 && !playerRef.current.isShowingAds()) {
3837
3856
  playerRef.current.setMuted(muted);
3838
3857
  }
3839
3858
  } catch (error) {