stormcloud-video-player 0.8.6 → 0.8.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.
package/lib/index.d.cts CHANGED
@@ -343,6 +343,7 @@ declare class StormcloudVideoPlayer {
343
343
  setMuted(muted: boolean): void;
344
344
  setVolume(volume: number): void;
345
345
  getVolume(): number;
346
+ private getAdAudioVolume;
346
347
  isFullscreen(): boolean;
347
348
  isLive(): boolean;
348
349
  get videoElement(): HTMLVideoElement;
@@ -4174,6 +4175,7 @@ interface PalNonceOptions {
4174
4175
  sessionId?: string;
4175
4176
  adWillAutoPlay?: boolean;
4176
4177
  adWillPlayMuted?: boolean;
4178
+ playerVolume?: number;
4177
4179
  continuousPlayback?: boolean;
4178
4180
  }
4179
4181
  interface PalNonceManager {
package/lib/index.d.ts CHANGED
@@ -343,6 +343,7 @@ declare class StormcloudVideoPlayer {
343
343
  setMuted(muted: boolean): void;
344
344
  setVolume(volume: number): void;
345
345
  getVolume(): number;
346
+ private getAdAudioVolume;
346
347
  isFullscreen(): boolean;
347
348
  isLive(): boolean;
348
349
  get videoElement(): HTMLVideoElement;
@@ -4174,6 +4175,7 @@ interface PalNonceOptions {
4174
4175
  sessionId?: string;
4175
4176
  adWillAutoPlay?: boolean;
4176
4177
  adWillPlayMuted?: boolean;
4178
+ playerVolume?: number;
4177
4179
  continuousPlayback?: boolean;
4178
4180
  }
4179
4181
  interface PalNonceManager {
package/lib/index.js CHANGED
@@ -836,7 +836,6 @@ function createHlsAdPlayer(contentVideo, options) {
836
836
  adPlaying = false;
837
837
  setAdPlayingFlag(false);
838
838
  contentVideo.muted = true;
839
- contentVideo.volume = 0;
840
839
  if (adContainerEl) {
841
840
  adContainerEl.style.display = "none";
842
841
  adContainerEl.style.pointerEvents = "none";
@@ -856,7 +855,6 @@ function createHlsAdPlayer(contentVideo, options) {
856
855
  adPlaying = false;
857
856
  setAdPlayingFlag(false);
858
857
  contentVideo.muted = true;
859
- contentVideo.volume = 0;
860
858
  if (adContainerEl) {
861
859
  adContainerEl.style.display = "none";
862
860
  adContainerEl.style.pointerEvents = "none";
@@ -961,7 +959,7 @@ function createHlsAdPlayer(contentVideo, options) {
961
959
  },
962
960
  play: function play() {
963
961
  return _async_to_generator(function() {
964
- var contentVolume, adVolume, mediaFile, isHlsAd;
962
+ var contentVolume, mediaFile, isHlsAd;
965
963
  return _ts_generator(this, function(_state) {
966
964
  if (!currentAd) {
967
965
  console.warn("[HlsAdPlayer] Cannot play: No ad loaded (no ads available)");
@@ -995,13 +993,11 @@ function createHlsAdPlayer(contentVideo, options) {
995
993
  }
996
994
  console.log("[HlsAdPlayer] FORCE MUTING main video");
997
995
  contentVideo.muted = true;
998
- contentVideo.volume = 0;
999
996
  adPlaying = true;
1000
997
  setAdPlayingFlag(true);
1001
998
  if (adVideoElement) {
1002
- adVolume = originalMutedState ? 0 : originalVolume;
1003
- adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1004
- adVideoElement.muted = false;
999
+ adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
1000
+ adVideoElement.muted = originalMutedState;
1005
1001
  console.log("[HlsAdPlayer] Set ad video volume to ".concat(adVideoElement.volume, ", muted: ").concat(adVideoElement.muted, ", originalMutedState: ").concat(originalMutedState, ", contentVolume: ").concat(contentVolume));
1006
1002
  }
1007
1003
  if (adContainerEl) {
@@ -1109,8 +1105,8 @@ function createHlsAdPlayer(contentVideo, options) {
1109
1105
  setAdPlayingFlag(false);
1110
1106
  previousMutedState = contentVideo.muted;
1111
1107
  contentVideo.muted = originalMutedState;
1112
- contentVideo.volume = originalMutedState ? 0 : originalVolume;
1113
- console.log("[HlsAdPlayer] Restored mute state on stop: ".concat(previousMutedState, " -> ").concat(originalMutedState));
1108
+ contentVideo.volume = Math.max(0, Math.min(1, originalVolume));
1109
+ console.log("[HlsAdPlayer] Restored mute state on stop: ".concat(previousMutedState, " -> ").concat(originalMutedState, ", volume: ").concat(contentVideo.volume));
1114
1110
  if (adContainerEl) {
1115
1111
  adContainerEl.style.display = "none";
1116
1112
  adContainerEl.style.pointerEvents = "none";
@@ -1165,7 +1161,7 @@ function createHlsAdPlayer(contentVideo, options) {
1165
1161
  adPlaying = false;
1166
1162
  setAdPlayingFlag(false);
1167
1163
  contentVideo.muted = originalMutedState;
1168
- contentVideo.volume = originalMutedState ? 0 : originalVolume;
1164
+ contentVideo.volume = Math.max(0, Math.min(1, originalVolume));
1169
1165
  if (adHls) {
1170
1166
  adHls.destroy();
1171
1167
  adHls = void 0;
@@ -1221,7 +1217,9 @@ function createHlsAdPlayer(contentVideo, options) {
1221
1217
  },
1222
1218
  setAdVolume: function setAdVolume(volume) {
1223
1219
  if (adVideoElement && adPlaying) {
1224
- adVideoElement.volume = Math.max(0, Math.min(1, volume));
1220
+ var clamped = Math.max(0, Math.min(1, volume));
1221
+ adVideoElement.volume = clamped;
1222
+ adVideoElement.muted = clamped === 0;
1225
1223
  }
1226
1224
  },
1227
1225
  getAdVolume: function getAdVolume() {
@@ -1326,7 +1324,7 @@ function createPalNonceManager() {
1326
1324
  return {
1327
1325
  generateNonce: function generateNonce() {
1328
1326
  return _async_to_generator(function() {
1329
- var options, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_continuousPlayback, loader, goog, request, manager, error;
1327
+ var options, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
1330
1328
  var _arguments = arguments;
1331
1329
  return _ts_generator(this, function(_state) {
1332
1330
  switch(_state.label){
@@ -1351,6 +1349,7 @@ function createPalNonceManager() {
1351
1349
  request = new goog.pal.NonceRequest();
1352
1350
  request.adWillAutoPlay = (_options_adWillAutoPlay = options.adWillAutoPlay) !== null && _options_adWillAutoPlay !== void 0 ? _options_adWillAutoPlay : true;
1353
1351
  request.adWillPlayMuted = (_options_adWillPlayMuted = options.adWillPlayMuted) !== null && _options_adWillPlayMuted !== void 0 ? _options_adWillPlayMuted : false;
1352
+ request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
1354
1353
  request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
1355
1354
  request.descriptionUrl = options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : "");
1356
1355
  request.iconsSupported = true;
@@ -2798,7 +2797,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2798
2797
  videoWidth: this.video.offsetWidth || this.video.clientWidth || 640,
2799
2798
  videoHeight: this.video.offsetHeight || this.video.clientHeight || 480,
2800
2799
  adWillAutoPlay: !!this.config.autoplay,
2801
- adWillPlayMuted: !!this.config.muted,
2800
+ adWillPlayMuted: true,
2801
+ playerVolume: 0,
2802
2802
  continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
2803
2803
  }).catch(function() {});
2804
2804
  fetchConsentSignals().then(function(signals) {
@@ -3264,10 +3264,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3264
3264
  console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
3265
3265
  }
3266
3266
  }
3267
- var currentMuted = _this.video.muted;
3268
- var currentVolume = _this.video.volume;
3269
- var adVolume = currentMuted ? 0 : currentVolume;
3270
- _this.adPlayer.setAdVolume(adVolume);
3267
+ _this.adPlayer.setAdVolume(_this.getAdAudioVolume());
3271
3268
  if (_this.isShowingPlaceholder) {
3272
3269
  if (_this.config.debugAdTiming) {
3273
3270
  console.log("[StormcloudVideoPlayer] Hiding placeholder - new ads starting");
@@ -3284,7 +3281,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3284
3281
  }).catch(function() {});
3285
3282
  if (!_this.video.muted) {
3286
3283
  _this.video.muted = true;
3287
- _this.video.volume = 0;
3288
3284
  if (_this.config.debugAdTiming) {
3289
3285
  console.log("[StormcloudVideoPlayer] Muted video on content_resume (ad ended, gap between ads)");
3290
3286
  }
@@ -3332,7 +3328,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3332
3328
  try {
3333
3329
  this.adPlayer.destroy();
3334
3330
  this.video.muted = true;
3335
- this.video.volume = 0;
3336
3331
  } catch (error) {
3337
3332
  if (this.config.debugAdTiming) {
3338
3333
  console.warn("[StormcloudVideoPlayer] Error destroying old AdController:", error);
@@ -3391,7 +3386,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3391
3386
  }
3392
3387
  if (!this.video.muted) {
3393
3388
  this.video.muted = true;
3394
- this.video.volume = 0;
3395
3389
  if (this.config.debugAdTiming) {
3396
3390
  console.log("[StormcloudVideoPlayer] Muted video when showing placeholder");
3397
3391
  }
@@ -4013,7 +4007,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4013
4007
  if (marker.type === "end") {
4014
4008
  if (!this.video.muted) {
4015
4009
  this.video.muted = true;
4016
- this.video.volume = 0;
4017
4010
  if (this.config.debugAdTiming) {
4018
4011
  console.log("[StormcloudVideoPlayer] Muted video on SCTE end marker");
4019
4012
  }
@@ -4051,13 +4044,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4051
4044
  {
4052
4045
  key: "startScte35AdBreak",
4053
4046
  value: function startScte35AdBreak(marker, cueKey, durationMs) {
4054
- if (!this.video.muted) {
4055
- this.video.muted = true;
4056
- this.video.volume = 0;
4057
- if (this.config.debugAdTiming) {
4058
- console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
4059
- }
4060
- }
4061
4047
  this.inAdBreak = true;
4062
4048
  this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
4063
4049
  this.scheduledScte35BreakKey = void 0;
@@ -5644,7 +5630,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5644
5630
  key: "handleAdStart",
5645
5631
  value: function handleAdStart(_marker) {
5646
5632
  return _async_to_generator(function() {
5647
- var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, firstAdUrl, usePreloadedAd, preloadedController, preloaded, firstAdUrlArray, adVolume, adVolume1, error, fallbackPreloaded, adVolume2, fallbackError;
5633
+ var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, firstAdUrl, usePreloadedAd, preloadedController, preloaded, firstAdUrlArray, preservedMuted, preservedVolume, adVolume, adVolume1, error, fallbackPreloaded, preservedMuted1, preservedVolume1, adVolume2, fallbackError;
5648
5634
  return _ts_generator(this, function(_state) {
5649
5635
  switch(_state.label){
5650
5636
  case 0:
@@ -5684,7 +5670,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5684
5670
  this.adPlayer.updateOriginalMutedState(currentMuted, currentVolume);
5685
5671
  if (!this.video.muted) {
5686
5672
  this.video.muted = true;
5687
- this.video.volume = 0;
5688
5673
  if (this.config.debugAdTiming) {
5689
5674
  console.log("[StormcloudVideoPlayer] Muted video in handleAdStart");
5690
5675
  }
@@ -5754,10 +5739,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5754
5739
  3,
5755
5740
  3
5756
5741
  ];
5742
+ preservedMuted = this.adPlayer.getOriginalMutedState();
5743
+ preservedVolume = this.adPlayer.getOriginalVolume();
5757
5744
  this.adPlayer.destroy();
5758
5745
  this.video.muted = true;
5759
- this.video.volume = 0;
5760
5746
  this.adPlayer = preloadedController;
5747
+ this.adPlayer.updateOriginalMutedState(preservedMuted, preservedVolume);
5761
5748
  this.attachImaEventListeners();
5762
5749
  if (this.config.debugAdTiming) {
5763
5750
  console.log("[CONTINUOUS-FETCH] \u2705 Using preloaded ad, resuming and starting playback immediately (no request delay!)");
@@ -5855,11 +5842,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5855
5842
  ,
5856
5843
  12
5857
5844
  ]);
5845
+ preservedMuted1 = this.adPlayer.getOriginalMutedState();
5846
+ preservedVolume1 = this.adPlayer.getOriginalVolume();
5858
5847
  this.adPlayer.destroy();
5859
5848
  this.video.muted = true;
5860
- this.video.volume = 0;
5861
5849
  this.adPlayer = fallbackPreloaded.adController;
5862
5850
  this.attachImaEventListeners();
5851
+ this.adPlayer.updateOriginalMutedState(preservedMuted1, preservedVolume1);
5863
5852
  this.adPlayer.resume();
5864
5853
  this.consecutiveFailures = 0;
5865
5854
  this.currentAdIndex++;
@@ -6157,7 +6146,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6157
6146
  value: function tryNextAvailableAd() {
6158
6147
  var retryCount = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
6159
6148
  return _async_to_generator(function() {
6160
- var remaining, preloaded, currentMuted, currentVolume, adVolume, error, nextAdUrl, currentMuted1, currentVolume1, error1, errorMessage, maxRetries;
6149
+ var remaining, preloaded, preservedMuted, preservedVolume, error, nextAdUrl, error1, errorMessage, maxRetries;
6161
6150
  return _ts_generator(this, function(_state) {
6162
6151
  switch(_state.label){
6163
6152
  case 0:
@@ -6211,11 +6200,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6211
6200
  ,
6212
6201
  4
6213
6202
  ]);
6203
+ preservedMuted = this.adPlayer.getOriginalMutedState();
6204
+ preservedVolume = this.adPlayer.getOriginalVolume();
6214
6205
  this.adPlayer.destroy();
6215
6206
  this.video.muted = true;
6216
- this.video.volume = 0;
6217
6207
  this.adPlayer = preloaded.adController;
6218
6208
  this.attachImaEventListeners();
6209
+ this.adPlayer.updateOriginalMutedState(preservedMuted, preservedVolume);
6219
6210
  this.adPlayer.resume();
6220
6211
  this.currentAdIndex++;
6221
6212
  this.totalAdRequestsInBreak++;
@@ -6229,10 +6220,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6229
6220
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6230
6221
  this.scheduleAdStopCountdown(this.getRemainingAdMs());
6231
6222
  }
6232
- currentMuted = this.video.muted;
6233
- currentVolume = this.video.volume;
6234
- adVolume = currentMuted ? 0 : currentVolume;
6235
- this.adPlayer.setAdVolume(adVolume);
6223
+ this.adPlayer.setAdVolume(this.getAdAudioVolume());
6236
6224
  this.consecutiveFailures = 0;
6237
6225
  return [
6238
6226
  2
@@ -6279,9 +6267,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6279
6267
  if (this.config.debugAdTiming) {
6280
6268
  console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via HLS ad player (".concat(this.currentAdIndex + 1, "/").concat(this.totalAdsInBreak, ", ").concat(this.adRequestQueue.length, " remaining in queue)"));
6281
6269
  }
6282
- currentMuted1 = this.video.muted;
6283
- currentVolume1 = this.video.volume;
6284
- this.adPlayer.updateOriginalMutedState(currentMuted1, currentVolume1);
6285
6270
  this.currentAdIndex++;
6286
6271
  this.totalAdRequestsInBreak++;
6287
6272
  this.lastAdRequestTime = Date.now();
@@ -6374,7 +6359,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6374
6359
  key: "showPlaceholderAndWaitForAds",
6375
6360
  value: function showPlaceholderAndWaitForAds() {
6376
6361
  return _async_to_generator(function() {
6377
- var remaining, waitTime, checkInterval, maxChecks, i, nextAdUrl, currentMuted, currentVolume, error, errorMessage;
6362
+ var remaining, waitTime, checkInterval, maxChecks, i, nextAdUrl, error, errorMessage;
6378
6363
  return _ts_generator(this, function(_state) {
6379
6364
  switch(_state.label){
6380
6365
  case 0:
@@ -6470,9 +6455,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6470
6455
  }
6471
6456
  this.isShowingPlaceholder = false;
6472
6457
  this.adPlayer.hidePlaceholder();
6473
- currentMuted = this.video.muted;
6474
- currentVolume = this.video.volume;
6475
- this.adPlayer.updateOriginalMutedState(currentMuted, currentVolume);
6476
6458
  this.currentAdIndex++;
6477
6459
  this.totalAdRequestsInBreak++;
6478
6460
  this.lastAdRequestTime = Date.now();
@@ -6922,7 +6904,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6922
6904
  key: "playSingleAd",
6923
6905
  value: function playSingleAd(vastTagUrl) {
6924
6906
  return _async_to_generator(function() {
6925
- var requestToken, currentMuted, currentVolume, adVolume, playError, preloadedFallback, currentMuted1, currentVolume1, adVolume1, fallbackError, error, errorMessage, preloadedFallback1, currentMuted2, currentVolume2, adVolume2, fallbackError1;
6907
+ var requestToken, playError, preloadedFallback, preservedMuted, preservedVolume, fallbackError, error, errorMessage, preloadedFallback1, preservedMuted1, preservedVolume1, fallbackError1;
6926
6908
  return _ts_generator(this, function(_state) {
6927
6909
  switch(_state.label){
6928
6910
  case 0:
@@ -7009,10 +6991,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7009
6991
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
7010
6992
  this.scheduleAdStopCountdown(this.getRemainingAdMs());
7011
6993
  }
7012
- currentMuted = this.video.muted;
7013
- currentVolume = this.video.volume;
7014
- adVolume = currentMuted ? 0 : currentVolume;
7015
- this.adPlayer.setAdVolume(adVolume);
6994
+ this.adPlayer.setAdVolume(this.getAdAudioVolume());
7016
6995
  this.consecutiveFailures = 0;
7017
6996
  this.temporaryFailureUrls.delete(vastTagUrl);
7018
6997
  return [
@@ -7041,11 +7020,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7041
7020
  10
7042
7021
  ]);
7043
7022
  this.clearAdFailsafeTimer();
7023
+ preservedMuted = this.adPlayer.getOriginalMutedState();
7024
+ preservedVolume = this.adPlayer.getOriginalVolume();
7044
7025
  this.adPlayer.destroy();
7045
7026
  this.video.muted = true;
7046
- this.video.volume = 0;
7047
7027
  this.adPlayer = preloadedFallback.adController;
7048
7028
  this.attachImaEventListeners();
7029
+ this.adPlayer.updateOriginalMutedState(preservedMuted, preservedVolume);
7049
7030
  this.adPlayer.resume();
7050
7031
  this.consecutiveFailures = 0;
7051
7032
  this.currentAdIndex++;
@@ -7059,10 +7040,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7059
7040
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
7060
7041
  this.scheduleAdStopCountdown(this.getRemainingAdMs());
7061
7042
  }
7062
- currentMuted1 = this.video.muted;
7063
- currentVolume1 = this.video.volume;
7064
- adVolume1 = currentMuted1 ? 0 : currentVolume1;
7065
- this.adPlayer.setAdVolume(adVolume1);
7043
+ this.adPlayer.setAdVolume(this.getAdAudioVolume());
7066
7044
  return [
7067
7045
  2
7068
7046
  ];
@@ -7121,11 +7099,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7121
7099
  ]);
7122
7100
  this.clearAdRequestWatchdog();
7123
7101
  this.clearAdFailsafeTimer();
7102
+ preservedMuted1 = this.adPlayer.getOriginalMutedState();
7103
+ preservedVolume1 = this.adPlayer.getOriginalVolume();
7124
7104
  this.adPlayer.destroy();
7125
7105
  this.video.muted = true;
7126
- this.video.volume = 0;
7127
7106
  this.adPlayer = preloadedFallback1.adController;
7128
7107
  this.attachImaEventListeners();
7108
+ this.adPlayer.updateOriginalMutedState(preservedMuted1, preservedVolume1);
7129
7109
  this.adPlayer.resume();
7130
7110
  this.consecutiveFailures = 0;
7131
7111
  this.currentAdIndex++;
@@ -7136,10 +7116,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7136
7116
  ];
7137
7117
  case 14:
7138
7118
  _state.sent();
7139
- currentMuted2 = this.video.muted;
7140
- currentVolume2 = this.video.volume;
7141
- adVolume2 = currentMuted2 ? 0 : currentVolume2;
7142
- this.adPlayer.setAdVolume(adVolume2);
7119
+ this.adPlayer.setAdVolume(this.getAdAudioVolume());
7143
7120
  return [
7144
7121
  2
7145
7122
  ];
@@ -7441,10 +7418,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7441
7418
  key: "toggleMute",
7442
7419
  value: function toggleMute() {
7443
7420
  if (this.adPlayer.isAdPlaying()) {
7444
- var currentPerceptualState = this.isMuted();
7445
- var newMutedState = !currentPerceptualState;
7421
+ var newMutedState = !this.adPlayer.getOriginalMutedState();
7422
+ var restoreVolume = this.adPlayer.getOriginalVolume() || 1;
7446
7423
  this.adPlayer.updateOriginalMutedState(newMutedState, this.video.volume);
7447
- this.adPlayer.setAdVolume(newMutedState ? 0 : 1);
7424
+ this.adPlayer.setAdVolume(newMutedState ? 0 : restoreVolume);
7448
7425
  if (this.config.debugAdTiming) {
7449
7426
  console.log("[StormcloudVideoPlayer] Mute toggle during ad - immediately applied:", newMutedState);
7450
7427
  }
@@ -7499,10 +7476,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7499
7476
  key: "isMuted",
7500
7477
  value: function isMuted() {
7501
7478
  if (this.adPlayer.isAdPlaying()) {
7502
- if (this.config.debugAdTiming) {
7503
- console.log("[StormcloudVideoPlayer] isMuted() override during ad playback -> false");
7504
- }
7505
- return false;
7479
+ return this.adPlayer.getOriginalMutedState();
7506
7480
  }
7507
7481
  return this.video.muted;
7508
7482
  }
@@ -7569,6 +7543,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7569
7543
  return this.video.volume;
7570
7544
  }
7571
7545
  },
7546
+ {
7547
+ key: "getAdAudioVolume",
7548
+ value: function getAdAudioVolume() {
7549
+ return this.adPlayer.getOriginalMutedState() ? 0 : this.adPlayer.getOriginalVolume();
7550
+ }
7551
+ },
7572
7552
  {
7573
7553
  key: "isFullscreen",
7574
7554
  value: function isFullscreen() {