@oddin-gg/havik-player 2.1.1 → 2.1.2

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/dist/index.d.cts CHANGED
@@ -162,8 +162,15 @@ export declare interface CreatePlayerOptions {
162
162
  /** Stats sampling cadence. Default: 2000ms. */
163
163
  statsIntervalMs?: number;
164
164
  /**
165
- * How often to silently refresh the signed DRM license URL for long live
166
- * sessions (the HMAC expires ~10min). Default: 8min. Set 0 to disable.
165
+ * How often to silently re-resolve playback so the signed DRM license URL
166
+ * the player would use next stays inside its signature lifetime (~10 min).
167
+ * Default: 8 min. Set 0 to disable.
168
+ *
169
+ * This refreshes the URL, not the license. It gives the player a newer URL
170
+ * for the next license request it makes, and issues none of its own, so it
171
+ * cannot extend a license the CDM already holds: how long that stays valid
172
+ * is set when it is issued, server-side. A session that outlasts its license
173
+ * ends with a fatal `DRM_CLIENT` error whatever this is set to.
167
174
  */
168
175
  licenseRefreshMs?: number;
169
176
  /**
package/dist/index.d.ts CHANGED
@@ -162,8 +162,15 @@ export declare interface CreatePlayerOptions {
162
162
  /** Stats sampling cadence. Default: 2000ms. */
163
163
  statsIntervalMs?: number;
164
164
  /**
165
- * How often to silently refresh the signed DRM license URL for long live
166
- * sessions (the HMAC expires ~10min). Default: 8min. Set 0 to disable.
165
+ * How often to silently re-resolve playback so the signed DRM license URL
166
+ * the player would use next stays inside its signature lifetime (~10 min).
167
+ * Default: 8 min. Set 0 to disable.
168
+ *
169
+ * This refreshes the URL, not the license. It gives the player a newer URL
170
+ * for the next license request it makes, and issues none of its own, so it
171
+ * cannot extend a license the CDM already holds: how long that stays valid
172
+ * is set when it is issued, server-side. A session that outlasts its license
173
+ * ends with a fatal `DRM_CLIENT` error whatever this is set to.
167
174
  */
168
175
  licenseRefreshMs?: number;
169
176
  /**
package/dist/index.js CHANGED
@@ -1405,6 +1405,7 @@ var at = class {
1405
1405
  rebufferCount = 0;
1406
1406
  rebufferTotalMs = 0;
1407
1407
  bufferingSinceMs = null;
1408
+ isBuffering = !1;
1408
1409
  errorCount = 0;
1409
1410
  seekCount = 0;
1410
1411
  pauseCount = 0;
@@ -1445,7 +1446,7 @@ var at = class {
1445
1446
  firstFragLoadMs = 0;
1446
1447
  onPagehide = () => this.end("END_REASON_PAGEHIDE");
1447
1448
  onVisibility = () => {
1448
- typeof document > "u" || (document.visibilityState === "hidden" ? (this.hiddenSinceMs === null && (this.hiddenSinceMs = this.now()), this.isHidden = !0) : (this.hiddenSinceMs !== null && (this.hiddenTotalMs += this.now() - this.hiddenSinceMs, this.hiddenSinceMs = null), this.isHidden = !1), this.syncActive());
1449
+ typeof document > "u" || (document.visibilityState === "hidden" ? (this.hiddenSinceMs === null && (this.hiddenSinceMs = this.now()), this.isHidden = !0) : (this.hiddenSinceMs !== null && (this.hiddenTotalMs += this.now() - this.hiddenSinceMs, this.hiddenSinceMs = null), this.isHidden = !1), this.syncActive(), this.syncBuffering());
1449
1450
  };
1450
1451
  constructor(e) {
1451
1452
  this.opts = {
@@ -1465,7 +1466,7 @@ var at = class {
1465
1466
  noteStateChange(e, t, n, r) {
1466
1467
  if (this.endedFlag || e === t) return;
1467
1468
  let i = this.now();
1468
- t === "playing" ? (this.playingSinceMs === null && (this.playingSinceMs = i), this.startupTimeMs === 0 && (this.startupTimeMs = Math.max(H, i - this.bornMs)), this.firstAudioMs === 0 && !this.isMuted && (this.firstAudioMs = Math.max(H, i - this.bornMs)), this.isMuted && this.mutedSinceMs === null && (this.mutedSinceMs = i)) : this.playingSinceMs !== null && (this.playingTotalMs += i - this.playingSinceMs, this.playingSinceMs = null, this.mutedSinceMs !== null && (this.mutedTotalMs += i - this.mutedSinceMs, this.mutedSinceMs = null)), this.isPlaying = t === "playing", this.syncActive(), t === "waiting" ? this.waitingSinceMs = i : this.waitingSinceMs !== null && (this.waitingTotalMs += i - this.waitingSinceMs, this.waitingSinceMs = null), t === "buffering" && e === "playing" ? (this.rebufferCount += 1, this.bufferingSinceMs = i, this.lastStallMs = i, this.timeToFirstStallMs === 0 && (this.timeToFirstStallMs = Math.max(H, Math.round(this.playingTotalMs)))) : e === "buffering" && this.bufferingSinceMs !== null && (this.rebufferTotalMs += i - this.bufferingSinceMs, this.bufferingSinceMs = null), t === "paused" && (this.pauseCount += 1);
1469
+ t === "playing" ? (this.playingSinceMs === null && (this.playingSinceMs = i), this.startupTimeMs === 0 && (this.startupTimeMs = Math.max(H, i - this.bornMs)), this.firstAudioMs === 0 && !this.isMuted && (this.firstAudioMs = Math.max(H, i - this.bornMs)), this.isMuted && this.mutedSinceMs === null && (this.mutedSinceMs = i)) : this.playingSinceMs !== null && (this.playingTotalMs += i - this.playingSinceMs, this.playingSinceMs = null, this.mutedSinceMs !== null && (this.mutedTotalMs += i - this.mutedSinceMs, this.mutedSinceMs = null)), this.isPlaying = t === "playing", this.syncActive(), t === "waiting" ? this.waitingSinceMs = i : this.waitingSinceMs !== null && (this.waitingTotalMs += i - this.waitingSinceMs, this.waitingSinceMs = null), t === "buffering" && e === "playing" ? (this.isHidden || (this.rebufferCount += 1), this.isBuffering = !0, this.lastStallMs = i, this.timeToFirstStallMs === 0 && (this.timeToFirstStallMs = Math.max(H, Math.round(this.playingTotalMs)))) : e === "buffering" && (this.isBuffering = !1), this.syncBuffering(), t === "paused" && (this.pauseCount += 1);
1469
1470
  let a = {
1470
1471
  fromState: G[e] ?? "PLAYER_STATE_UNSPECIFIED",
1471
1472
  toState: G[t] ?? "PLAYER_STATE_UNSPECIFIED",
@@ -1482,6 +1483,10 @@ var at = class {
1482
1483
  let e = this.isPlaying && !this.isHidden && !this.isMuted;
1483
1484
  e && this.activeSinceMs === null ? this.activeSinceMs = this.now() : !e && this.activeSinceMs !== null && (this.activeTotalMs += this.now() - this.activeSinceMs, this.activeSinceMs = null);
1484
1485
  }
1486
+ syncBuffering() {
1487
+ let e = this.isBuffering && !this.isHidden;
1488
+ e && this.bufferingSinceMs === null ? this.bufferingSinceMs = this.now() : !e && this.bufferingSinceMs !== null && (this.rebufferTotalMs += this.now() - this.bufferingSinceMs, this.bufferingSinceMs = null);
1489
+ }
1485
1490
  closePresentation() {
1486
1491
  let e = this.now(), t = e - this.presentationSinceMs;
1487
1492
  this.presentation === "fullscreen" ? this.fullscreenTotalMs += t : this.presentation === "pip" && (this.pipTotalMs += t), this.presentationSinceMs = e;
@@ -1709,7 +1714,7 @@ async function ut() {
1709
1714
  }
1710
1715
  //#endregion
1711
1716
  //#region src/core/version.ts
1712
- var dt = "2.1.1", K = {
1717
+ var dt = "2.1.2", K = {
1713
1718
  accent: "#E1B600",
1714
1719
  accentText: "#1B1C23",
1715
1720
  background: "#0e0f13",