saltfish 0.3.29 → 0.3.30

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.
@@ -11062,6 +11062,37 @@ class UIManager {
11062
11062
  }
11063
11063
  }
11064
11064
  }
11065
+ /**
11066
+ * Handles autoplay fallback and idle mode interaction by unmuting and resetting video
11067
+ * @param source - The UI element that triggered the interaction (for logging)
11068
+ */
11069
+ handleAutoplayFallbackInteraction(source) {
11070
+ var _a;
11071
+ const store = getSaltfishStore();
11072
+ if (store.currentState !== "autoplayBlocked" && store.currentState !== "idleMode") {
11073
+ if (this.videoManager) {
11074
+ this.videoManager.markUserInteraction();
11075
+ }
11076
+ return;
11077
+ }
11078
+ store.currentState === "autoplayBlocked" ? "autoplay fallback" : "idle";
11079
+ if (this.videoManager) {
11080
+ this.videoManager.markUserInteraction();
11081
+ this.videoManager.setMuted(false);
11082
+ const videoElement = this.videoManager.getVideoElement();
11083
+ if (videoElement) {
11084
+ videoElement.loop = false;
11085
+ videoElement.currentTime = 0;
11086
+ }
11087
+ } else {
11088
+ const videoElement = (_a = this.playerElement) == null ? void 0 : _a.querySelector(".sf-video-container__video");
11089
+ if (videoElement) {
11090
+ videoElement.muted = false;
11091
+ videoElement.loop = false;
11092
+ videoElement.currentTime = 0;
11093
+ }
11094
+ }
11095
+ }
11065
11096
  /**
11066
11097
  * Creates the center play button with proper click handler
11067
11098
  */
@@ -11084,33 +11115,10 @@ class UIManager {
11084
11115
  `;
11085
11116
  this.playerElement.appendChild(this.centerPlayButton);
11086
11117
  this.centerPlayButton.addEventListener("click", (e) => {
11087
- var _a;
11088
11118
  e.stopPropagation();
11089
11119
  e.preventDefault();
11090
11120
  const store = getSaltfishStore();
11091
- if (store.currentState === "autoplayBlocked" || store.currentState === "idleMode") {
11092
- store.currentState === "autoplayBlocked" ? "autoplay fallback" : "idle";
11093
- if (this.videoManager) {
11094
- this.videoManager.markUserInteraction();
11095
- this.videoManager.setMuted(false);
11096
- const videoElement = this.videoManager.getVideoElement();
11097
- if (videoElement) {
11098
- videoElement.loop = false;
11099
- videoElement.currentTime = 0;
11100
- }
11101
- } else {
11102
- const videoElement = (_a = this.playerElement) == null ? void 0 : _a.querySelector(".sf-video-container__video");
11103
- if (videoElement) {
11104
- videoElement.muted = false;
11105
- videoElement.loop = false;
11106
- videoElement.currentTime = 0;
11107
- }
11108
- }
11109
- } else {
11110
- if (this.videoManager) {
11111
- this.videoManager.markUserInteraction();
11112
- }
11113
- }
11121
+ this.handleAutoplayFallbackInteraction("center play button");
11114
11122
  if (store.currentState === "paused" || store.currentState === "waitingForInteraction" || store.currentState === "completedWaitingForInteraction" || store.currentState === "autoplayBlocked" || store.currentState === "idleMode" || store.currentState === "error") {
11115
11123
  store.play();
11116
11124
  } else if (store.currentState === "playing") {
@@ -11143,33 +11151,10 @@ class UIManager {
11143
11151
  this.compactLabel.style.cursor = "pointer";
11144
11152
  this.compactLabel.style.pointerEvents = "auto";
11145
11153
  this.compactLabel.addEventListener("click", (e) => {
11146
- var _a2;
11147
11154
  e.stopPropagation();
11148
11155
  e.preventDefault();
11149
11156
  const currentStore = getSaltfishStore();
11150
- if (currentStore.currentState === "autoplayBlocked" || currentStore.currentState === "idleMode") {
11151
- currentStore.currentState === "autoplayBlocked" ? "autoplay fallback" : "idle";
11152
- if (this.videoManager) {
11153
- this.videoManager.markUserInteraction();
11154
- this.videoManager.setMuted(false);
11155
- const videoElement = this.videoManager.getVideoElement();
11156
- if (videoElement) {
11157
- videoElement.loop = false;
11158
- videoElement.currentTime = 0;
11159
- }
11160
- } else {
11161
- const videoElement = (_a2 = this.playerElement) == null ? void 0 : _a2.querySelector(".sf-video-container__video");
11162
- if (videoElement) {
11163
- videoElement.muted = false;
11164
- videoElement.loop = false;
11165
- videoElement.currentTime = 0;
11166
- }
11167
- }
11168
- } else {
11169
- if (this.videoManager) {
11170
- this.videoManager.markUserInteraction();
11171
- }
11172
- }
11157
+ this.handleAutoplayFallbackInteraction("compact label");
11173
11158
  if (currentStore.currentState === "paused" || currentStore.currentState === "waitingForInteraction" || currentStore.currentState === "completedWaitingForInteraction" || currentStore.currentState === "autoplayBlocked" || currentStore.currentState === "idleMode" || currentStore.currentState === "error") {
11174
11159
  currentStore.play();
11175
11160
  }
@@ -11612,7 +11597,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
11612
11597
  __proto__: null,
11613
11598
  SaltfishPlayer
11614
11599
  }, Symbol.toStringTag, { value: "Module" }));
11615
- const version = "0.3.29";
11600
+ const version = "0.3.30";
11616
11601
  const packageJson = {
11617
11602
  version
11618
11603
  };