@obipascal/player 1.0.6 → 1.0.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.
@@ -1,11 +1,11 @@
1
1
  var V = Object.defineProperty;
2
- var N = (l, t, e) => t in l ? V(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
3
- var o = (l, t, e) => N(l, typeof t != "symbol" ? t + "" : t, e);
2
+ var N = (c, t, e) => t in c ? V(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
+ var o = (c, t, e) => N(c, typeof t != "symbol" ? t + "" : t, e);
4
4
  import p from "hls.js";
5
- import { jsx as B } from "react/jsx-runtime";
5
+ import { jsx as F } from "react/jsx-runtime";
6
6
  import * as $ from "react";
7
- import { useRef as w, useEffect as f, useState as b } from "react";
8
- class _ {
7
+ import { useRef as b, useEffect as E, useState as k } from "react";
8
+ class W {
9
9
  constructor(t) {
10
10
  o(this, "config");
11
11
  o(this, "sessionId");
@@ -21,9 +21,9 @@ class _ {
21
21
  this.config = t, this.sessionId = (t == null ? void 0 : t.sessionId) || this.generateSessionId(), this.sessionStartTime = Date.now(), (e = this.config) != null && e.enabled && this.trackEvent("session_start", this.getSessionData());
22
22
  }
23
23
  trackEvent(t, e = {}) {
24
- var i;
25
- if (!((i = this.config) != null && i.enabled)) return;
26
- const n = {
24
+ var n;
25
+ if (!((n = this.config) != null && n.enabled)) return;
26
+ const i = {
27
27
  eventType: t,
28
28
  timestamp: Date.now(),
29
29
  sessionId: this.sessionId,
@@ -34,7 +34,7 @@ class _ {
34
34
  ...this.getQoEMetrics()
35
35
  }
36
36
  };
37
- this.events.push(n), this.updateMetrics(t, e), this.config.endpoint && this.sendEvent(n), process.env.NODE_ENV === "development" && console.log("[Analytics]", t, n.data);
37
+ this.events.push(i), this.updateMetrics(t, e), this.config.endpoint && this.sendEvent(i), process.env.NODE_ENV === "development" && console.log("[Analytics]", t, i.data);
38
38
  }
39
39
  updateMetrics(t, e) {
40
40
  switch (t) {
@@ -97,8 +97,8 @@ class _ {
97
97
  },
98
98
  body: JSON.stringify(t)
99
99
  });
100
- } catch (n) {
101
- console.error("Failed to send analytics event:", n);
100
+ } catch (i) {
101
+ console.error("Failed to send analytics event:", i);
102
102
  }
103
103
  }
104
104
  generateSessionId() {
@@ -119,7 +119,7 @@ class _ {
119
119
  (t = this.config) != null && t.enabled && this.trackEvent("session_end", this.getSessionData()), this.events = [];
120
120
  }
121
121
  }
122
- class Q {
122
+ class j {
123
123
  constructor(t, e) {
124
124
  o(this, "container");
125
125
  o(this, "player");
@@ -130,7 +130,9 @@ class Q {
130
130
  o(this, "skipBackwardButton");
131
131
  o(this, "skipForwardButton");
132
132
  o(this, "volumeButton");
133
+ o(this, "volumeContainer");
133
134
  o(this, "fullscreenButton");
135
+ o(this, "pipButton");
134
136
  o(this, "settingsButton");
135
137
  // private timeDisplay: HTMLElement
136
138
  o(this, "volumeSlider");
@@ -138,23 +140,24 @@ class Q {
138
140
  // private controlsVisible = true
139
141
  o(this, "hideControlsTimeout", null);
140
142
  o(this, "stickyControls", !1);
141
- this.container = t, this.player = e, this.injectStyles(), this.createProgressBar(), this.controlsContainer = this.createControls(), this.container.appendChild(this.controlsContainer), this.playButton = this.controlsContainer.querySelector(".wontum-play-btn"), this.skipBackwardButton = this.controlsContainer.querySelector(".wontum-skip-backward-btn"), this.skipForwardButton = this.controlsContainer.querySelector(".wontum-skip-forward-btn"), this.volumeButton = this.controlsContainer.querySelector(".wontum-volume-btn"), this.fullscreenButton = this.controlsContainer.querySelector(".wontum-fullscreen-btn"), this.settingsButton = this.controlsContainer.querySelector(".wontum-settings-btn"), this.volumeSlider = this.controlsContainer.querySelector(".wontum-volume-slider"), this.progressInput = this.container.querySelector(".wontum-progress-input"), this.progressBar = this.container.querySelector(".wontum-progress-filled"), this.stickyControls = this.player.config.stickyControls || !1, this.stickyControls && this.controlsContainer.classList.add("sticky"), this.setupEventListeners(), this.setupPlayerEventListeners();
143
+ o(this, "isVolumeSliderActive", !1);
144
+ this.container = t, this.player = e, this.injectStyles(), this.createProgressBar(), this.controlsContainer = this.createControls(), this.container.appendChild(this.controlsContainer), this.playButton = this.controlsContainer.querySelector(".wontum-play-btn"), this.skipBackwardButton = this.controlsContainer.querySelector(".wontum-skip-backward-btn"), this.skipForwardButton = this.controlsContainer.querySelector(".wontum-skip-forward-btn"), this.volumeButton = this.controlsContainer.querySelector(".wontum-volume-btn"), this.volumeContainer = this.controlsContainer.querySelector(".wontum-volume-container"), this.fullscreenButton = this.controlsContainer.querySelector(".wontum-fullscreen-btn"), this.pipButton = this.controlsContainer.querySelector(".wontum-pip-btn"), this.settingsButton = this.controlsContainer.querySelector(".wontum-settings-btn"), this.volumeSlider = this.controlsContainer.querySelector(".wontum-volume-slider"), this.progressInput = this.container.querySelector(".wontum-progress-input"), this.progressBar = this.container.querySelector(".wontum-progress-filled"), this.stickyControls = this.player.config.stickyControls || !1, this.stickyControls && this.controlsContainer.classList.add("sticky"), this.setupEventListeners(), this.setupPlayerEventListeners();
142
145
  }
143
146
  injectStyles() {
144
147
  const t = "wontum-player-styles";
145
148
  if (document.getElementById(t)) return;
146
- const e = this.player.config.theme || {}, n = e.primaryColor || "#3b82f6", i = e.accentColor || "#2563eb", s = e.fontFamily || "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", a = e.controlsBackground || "linear-gradient(to top, rgba(0,0,0,0.8), transparent)", r = e.buttonHoverBg || "rgba(255, 255, 255, 0.1)", c = e.progressHeight || "6px", u = e.borderRadius || "4px", m = document.createElement("style");
149
+ const e = this.player.config.theme || {}, i = e.primaryColor || "#3b82f6", n = e.accentColor || "#2563eb", s = e.fontFamily || "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", r = e.controlsBackground || "linear-gradient(to top, rgba(0,0,0,0.8), transparent)", a = e.buttonHoverBg || "rgba(255, 255, 255, 0.1)", l = e.progressHeight || "6px", u = e.borderRadius || "4px", m = document.createElement("style");
147
150
  m.id = t, m.textContent = `
148
151
  .wontum-player-container {
149
152
  position: relative;
150
153
  background: #000;
151
154
  font-family: ${s};
152
155
  overflow: hidden;
153
- --primary-color: ${n};
154
- --accent-color: ${i};
155
- --controls-bg: ${a};
156
- --button-hover: ${r};
157
- --progress-height: ${c};
156
+ --primary-color: ${i};
157
+ --accent-color: ${n};
158
+ --controls-bg: ${r};
159
+ --button-hover: ${a};
160
+ --progress-height: ${l};
158
161
  --border-radius: ${u};
159
162
  }
160
163
 
@@ -246,18 +249,20 @@ class Q {
246
249
  .wontum-progress-container {
247
250
  position: absolute;
248
251
  bottom: 58px;
249
- left: 0;
250
- right: 0;
252
+ left: 50%;
253
+ transform: translateX(-50%);
254
+ width: 70%;
255
+ max-width: 600px;
251
256
  height: 5px;
252
257
  cursor: pointer;
253
258
  z-index: 12;
254
- padding: 0 20px;
259
+ padding: 0;
255
260
  transition: height 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
256
261
  }
257
262
 
258
263
  .wontum-progress-container.hidden {
259
264
  opacity: 0;
260
- transform: translateY(100%);
265
+ transform: translateX(-50%) translateY(100%);
261
266
  pointer-events: none;
262
267
  }
263
268
 
@@ -343,6 +348,7 @@ class Q {
343
348
  position: relative;
344
349
  display: flex;
345
350
  align-items: center;
351
+ gap: 0;
346
352
  }
347
353
 
348
354
  .wontum-volume-slider-wrapper {
@@ -354,18 +360,31 @@ class Q {
354
360
  backdrop-filter: blur(10px);
355
361
  padding: 12px 8px;
356
362
  border-radius: 6px;
357
- margin-bottom: 8px;
363
+ margin-bottom: 5px;
358
364
  opacity: 0;
359
365
  pointer-events: none;
360
366
  transition: opacity 0.2s ease;
361
367
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
368
+ z-index: 20;
362
369
  }
363
370
 
364
- .wontum-volume-container:hover .wontum-volume-slider-wrapper {
371
+ .wontum-volume-container:hover .wontum-volume-slider-wrapper,
372
+ .wontum-volume-slider-wrapper:hover {
365
373
  opacity: 1;
366
374
  pointer-events: all;
367
375
  }
368
376
 
377
+ /* Add a bridge area between button and slider to prevent gap */
378
+ .wontum-volume-container::before {
379
+ content: '';
380
+ position: absolute;
381
+ bottom: 100%;
382
+ left: 0;
383
+ right: 0;
384
+ height: 10px;
385
+ background: transparent;
386
+ }
387
+
369
388
  .wontum-volume-slider {
370
389
  -webkit-appearance: slider-vertical;
371
390
  appearance: slider-vertical;
@@ -688,6 +707,10 @@ class Q {
688
707
  </div>
689
708
  </div>
690
709
 
710
+ <button class="wontum-btn wontum-pip-btn" aria-label="Picture-in-Picture">
711
+ ${this.getPipIcon()}
712
+ </button>
713
+
691
714
  <button class="wontum-btn wontum-fullscreen-btn" aria-label="Fullscreen">
692
715
  ${this.getFullscreenIcon()}
693
716
  </button>
@@ -705,27 +728,43 @@ class Q {
705
728
  this.player.skipBackward(10);
706
729
  }), this.skipForwardButton.addEventListener("click", () => {
707
730
  this.player.skipForward(10);
708
- }), this.progressInput.addEventListener("input", (n) => {
709
- const i = n.target, s = parseFloat(i.value), a = this.player.getState(), r = s / 100 * a.duration;
710
- this.player.seek(r);
711
- }), this.volumeSlider.addEventListener("input", (n) => {
712
- const i = n.target, s = parseFloat(i.value) / 100;
731
+ }), this.progressInput.addEventListener("input", (i) => {
732
+ const n = i.target, s = parseFloat(n.value), r = this.player.getState(), a = s / 100 * r.duration;
733
+ this.player.seek(a);
734
+ }), this.volumeSlider.addEventListener("input", (i) => {
735
+ const n = i.target, s = parseFloat(n.value) / 100;
713
736
  this.player.setVolume(s);
714
737
  }), this.volumeButton.addEventListener("click", () => {
715
738
  this.player.getState().muted ? this.player.unmute() : this.player.mute();
739
+ }), this.volumeContainer.addEventListener("mouseenter", () => {
740
+ this.isVolumeSliderActive = !0;
741
+ }), this.volumeContainer.addEventListener("mouseleave", () => {
742
+ this.isVolumeSliderActive = !1;
743
+ }), this.volumeSlider.addEventListener("input", () => {
744
+ this.isVolumeSliderActive = !0, this.resetHideControlsTimeout();
745
+ }), this.volumeSlider.addEventListener("change", () => {
746
+ setTimeout(() => {
747
+ this.isVolumeSliderActive = !1;
748
+ }, 500);
716
749
  }), this.fullscreenButton.addEventListener("click", () => {
717
750
  this.player.getState().fullscreen ? this.player.exitFullscreen() : this.player.enterFullscreen();
751
+ }), this.pipButton.addEventListener("click", async () => {
752
+ try {
753
+ await this.player.togglePictureInPicture();
754
+ } catch (i) {
755
+ console.error("PiP error:", i);
756
+ }
718
757
  }), this.settingsButton.addEventListener("click", () => {
719
- const n = this.controlsContainer.querySelector(".wontum-settings-panel");
720
- n.classList.toggle("active"), n.classList.contains("active") && (this.updateSettingsMenu(), this.updateQualityMenu(), this.updateSpeedMenu(), this.updateSubtitleMenu());
758
+ const i = this.controlsContainer.querySelector(".wontum-settings-panel");
759
+ i.classList.toggle("active"), i.classList.contains("active") && (this.updateSettingsMenu(), this.updateQualityMenu(), this.updateSpeedMenu(), this.updateSubtitleMenu());
721
760
  });
722
761
  const t = this.controlsContainer.querySelectorAll(".wontum-tab");
723
- t.forEach((n) => {
724
- n.addEventListener("click", (i) => {
725
- const s = i.currentTarget, a = s.getAttribute("data-tab");
762
+ t.forEach((i) => {
763
+ i.addEventListener("click", (n) => {
764
+ const s = n.currentTarget, r = s.getAttribute("data-tab");
726
765
  t.forEach((u) => u.classList.remove("active")), s.classList.add("active"), this.controlsContainer.querySelectorAll(".wontum-tab-panel").forEach((u) => u.classList.remove("active"));
727
- const c = this.controlsContainer.querySelector(`[data-panel="${a}"]`);
728
- c == null || c.classList.add("active");
766
+ const l = this.controlsContainer.querySelector(`[data-panel="${r}"]`);
767
+ l == null || l.classList.add("active");
729
768
  });
730
769
  }), this.player.getVideoElement().addEventListener("click", () => {
731
770
  this.player.getState().playing ? this.player.pause() : this.player.play();
@@ -741,19 +780,19 @@ class Q {
741
780
  }), this.player.on("pause", () => {
742
781
  this.playButton.innerHTML = this.getPlayIcon();
743
782
  }), this.player.on("timeupdate", (t) => {
744
- const { currentTime: e } = t.data, n = this.player.getState();
745
- if (n.duration > 0) {
746
- const s = e / n.duration * 100;
783
+ const { currentTime: e } = t.data, i = this.player.getState();
784
+ if (i.duration > 0) {
785
+ const s = e / i.duration * 100;
747
786
  this.progressBar.style.width = `${s}%`, this.progressInput.value = s.toString();
748
787
  }
749
- const i = this.controlsContainer.querySelector(".wontum-current-time");
750
- i.textContent = this.formatTime(e);
788
+ const n = this.controlsContainer.querySelector(".wontum-current-time");
789
+ n.textContent = this.formatTime(e);
751
790
  }), this.player.on("loadedmetadata", (t) => {
752
- const { duration: e } = t.data, n = this.controlsContainer.querySelector(".wontum-duration");
753
- n.textContent = this.formatTime(e), t.data.qualities && this.updateQualityMenu(t.data.qualities);
791
+ const { duration: e } = t.data, i = this.controlsContainer.querySelector(".wontum-duration");
792
+ i.textContent = this.formatTime(e), t.data.qualities && this.updateQualityMenu(t.data.qualities);
754
793
  }), this.player.on("volumechange", (t) => {
755
- const { volume: e, muted: n } = t.data;
756
- this.volumeSlider.value = (e * 100).toString(), this.volumeButton.innerHTML = n ? this.getMutedIcon() : this.getVolumeIcon();
794
+ const { volume: e, muted: i } = t.data;
795
+ this.volumeSlider.value = (e * 100).toString(), this.volumeButton.innerHTML = i ? this.getMutedIcon() : this.getVolumeIcon();
757
796
  }), this.player.on("waiting", () => {
758
797
  const t = this.controlsContainer.querySelector(".wontum-loading");
759
798
  t.style.display = "block";
@@ -768,35 +807,35 @@ class Q {
768
807
  t.innerHTML = '<div class="wontum-subtitle-option">No subtitles available</div>';
769
808
  return;
770
809
  }
771
- const n = e.findIndex((i) => i.mode === "showing");
810
+ const i = e.findIndex((n) => n.mode === "showing");
772
811
  t.innerHTML = `
773
- <div class="wontum-subtitle-option ${n === -1 ? "active" : ""}" data-track="-1">Off</div>
812
+ <div class="wontum-subtitle-option ${i === -1 ? "active" : ""}" data-track="-1">Off</div>
774
813
  ${e.map(
775
- (i, s) => `
776
- <div class="wontum-subtitle-option ${s === n ? "active" : ""}" data-track="${s}">
777
- ${i.label || i.language || `Track ${s + 1}`}
814
+ (n, s) => `
815
+ <div class="wontum-subtitle-option ${s === i ? "active" : ""}" data-track="${s}">
816
+ ${n.label || n.language || `Track ${s + 1}`}
778
817
  </div>
779
818
  `
780
819
  ).join("")}
781
- `, t.querySelectorAll(".wontum-subtitle-option").forEach((i) => {
782
- i.addEventListener("click", (s) => {
783
- const a = s.target, r = parseInt(a.dataset.track || "-1");
784
- r === -1 ? this.player.disableSubtitles() : this.player.enableSubtitles(r), t.querySelectorAll(".wontum-subtitle-option").forEach((c) => c.classList.remove("active")), a.classList.add("active");
820
+ `, t.querySelectorAll(".wontum-subtitle-option").forEach((n) => {
821
+ n.addEventListener("click", (s) => {
822
+ const r = s.target, a = parseInt(r.dataset.track || "-1");
823
+ a === -1 ? this.player.disableSubtitles() : this.player.enableSubtitles(a), t.querySelectorAll(".wontum-subtitle-option").forEach((l) => l.classList.remove("active")), r.classList.add("active");
785
824
  });
786
825
  });
787
826
  }
788
827
  updateSpeedMenu() {
789
- const t = this.controlsContainer.querySelector(".wontum-speed-menu"), n = this.player.getState().playbackRate || 1, i = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
790
- t.innerHTML = i.map(
828
+ const t = this.controlsContainer.querySelector(".wontum-speed-menu"), i = this.player.getState().playbackRate || 1, n = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
829
+ t.innerHTML = n.map(
791
830
  (s) => `
792
- <div class="wontum-speed-option ${n === s ? "active" : ""}" data-speed="${s}">
831
+ <div class="wontum-speed-option ${i === s ? "active" : ""}" data-speed="${s}">
793
832
  ${s === 1 ? "Normal" : s + "x"}
794
833
  </div>
795
834
  `
796
835
  ).join(""), t.querySelectorAll(".wontum-speed-option").forEach((s) => {
797
- s.addEventListener("click", (a) => {
798
- const r = a.target, c = parseFloat(r.dataset.speed || "1");
799
- this.player.setPlaybackRate(c), t.querySelectorAll(".wontum-speed-option").forEach((u) => u.classList.remove("active")), r.classList.add("active");
836
+ s.addEventListener("click", (r) => {
837
+ const a = r.target, l = parseFloat(a.dataset.speed || "1");
838
+ this.player.setPlaybackRate(l), t.querySelectorAll(".wontum-speed-option").forEach((u) => u.classList.remove("active")), a.classList.add("active");
800
839
  });
801
840
  });
802
841
  }
@@ -814,22 +853,22 @@ class Q {
814
853
  });
815
854
  }
816
855
  updateQualityMenu(t) {
817
- const e = this.controlsContainer.querySelector(".wontum-quality-menu"), n = t || this.player.getQualities();
818
- if (!n || n.length === 0) {
856
+ const e = this.controlsContainer.querySelector(".wontum-quality-menu"), i = t || this.player.getQualities();
857
+ if (!i || i.length === 0) {
819
858
  e.innerHTML = '<div class="wontum-quality-option">No qualities available</div>';
820
859
  return;
821
860
  }
822
861
  e.innerHTML = `
823
862
  <div class="wontum-quality-option active" data-quality="-1">Auto</div>
824
- ${n.map(
825
- (i, s) => `
826
- <div class="wontum-quality-option" data-quality="${s}">${i.name}</div>
863
+ ${i.map(
864
+ (n, s) => `
865
+ <div class="wontum-quality-option" data-quality="${s}">${n.name}</div>
827
866
  `
828
867
  ).join("")}
829
- `, e.querySelectorAll(".wontum-quality-option").forEach((i) => {
830
- i.addEventListener("click", (s) => {
831
- const a = s.target, r = parseInt(a.dataset.quality || "-1");
832
- this.player.setQuality(r), e.querySelectorAll(".wontum-quality-option").forEach((c) => c.classList.remove("active")), a.classList.add("active");
868
+ `, e.querySelectorAll(".wontum-quality-option").forEach((n) => {
869
+ n.addEventListener("click", (s) => {
870
+ const r = s.target, a = parseInt(r.dataset.quality || "-1");
871
+ this.player.setQuality(a), e.querySelectorAll(".wontum-quality-option").forEach((l) => l.classList.remove("active")), r.classList.add("active");
833
872
  });
834
873
  });
835
874
  }
@@ -837,7 +876,7 @@ class Q {
837
876
  this.controlsContainer.classList.remove("hidden"), this.progressContainer.classList.remove("hidden");
838
877
  }
839
878
  hideControls() {
840
- if (this.stickyControls) return;
879
+ if (this.stickyControls || this.isVolumeSliderActive) return;
841
880
  this.player.getState().playing && (this.controlsContainer.classList.add("hidden"), this.progressContainer.classList.add("hidden"));
842
881
  }
843
882
  resetHideControlsTimeout() {
@@ -847,8 +886,8 @@ class Q {
847
886
  }
848
887
  formatTime(t) {
849
888
  if (isNaN(t)) return "0:00";
850
- const e = Math.floor(t / 60), n = Math.floor(t % 60);
851
- return `${e}:${n.toString().padStart(2, "0")}`;
889
+ const e = Math.floor(t / 60), i = Math.floor(t % 60);
890
+ return `${e}:${i.toString().padStart(2, "0")}`;
852
891
  }
853
892
  // SVG Icons
854
893
  getPlayIcon() {
@@ -866,6 +905,9 @@ class Q {
866
905
  getFullscreenIcon() {
867
906
  return '<svg viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>';
868
907
  }
908
+ getPipIcon() {
909
+ return '<svg viewBox="0 0 24 24"><path d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"/></svg>';
910
+ }
869
911
  getSkipBackwardIcon() {
870
912
  return `<svg viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">
871
913
  <circle cx="30" cy="30" r="28" stroke="white" stroke-width="2"/>
@@ -891,7 +933,7 @@ class Q {
891
933
  this.hideControlsTimeout && clearTimeout(this.hideControlsTimeout), this.controlsContainer.remove();
892
934
  }
893
935
  }
894
- class j {
936
+ class Q {
895
937
  constructor(t) {
896
938
  o(this, "config");
897
939
  o(this, "urlCache", /* @__PURE__ */ new Map());
@@ -912,8 +954,8 @@ class j {
912
954
  if (!((e = this.config) != null && e.cloudFrontDomains) || this.config.cloudFrontDomains.length === 0)
913
955
  return !1;
914
956
  try {
915
- const n = new URL(t);
916
- return this.config.cloudFrontDomains.some((i) => n.hostname.includes(i));
957
+ const i = new URL(t);
958
+ return this.config.cloudFrontDomains.some((n) => i.hostname.includes(n));
917
959
  } catch {
918
960
  return !1;
919
961
  }
@@ -929,20 +971,20 @@ class j {
929
971
  * The endpoint should set signed cookies and return the URL
930
972
  */
931
973
  async signCloudFrontUrl(t, e = 0) {
932
- var s, a;
974
+ var s, r;
933
975
  if (this.signedUrls.has(t))
934
976
  return t;
935
977
  if ((s = this.config) != null && s.signUrl)
936
978
  try {
937
- const r = await this.config.signUrl(t);
938
- return this.signedUrls.add(t), r;
939
- } catch (r) {
940
- const c = (r == null ? void 0 : r.name) === "AbortError" || ((a = r == null ? void 0 : r.message) == null ? void 0 : a.includes("aborted"));
941
- if (c && e < 2)
979
+ const a = await this.config.signUrl(t);
980
+ return this.signedUrls.add(t), a;
981
+ } catch (a) {
982
+ const l = (a == null ? void 0 : a.name) === "AbortError" || ((r = a == null ? void 0 : a.message) == null ? void 0 : r.includes("aborted"));
983
+ if (l && e < 2)
942
984
  return console.warn(`Sign URL aborted, retrying (${e + 1}/2)...`), await new Promise((u) => setTimeout(u, 300)), this.signCloudFrontUrl(t, e + 1);
943
- throw console.error("Failed to sign CloudFront URL:", r), c ? new Error(
985
+ throw console.error("Failed to sign CloudFront URL:", a), l ? new Error(
944
986
  "Failed to sign CloudFront URL: Request was aborted. If using Apollo Client or other GraphQL clients, consider moving the query outside component lifecycle or using useQuery with skip option."
945
- ) : new Error(`Failed to sign CloudFront URL: ${(r == null ? void 0 : r.message) || "Unknown error"}`);
987
+ ) : new Error(`Failed to sign CloudFront URL: ${(a == null ? void 0 : a.message) || "Unknown error"}`);
946
988
  }
947
989
  return console.warn("No signUrl function provided. CloudFront cookies may not be set."), t;
948
990
  }
@@ -955,18 +997,18 @@ class j {
955
997
  const e = t.match(/s3[.-]([^.]+)\.amazonaws\.com\/(.+)/);
956
998
  if (e)
957
999
  return e[2];
958
- const n = t.match(/([^.]+)\.s3\.amazonaws\.com\/(.+)/);
959
- return n ? n[2] : t;
1000
+ const i = t.match(/([^.]+)\.s3\.amazonaws\.com\/(.+)/);
1001
+ return i ? i[2] : t;
960
1002
  }
961
1003
  /**
962
1004
  * Get presigned URL from cache or generate new one
963
1005
  */
964
1006
  async getPresignedUrl(t) {
965
- var i;
966
- const e = this.extractS3Key(t), n = this.urlCache.get(e);
967
- if (n && n.expiresAt > Date.now())
968
- return n.url;
969
- if ((i = this.config) != null && i.getPresignedUrl)
1007
+ var n;
1008
+ const e = this.extractS3Key(t), i = this.urlCache.get(e);
1009
+ if (i && i.expiresAt > Date.now())
1010
+ return i.url;
1011
+ if ((n = this.config) != null && n.getPresignedUrl)
970
1012
  try {
971
1013
  const s = await this.config.getPresignedUrl(e);
972
1014
  return this.urlCache.set(e, {
@@ -981,8 +1023,8 @@ class j {
981
1023
  /**
982
1024
  * Helper to construct S3 URL from bucket and key
983
1025
  */
984
- static constructS3Url(t, e, n = "us-east-1") {
985
- return `https://${t}.s3.${n}.amazonaws.com/${e}`;
1026
+ static constructS3Url(t, e, i = "us-east-1") {
1027
+ return `https://${t}.s3.${i}.amazonaws.com/${e}`;
986
1028
  }
987
1029
  /**
988
1030
  * Helper to parse S3 URI (s3://bucket/key)
@@ -990,8 +1032,8 @@ class j {
990
1032
  static parseS3Uri(t) {
991
1033
  if (!t.startsWith("s3://"))
992
1034
  return null;
993
- const e = t.replace("s3://", "").split("/"), n = e[0], i = e.slice(1).join("/");
994
- return { bucket: n, key: i };
1035
+ const e = t.replace("s3://", "").split("/"), i = e[0], n = e.slice(1).join("/");
1036
+ return { bucket: i, key: n };
995
1037
  }
996
1038
  /**
997
1039
  * Clear URL cache and signed URLs
@@ -1000,7 +1042,7 @@ class j {
1000
1042
  this.urlCache.clear(), this.signedUrls.clear();
1001
1043
  }
1002
1044
  }
1003
- class F {
1045
+ class A {
1004
1046
  constructor(t) {
1005
1047
  o(this, "container");
1006
1048
  o(this, "videoElement");
@@ -1027,12 +1069,12 @@ class F {
1027
1069
  });
1028
1070
  if (this.config = t, this.container = typeof t.container == "string" ? document.querySelector(t.container) : t.container, !this.container)
1029
1071
  throw new Error("Container element not found");
1030
- this.analytics = new _(t.analytics), this.s3Handler = new j(t.s3Config), this.videoElement = this.createVideoElement(), this.container.appendChild(this.videoElement), this.uiController = new Q(this.container, this), this.setupVideoListeners(), this.loadSource(t.src), t.autoplay && (this.videoElement.autoplay = !0), t.muted && this.mute(), t.poster && (this.videoElement.poster = t.poster), t.preload && (this.videoElement.preload = t.preload), t.subtitles && this.addSubtitleTracks(t.subtitles);
1072
+ this.analytics = new W(t.analytics), this.s3Handler = new Q(t.s3Config), this.videoElement = this.createVideoElement(), this.container.appendChild(this.videoElement), this.uiController = new j(this.container, this), this.setupVideoListeners(), this.loadSource(t.src), t.autoplay && (this.videoElement.autoplay = !0), t.muted && this.mute(), t.poster && (this.videoElement.poster = t.poster), t.preload && (this.videoElement.preload = t.preload), t.subtitles && this.addSubtitleTracks(t.subtitles);
1031
1073
  }
1032
1074
  addSubtitleTracks(t) {
1033
1075
  t.forEach((e) => {
1034
- const n = document.createElement("track");
1035
- n.kind = "subtitles", n.label = e.label, n.src = e.src, n.srclang = e.srclang, e.default && (n.default = !0), this.videoElement.appendChild(n);
1076
+ const i = document.createElement("track");
1077
+ i.kind = "subtitles", i.label = e.label, i.src = e.src, i.srclang = e.srclang, e.default && (i.default = !0), this.videoElement.appendChild(i);
1036
1078
  });
1037
1079
  }
1038
1080
  createVideoElement() {
@@ -1093,32 +1135,33 @@ class F {
1093
1135
  });
1094
1136
  }
1095
1137
  async loadSource(t) {
1138
+ var e;
1096
1139
  try {
1097
- const e = await this.s3Handler.processUrl(t);
1140
+ const i = await this.s3Handler.processUrl(t);
1098
1141
  if (p.isSupported()) {
1099
- const n = {
1142
+ const n = ((e = this.config.s3Config) == null ? void 0 : e.withCredentials) ?? !1, s = {
1100
1143
  ...this.config.hlsConfig,
1101
- xhrSetup: (i, s) => {
1102
- var a;
1103
- i.withCredentials = !0, (a = this.config.hlsConfig) != null && a.xhrSetup && this.config.hlsConfig.xhrSetup(i, s);
1144
+ xhrSetup: (r, a) => {
1145
+ var l;
1146
+ n && (r.withCredentials = !0), (l = this.config.hlsConfig) != null && l.xhrSetup && this.config.hlsConfig.xhrSetup(r, a);
1104
1147
  }
1105
1148
  };
1106
- this.hls = new p(n), this.hls.loadSource(e), this.hls.attachMedia(this.videoElement), this.hls.on(p.Events.MANIFEST_PARSED, (i, s) => {
1107
- const a = this.extractQualities(s.levels);
1108
- this.qualities = a;
1109
- }), this.hls.on(p.Events.LEVEL_SWITCHED, (i, s) => {
1110
- var r;
1111
- const a = (r = this.hls) == null ? void 0 : r.levels[s.level];
1112
- a && (this.state.quality = `${a.height}p`, this.emit("qualitychange", { quality: this.state.quality }));
1113
- }), this.hls.on(p.Events.ERROR, (i, s) => {
1114
- s.fatal && this.handleHlsError(s);
1149
+ this.hls = new p(s), this.hls.loadSource(i), this.hls.attachMedia(this.videoElement), this.hls.on(p.Events.MANIFEST_PARSED, (r, a) => {
1150
+ const l = this.extractQualities(a.levels);
1151
+ this.qualities = l;
1152
+ }), this.hls.on(p.Events.LEVEL_SWITCHED, (r, a) => {
1153
+ var u;
1154
+ const l = (u = this.hls) == null ? void 0 : u.levels[a.level];
1155
+ l && (this.state.quality = `${l.height}p`, this.emit("qualitychange", { quality: this.state.quality }));
1156
+ }), this.hls.on(p.Events.ERROR, (r, a) => {
1157
+ a.fatal && this.handleHlsError(a);
1115
1158
  });
1116
1159
  } else if (this.videoElement.canPlayType("application/vnd.apple.mpegurl"))
1117
- this.videoElement.src = e;
1160
+ this.videoElement.src = i;
1118
1161
  else
1119
1162
  throw new Error("HLS is not supported in this browser");
1120
- } catch (e) {
1121
- console.error("Failed to load video source:", e), this.emit("error", { error: e });
1163
+ } catch (i) {
1164
+ console.error("Failed to load video source:", i), this.emit("error", { error: i });
1122
1165
  }
1123
1166
  }
1124
1167
  extractQualities(t) {
@@ -1130,13 +1173,13 @@ class F {
1130
1173
  }));
1131
1174
  }
1132
1175
  handleHlsError(t) {
1133
- var e, n;
1176
+ var e, i;
1134
1177
  switch (t.type) {
1135
1178
  case p.ErrorTypes.NETWORK_ERROR:
1136
1179
  console.error("Network error occurred"), (e = this.hls) == null || e.startLoad();
1137
1180
  break;
1138
1181
  case p.ErrorTypes.MEDIA_ERROR:
1139
- console.error("Media error occurred"), (n = this.hls) == null || n.recoverMediaError();
1182
+ console.error("Media error occurred"), (i = this.hls) == null || i.recoverMediaError();
1140
1183
  break;
1141
1184
  default:
1142
1185
  console.error("Fatal error occurred:", t), this.destroy();
@@ -1195,6 +1238,25 @@ class F {
1195
1238
  exitFullscreen() {
1196
1239
  document.exitFullscreen && (document.exitFullscreen(), this.state.fullscreen = !1, this.emit("fullscreenchange", { fullscreen: !1 }));
1197
1240
  }
1241
+ async enterPictureInPicture() {
1242
+ if (document.pictureInPictureEnabled && !this.videoElement.disablePictureInPicture)
1243
+ try {
1244
+ await this.videoElement.requestPictureInPicture(), this.emit("pictureinpictureenter", {});
1245
+ } catch (t) {
1246
+ throw console.error("Failed to enter Picture-in-Picture:", t), t;
1247
+ }
1248
+ }
1249
+ async exitPictureInPicture() {
1250
+ if (document.pictureInPictureElement)
1251
+ try {
1252
+ await document.exitPictureInPicture(), this.emit("pictureinpictureexit", {});
1253
+ } catch (t) {
1254
+ throw console.error("Failed to exit Picture-in-Picture:", t), t;
1255
+ }
1256
+ }
1257
+ async togglePictureInPicture() {
1258
+ document.pictureInPictureElement ? await this.exitPictureInPicture() : await this.enterPictureInPicture();
1259
+ }
1198
1260
  getState() {
1199
1261
  return { ...this.state };
1200
1262
  }
@@ -1206,8 +1268,8 @@ class F {
1206
1268
  */
1207
1269
  enableSubtitles(t) {
1208
1270
  const e = this.videoElement.textTracks;
1209
- for (let n = 0; n < e.length; n++)
1210
- e[n].mode = n === t ? "showing" : "hidden";
1271
+ for (let i = 0; i < e.length; i++)
1272
+ e[i].mode = i === t ? "showing" : "hidden";
1211
1273
  }
1212
1274
  /**
1213
1275
  * Disable all subtitles
@@ -1222,7 +1284,7 @@ class F {
1222
1284
  */
1223
1285
  toggleSubtitles() {
1224
1286
  const t = this.videoElement.textTracks;
1225
- return Array.from(t).some((n) => n.mode === "showing") ? (this.disableSubtitles(), !1) : t.length > 0 ? (this.enableSubtitles(0), !0) : !1;
1287
+ return Array.from(t).some((i) => i.mode === "showing") ? (this.disableSubtitles(), !1) : t.length > 0 ? (this.enableSubtitles(0), !0) : !1;
1226
1288
  }
1227
1289
  /**
1228
1290
  * Get available subtitle tracks
@@ -1241,132 +1303,300 @@ class F {
1241
1303
  this.eventListeners.has(t) || this.eventListeners.set(t, /* @__PURE__ */ new Set()), this.eventListeners.get(t).add(e);
1242
1304
  }
1243
1305
  off(t, e) {
1244
- var n;
1245
- (n = this.eventListeners.get(t)) == null || n.delete(e);
1306
+ var i;
1307
+ (i = this.eventListeners.get(t)) == null || i.delete(e);
1246
1308
  }
1247
1309
  emit(t, e) {
1248
- var i;
1249
- const n = {
1310
+ var n;
1311
+ const i = {
1250
1312
  type: t,
1251
1313
  data: e,
1252
1314
  timestamp: Date.now()
1253
1315
  };
1254
- (i = this.eventListeners.get(t)) == null || i.forEach((s) => {
1255
- s(n);
1316
+ (n = this.eventListeners.get(t)) == null || n.forEach((s) => {
1317
+ s(i);
1256
1318
  });
1257
1319
  }
1258
1320
  destroy() {
1259
1321
  this.hls && (this.hls.destroy(), this.hls = null), this.uiController.destroy(), this.videoElement.remove(), this.eventListeners.clear(), this.analytics.destroy();
1260
1322
  }
1261
1323
  }
1262
- const K = (l) => {
1324
+ class G {
1325
+ constructor(t) {
1326
+ o(this, "file");
1327
+ o(this, "videoElement", null);
1328
+ o(this, "info", null);
1329
+ if (!this.isVideoFile(t))
1330
+ throw new Error(`Invalid file type: ${t.type}. Expected a video file.`);
1331
+ this.file = t;
1332
+ }
1333
+ /**
1334
+ * Check if the file is a valid video file
1335
+ */
1336
+ isVideoFile(t) {
1337
+ if (t.type.startsWith("video/"))
1338
+ return !0;
1339
+ const e = [".mp4", ".webm", ".ogg", ".mov", ".avi", ".mkv", ".flv", ".wmv", ".m4v", ".3gp", ".ts", ".m3u8"], i = t.name.toLowerCase();
1340
+ return e.some((n) => i.endsWith(n));
1341
+ }
1342
+ /**
1343
+ * Extract video metadata
1344
+ */
1345
+ async extract() {
1346
+ return new Promise((t, e) => {
1347
+ try {
1348
+ this.videoElement = document.createElement("video"), this.videoElement.preload = "metadata", this.videoElement.muted = !0;
1349
+ const i = URL.createObjectURL(this.file);
1350
+ this.videoElement.onloadedmetadata = () => {
1351
+ try {
1352
+ if (!this.videoElement) {
1353
+ e(new Error("Video element not initialized"));
1354
+ return;
1355
+ }
1356
+ const n = this.videoElement.videoWidth, s = this.videoElement.videoHeight, r = this.videoElement.duration, a = this.calculateAspectRatio(n, s), l = this.file.size, u = this.formatBytes(l), m = this.formatDuration(r), g = this.getFileExtension(this.file.name), v = r > 0 ? Math.round(l * 8 / r / 1e3) : void 0;
1357
+ this.info = {
1358
+ width: n,
1359
+ height: s,
1360
+ aspectRatio: a,
1361
+ size: l,
1362
+ sizeInBytes: l,
1363
+ // raw value alias
1364
+ sizeFormatted: u,
1365
+ duration: r,
1366
+ durationInSeconds: r,
1367
+ // raw value alias
1368
+ durationFormatted: m,
1369
+ mimeType: this.file.type || "video/unknown",
1370
+ fileName: this.file.name,
1371
+ fileExtension: g,
1372
+ bitrate: v
1373
+ }, URL.revokeObjectURL(i), this.videoElement.remove(), t(this.info);
1374
+ } catch (n) {
1375
+ URL.revokeObjectURL(i), e(n);
1376
+ }
1377
+ }, this.videoElement.onerror = () => {
1378
+ URL.revokeObjectURL(i), e(new Error(`Failed to load video file: ${this.file.name}`));
1379
+ }, this.videoElement.src = i;
1380
+ } catch (i) {
1381
+ e(i);
1382
+ }
1383
+ });
1384
+ }
1385
+ /**
1386
+ * Calculate aspect ratio (e.g., "16:9", "4:3")
1387
+ */
1388
+ calculateAspectRatio(t, e) {
1389
+ const i = this.getGCD(t, e), n = t / i, s = e / i, r = n / s;
1390
+ return Math.abs(r - 16 / 9) < 0.01 ? "16:9" : Math.abs(r - 4 / 3) < 0.01 ? "4:3" : Math.abs(r - 21 / 9) < 0.01 ? "21:9" : Math.abs(r - 1) < 0.01 ? "1:1" : `${n}:${s}`;
1391
+ }
1392
+ /**
1393
+ * Get Greatest Common Divisor
1394
+ */
1395
+ getGCD(t, e) {
1396
+ return e === 0 ? t : this.getGCD(e, t % e);
1397
+ }
1398
+ /**
1399
+ * Format bytes to human-readable size
1400
+ */
1401
+ formatBytes(t) {
1402
+ if (t === 0) return "0 Bytes";
1403
+ const e = 1024, i = ["Bytes", "KB", "MB", "GB", "TB"], n = Math.floor(Math.log(t) / Math.log(e));
1404
+ return `${parseFloat((t / Math.pow(e, n)).toFixed(2))} ${i[n]}`;
1405
+ }
1406
+ /**
1407
+ * Format duration to HH:MM:SS
1408
+ */
1409
+ formatDuration(t) {
1410
+ if (!isFinite(t) || t < 0) return "00:00";
1411
+ const e = Math.floor(t / 3600), i = Math.floor(t % 3600 / 60), n = Math.floor(t % 60);
1412
+ return e > 0 ? `${e.toString().padStart(2, "0")}:${i.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}` : `${i.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}`;
1413
+ }
1414
+ /**
1415
+ * Get file extension
1416
+ */
1417
+ getFileExtension(t) {
1418
+ const e = t.split(".");
1419
+ return e.length > 1 ? `.${e[e.length - 1].toLowerCase()}` : "";
1420
+ }
1421
+ // Getter properties for convenience
1422
+ get width() {
1423
+ var t;
1424
+ return ((t = this.info) == null ? void 0 : t.width) || 0;
1425
+ }
1426
+ get height() {
1427
+ var t;
1428
+ return ((t = this.info) == null ? void 0 : t.height) || 0;
1429
+ }
1430
+ get aspectRatio() {
1431
+ var t;
1432
+ return ((t = this.info) == null ? void 0 : t.aspectRatio) || "unknown";
1433
+ }
1434
+ get size() {
1435
+ var t;
1436
+ return ((t = this.info) == null ? void 0 : t.size) || 0;
1437
+ }
1438
+ get sizeInBytes() {
1439
+ var t;
1440
+ return ((t = this.info) == null ? void 0 : t.sizeInBytes) || 0;
1441
+ }
1442
+ get sizeFormatted() {
1443
+ var t;
1444
+ return ((t = this.info) == null ? void 0 : t.sizeFormatted) || "0 Bytes";
1445
+ }
1446
+ get duration() {
1447
+ var t;
1448
+ return ((t = this.info) == null ? void 0 : t.duration) || 0;
1449
+ }
1450
+ get durationInSeconds() {
1451
+ var t;
1452
+ return ((t = this.info) == null ? void 0 : t.durationInSeconds) || 0;
1453
+ }
1454
+ get durationFormatted() {
1455
+ var t;
1456
+ return ((t = this.info) == null ? void 0 : t.durationFormatted) || "00:00";
1457
+ }
1458
+ get mimeType() {
1459
+ var t;
1460
+ return ((t = this.info) == null ? void 0 : t.mimeType) || this.file.type || "video/unknown";
1461
+ }
1462
+ get fileName() {
1463
+ return this.file.name;
1464
+ }
1465
+ get fileExtension() {
1466
+ var t;
1467
+ return ((t = this.info) == null ? void 0 : t.fileExtension) || "";
1468
+ }
1469
+ get bitrate() {
1470
+ var t;
1471
+ return (t = this.info) == null ? void 0 : t.bitrate;
1472
+ }
1473
+ get quality() {
1474
+ if (!this.info) return "unknown";
1475
+ const t = this.info.height;
1476
+ return t >= 2160 ? "4K (2160p)" : t >= 1440 ? "2K (1440p)" : t >= 1080 ? "Full HD (1080p)" : t >= 720 ? "HD (720p)" : t >= 480 ? "SD (480p)" : t >= 360 ? "360p" : "Low Quality";
1477
+ }
1478
+ /**
1479
+ * Get all information as object
1480
+ */
1481
+ getInfo() {
1482
+ return this.info;
1483
+ }
1484
+ /**
1485
+ * Clean up resources
1486
+ */
1487
+ destroy() {
1488
+ this.videoElement && (this.videoElement.remove(), this.videoElement = null), this.info = null;
1489
+ }
1490
+ }
1491
+ const K = (c) => {
1263
1492
  const {
1264
1493
  src: t,
1265
1494
  autoplay: e,
1266
- muted: n,
1267
- controls: i = !0,
1495
+ muted: i,
1496
+ controls: n = !0,
1268
1497
  poster: s,
1269
- preload: a,
1270
- theme: r,
1271
- s3Config: c,
1498
+ preload: r,
1499
+ theme: a,
1500
+ s3Config: l,
1272
1501
  analytics: u,
1273
1502
  hlsConfig: m,
1274
- subtitles: P,
1275
- stickyControls: U,
1276
- onReady: k,
1277
- onPlay: E,
1278
- onPause: x,
1279
- onEnded: S,
1280
- onTimeUpdate: C,
1281
- onVolumeChange: L,
1282
- onError: T,
1503
+ subtitles: g,
1504
+ stickyControls: v,
1505
+ onReady: x,
1506
+ onPlay: S,
1507
+ onPause: C,
1508
+ onEnded: L,
1509
+ onTimeUpdate: T,
1510
+ onVolumeChange: I,
1511
+ onError: M,
1283
1512
  onLoadedMetadata: q,
1284
- onQualityChange: M,
1285
- style: z,
1513
+ onQualityChange: P,
1514
+ style: U,
1286
1515
  className: D,
1287
- width: g = "100%",
1288
- height: v = "500px"
1289
- } = l, y = w(null), R = w(null);
1290
- return f(() => {
1516
+ width: f = "100%",
1517
+ height: w = "500px"
1518
+ } = c, y = b(null), B = b(null);
1519
+ return E(() => {
1291
1520
  if (!y.current) return;
1292
1521
  const H = {
1293
1522
  src: t,
1294
1523
  container: y.current,
1295
1524
  autoplay: e,
1296
- muted: n,
1297
- controls: i,
1525
+ muted: i,
1526
+ controls: n,
1298
1527
  poster: s,
1299
- preload: a,
1300
- theme: r,
1301
- s3Config: c,
1528
+ preload: r,
1529
+ theme: a,
1530
+ s3Config: l,
1302
1531
  analytics: u,
1303
1532
  hlsConfig: m,
1304
- subtitles: P,
1305
- stickyControls: U
1306
- }, d = new F(H);
1307
- return R.current = d, E && d.on("play", E), x && d.on("pause", x), S && d.on("ended", S), T && d.on("error", (h) => {
1308
- var I;
1309
- return T((I = h.data) == null ? void 0 : I.error);
1310
- }), q && d.on("loadedmetadata", q), M && d.on("qualitychange", (h) => M(h.data.level)), C && d.on("timeupdate", (h) => C(h.data.currentTime)), L && d.on("volumechange", (h) => L(h.data.volume, h.data.muted)), k && k(d), () => {
1311
- d.destroy(), R.current = null;
1533
+ subtitles: g,
1534
+ stickyControls: v
1535
+ }, d = new A(H);
1536
+ return B.current = d, S && d.on("play", S), C && d.on("pause", C), L && d.on("ended", L), M && d.on("error", (h) => {
1537
+ var R;
1538
+ return M((R = h.data) == null ? void 0 : R.error);
1539
+ }), q && d.on("loadedmetadata", q), P && d.on("qualitychange", (h) => P(h.data.level)), T && d.on("timeupdate", (h) => T(h.data.currentTime)), I && d.on("volumechange", (h) => I(h.data.volume, h.data.muted)), x && x(d), () => {
1540
+ d.destroy(), B.current = null;
1312
1541
  };
1313
- }, [t]), /* @__PURE__ */ B(
1542
+ }, [t]), /* @__PURE__ */ F(
1314
1543
  "div",
1315
1544
  {
1316
1545
  ref: y,
1317
1546
  className: D,
1318
1547
  style: {
1319
- width: typeof g == "number" ? `${g}px` : g,
1320
- height: typeof v == "number" ? `${v}px` : v,
1321
- ...z
1548
+ width: typeof f == "number" ? `${f}px` : f,
1549
+ height: typeof w == "number" ? `${w}px` : w,
1550
+ ...U
1322
1551
  }
1323
1552
  }
1324
1553
  );
1325
- }, G = (l) => {
1326
- const [t, e] = b(null), [n, i] = b(null), s = w(null);
1327
- return f(() => {
1554
+ }, J = (c) => {
1555
+ const [t, e] = k(null), [i, n] = k(null), s = b(null);
1556
+ return E(() => {
1328
1557
  if (!s.current) return;
1329
- const a = new F({
1330
- ...l,
1558
+ const r = new A({
1559
+ ...c,
1331
1560
  container: s.current
1332
1561
  });
1333
- e(a);
1334
- const r = () => {
1335
- i(a.getState());
1562
+ e(r);
1563
+ const a = () => {
1564
+ n(r.getState());
1336
1565
  };
1337
- return a.on("play", r), a.on("pause", r), a.on("timeupdate", r), a.on("volumechange", r), a.on("loadedmetadata", r), () => {
1338
- a.destroy();
1566
+ return r.on("play", a), r.on("pause", a), r.on("timeupdate", a), r.on("volumechange", a), r.on("loadedmetadata", a), () => {
1567
+ r.destroy();
1339
1568
  };
1340
- }, [l.src]), {
1569
+ }, [c.src]), {
1341
1570
  containerRef: s,
1342
1571
  player: t,
1343
- state: n
1572
+ state: i
1344
1573
  };
1345
- }, A = $.createContext({
1574
+ }, z = $.createContext({
1346
1575
  player: null,
1347
1576
  state: null
1348
- }), J = (l) => {
1349
- const { player: t, children: e } = l, [n, i] = b(t.getState());
1350
- return f(() => {
1577
+ }), Z = (c) => {
1578
+ const { player: t, children: e } = c, [i, n] = k(t.getState());
1579
+ return E(() => {
1351
1580
  const s = () => {
1352
- i(t.getState());
1581
+ n(t.getState());
1353
1582
  };
1354
1583
  return t.on("play", s), t.on("pause", s), t.on("timeupdate", s), t.on("volumechange", s), t.on("loadedmetadata", s), () => {
1355
1584
  };
1356
- }, [t]), /* @__PURE__ */ B(A.Provider, { value: { player: t, state: n }, children: e });
1357
- }, Z = () => {
1358
- const l = $.useContext(A);
1359
- if (!l.player)
1585
+ }, [t]), /* @__PURE__ */ F(z.Provider, { value: { player: t, state: i }, children: e });
1586
+ }, tt = () => {
1587
+ const c = $.useContext(z);
1588
+ if (!c.player)
1360
1589
  throw new Error("useWontumPlayerContext must be used within WontumPlayerProvider");
1361
- return l;
1590
+ return c;
1362
1591
  };
1363
1592
  export {
1364
- _ as Analytics,
1365
- j as S3Handler,
1366
- Q as UIController,
1367
- F as WontumPlayer,
1368
- J as WontumPlayerProvider,
1593
+ W as Analytics,
1594
+ Q as S3Handler,
1595
+ j as UIController,
1596
+ G as WontumFileInfo,
1597
+ A as WontumPlayer,
1598
+ Z as WontumPlayerProvider,
1369
1599
  K as WontumPlayerReact,
1370
- G as useWontumPlayer,
1371
- Z as useWontumPlayerContext
1600
+ J as useWontumPlayer,
1601
+ tt as useWontumPlayerContext
1372
1602
  };