@oddin-gg/havik-player 1.13.0 → 1.14.0
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/havik-player.global.js +2 -2
- package/dist/havik-player.global.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -16
- package/dist/index.js.map +1 -1
- package/embed/index.html +1 -1
- package/examples/vanilla.html +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1307,14 +1307,16 @@ var ze = class {
|
|
|
1307
1307
|
if (e && e(this.url, t)) return;
|
|
1308
1308
|
}
|
|
1309
1309
|
let n = this.opts.fetchFn ?? (typeof fetch < "u" ? fetch : void 0);
|
|
1310
|
-
|
|
1310
|
+
if (!n) return;
|
|
1311
|
+
let r = { "content-type": "application/json" };
|
|
1312
|
+
this.opts.apiKey && (r["x-api-key"] = this.opts.apiKey), n(this.url, {
|
|
1311
1313
|
method: "POST",
|
|
1312
|
-
headers:
|
|
1314
|
+
headers: r,
|
|
1313
1315
|
body: t,
|
|
1314
1316
|
keepalive: !0
|
|
1315
1317
|
}).catch(() => {});
|
|
1316
1318
|
}
|
|
1317
|
-
}, Be = "1.
|
|
1319
|
+
}, Be = "1.14.0", W = {
|
|
1318
1320
|
accent: "#E1B600",
|
|
1319
1321
|
accentText: "#1B1C23",
|
|
1320
1322
|
background: "#0e0f13",
|
|
@@ -1888,32 +1890,33 @@ var tt = class {
|
|
|
1888
1890
|
i(), r.destroy();
|
|
1889
1891
|
return;
|
|
1890
1892
|
}
|
|
1891
|
-
this.engine = r, this.detachMedia = i, this.opts.maxBitrate != null && r.setMaxBitrate(this.opts.maxBitrate), this.startStats(), this.scheduleLicenseRefresh(), this.startLiveState(t), this.startAnalytics(e, r);
|
|
1893
|
+
this.engine = r, this.detachMedia = i, this.opts.maxBitrate != null && r.setMaxBitrate(this.opts.maxBitrate), this.startStats(), this.scheduleLicenseRefresh(), this.startLiveState(t), this.startAnalytics(e, r, n.apiKey);
|
|
1892
1894
|
}
|
|
1893
|
-
startAnalytics(e, t) {
|
|
1895
|
+
startAnalytics(e, t, n) {
|
|
1894
1896
|
if (this.analyticsSession?.noteDestroyed(), this.analyticsSession = null, this.detachSeekListener?.(), this.opts.analytics === !1) return;
|
|
1895
|
-
let
|
|
1896
|
-
if (!n) return;
|
|
1897
|
-
let r = (typeof this.opts.analytics == "object" ? this.opts.analytics.endpoint : void 0) ?? Re(this.opts.baseUrl);
|
|
1897
|
+
let r = e.analytics?.sid;
|
|
1898
1898
|
if (!r) return;
|
|
1899
|
-
let i = this.opts.
|
|
1900
|
-
|
|
1901
|
-
|
|
1899
|
+
let i = (typeof this.opts.analytics == "object" ? this.opts.analytics.endpoint : void 0) ?? Re(this.opts.baseUrl);
|
|
1900
|
+
if (!i) return;
|
|
1901
|
+
let a = this.opts.video, o = new ze({
|
|
1902
|
+
endpoint: i,
|
|
1903
|
+
sid: r,
|
|
1904
|
+
apiKey: n,
|
|
1902
1905
|
player: t.name === "native" ? "PLAYER_SAFARI_NATIVE" : "PLAYER_HLSJS",
|
|
1903
1906
|
sdkVersion: Be,
|
|
1904
1907
|
sample: () => {
|
|
1905
|
-
let e = this.engine?.getStats() ?? F, t =
|
|
1908
|
+
let e = this.engine?.getStats() ?? F, t = a.buffered.length ? Math.max(0, a.buffered.end(a.buffered.length - 1) - a.currentTime) : 0;
|
|
1906
1909
|
return {
|
|
1907
1910
|
...e,
|
|
1908
1911
|
bufferedMs: Math.round(t * 1e3),
|
|
1909
1912
|
state: this._state,
|
|
1910
|
-
positionMs: Math.round(
|
|
1913
|
+
positionMs: Math.round(a.currentTime * 1e3)
|
|
1911
1914
|
};
|
|
1912
1915
|
}
|
|
1913
1916
|
});
|
|
1914
|
-
this.analyticsSession =
|
|
1915
|
-
let
|
|
1916
|
-
|
|
1917
|
+
this.analyticsSession = o;
|
|
1918
|
+
let s = () => o.noteSeek();
|
|
1919
|
+
a.addEventListener("seeking", s), this.detachSeekListener = () => a.removeEventListener("seeking", s), o.start();
|
|
1917
1920
|
}
|
|
1918
1921
|
createEngine(e, n) {
|
|
1919
1922
|
let r = { ...this.opts.hlsConfig };
|