@oddin-gg/havik-player 1.0.6 → 1.1.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/README.md +8 -1
- 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.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/docs/API.md +28 -27
- package/embed/index.html +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -126,6 +126,17 @@ export declare interface CreatePlayerOptions {
|
|
|
126
126
|
endedMessage?: string;
|
|
127
127
|
/** Message on the fatal-error card. Default: the error's own message. */
|
|
128
128
|
errorMessage?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Turn on hls.js's internal console logging — segment/part scheduling, ABR
|
|
131
|
+
* switches, and EME key-session + license traffic. Default: false.
|
|
132
|
+
*
|
|
133
|
+
* For diagnosing a playback problem with Oddin support; leave it off in
|
|
134
|
+
* production (it logs on every fragment, and the EME lines include license
|
|
135
|
+
* request/response metadata). hls.js engine only — a no-op on the native
|
|
136
|
+
* engine, which has no equivalent. Equivalent to `hlsConfig: { debug: true }`,
|
|
137
|
+
* which still wins if you set both.
|
|
138
|
+
*/
|
|
139
|
+
debug?: boolean;
|
|
129
140
|
/** Escape hatch for low-level hls.js tuning. */
|
|
130
141
|
hlsConfig?: Partial<HlsConfig>;
|
|
131
142
|
/** Stats sampling cadence. Default: 2000ms. */
|
package/dist/index.d.ts
CHANGED
|
@@ -126,6 +126,17 @@ export declare interface CreatePlayerOptions {
|
|
|
126
126
|
endedMessage?: string;
|
|
127
127
|
/** Message on the fatal-error card. Default: the error's own message. */
|
|
128
128
|
errorMessage?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Turn on hls.js's internal console logging — segment/part scheduling, ABR
|
|
131
|
+
* switches, and EME key-session + license traffic. Default: false.
|
|
132
|
+
*
|
|
133
|
+
* For diagnosing a playback problem with Oddin support; leave it off in
|
|
134
|
+
* production (it logs on every fragment, and the EME lines include license
|
|
135
|
+
* request/response metadata). hls.js engine only — a no-op on the native
|
|
136
|
+
* engine, which has no equivalent. Equivalent to `hlsConfig: { debug: true }`,
|
|
137
|
+
* which still wins if you set both.
|
|
138
|
+
*/
|
|
139
|
+
debug?: boolean;
|
|
129
140
|
/** Escape hatch for low-level hls.js tuning. */
|
|
130
141
|
hlsConfig?: Partial<HlsConfig>;
|
|
131
142
|
/** Stats sampling cadence. Default: 2000ms. */
|
package/dist/index.js
CHANGED
|
@@ -577,7 +577,8 @@ var _e = class {
|
|
|
577
577
|
n.currentTime <= t + me || (n.currentTime = t);
|
|
578
578
|
}
|
|
579
579
|
startHls() {
|
|
580
|
-
let { video: t, descriptor: n, credential: r, deviceId: i, userId: a, lowLatency: o,
|
|
580
|
+
let { video: t, descriptor: n, credential: r, deviceId: i, userId: a, lowLatency: o, debug: s, hlsConfig: c, emit: l } = this.deps, u = n.drmEnabled && !!n.drm?.widevine?.licenseUrl, d = {
|
|
581
|
+
debug: s === !0,
|
|
581
582
|
enableWorker: !o,
|
|
582
583
|
lowLatencyMode: o,
|
|
583
584
|
backBufferLength: 90,
|
|
@@ -585,7 +586,7 @@ var _e = class {
|
|
|
585
586
|
maxLiveSyncPlaybackRate: 1.5,
|
|
586
587
|
abrEwmaDefaultEstimate: 1e6,
|
|
587
588
|
capLevelToPlayerSize: !0,
|
|
588
|
-
...
|
|
589
|
+
...u ? {
|
|
589
590
|
emeEnabled: !0,
|
|
590
591
|
drmSystems: { "com.widevine.alpha": { licenseUrl: this.licenseUrl } },
|
|
591
592
|
drmSystemOptions: {
|
|
@@ -598,33 +599,33 @@ var _e = class {
|
|
|
598
599
|
e.open("POST", this.licenseUrl ?? t, !0), e.setRequestHeader("x-api-key", r.apiKey), e.setRequestHeader("X-Match-Urn", n.matchUrn), e.setRequestHeader("X-Device-Id", i), a && e.setRequestHeader("X-User-Id", a);
|
|
599
600
|
}
|
|
600
601
|
} : {},
|
|
601
|
-
...
|
|
602
|
+
...c
|
|
602
603
|
};
|
|
603
|
-
he(
|
|
604
|
-
let
|
|
605
|
-
this.hls =
|
|
606
|
-
this.mediaRecoveries = 0, this.networkRecoveries = 0,
|
|
607
|
-
}),
|
|
604
|
+
he(d);
|
|
605
|
+
let f = new e(d);
|
|
606
|
+
this.hls = f, f.on(e.Events.MANIFEST_PARSED, () => {
|
|
607
|
+
this.mediaRecoveries = 0, this.networkRecoveries = 0, l({ type: "ready" });
|
|
608
|
+
}), f.on(e.Events.FRAG_BUFFERED, () => {
|
|
608
609
|
(this.mediaRecoveries > 0 || this.networkRecoveries > 0 || this.licenseRecoveries > 0) && !this.recoveryResetTimer && (this.recoveryResetTimer = setTimeout(() => {
|
|
609
610
|
this.mediaRecoveries = 0, this.networkRecoveries = 0, this.licenseRecoveries = 0, this.recoveryResetTimer = null;
|
|
610
611
|
}, V));
|
|
611
|
-
}),
|
|
612
|
+
}), f.on(e.Events.LEVEL_LOADED, (e, t) => {
|
|
612
613
|
if (this.detectedLowLatency) return;
|
|
613
614
|
let n = t.details;
|
|
614
|
-
(n?.partList?.length || (n?.partTarget ?? 0) > 0) && (this.detectedLowLatency = !0,
|
|
615
|
+
(n?.partList?.length || (n?.partTarget ?? 0) > 0) && (this.detectedLowLatency = !0, l({
|
|
615
616
|
type: "lowLatencyDetected",
|
|
616
617
|
value: !0
|
|
617
618
|
}));
|
|
618
|
-
}),
|
|
619
|
+
}), f.on(e.Events.LEVEL_LOADED, (e, t) => this.trackEnd(t)), this.endWatchdog = setInterval(() => this.checkEndStale(), U), f.on(e.Events.LEVEL_SWITCHED, (e, t) => l({
|
|
619
620
|
type: "qualitychange",
|
|
620
621
|
index: t.level
|
|
621
|
-
})),
|
|
622
|
+
})), f.on(e.Events.AUDIO_TRACK_SWITCHED, (e, t) => l({
|
|
622
623
|
type: "audiotrackchange",
|
|
623
624
|
id: t.id
|
|
624
|
-
})),
|
|
625
|
+
})), f.on(e.Events.SUBTITLE_TRACK_SWITCH, (e, t) => l({
|
|
625
626
|
type: "texttrackchange",
|
|
626
627
|
id: t.id
|
|
627
|
-
})),
|
|
628
|
+
})), f.on(e.Events.ERROR, (e, t) => this.onError(t)), f.loadSource(n.manifestUrl), f.attachMedia(t);
|
|
628
629
|
}
|
|
629
630
|
getQualityLevels() {
|
|
630
631
|
return this.hls ? this.hls.levels.map((e, t) => ({
|
|
@@ -1465,6 +1466,7 @@ var Pe = class {
|
|
|
1465
1466
|
userId: this.opts.userId,
|
|
1466
1467
|
lowLatency: this.opts.lowLatency === void 0 || this.opts.lowLatency === "auto" || this.opts.lowLatency,
|
|
1467
1468
|
snapToLiveOnRefocus: this.opts.snapToLiveOnRefocus,
|
|
1469
|
+
debug: this.opts.debug,
|
|
1468
1470
|
hlsConfig: r,
|
|
1469
1471
|
emit: (e) => this.onEngineEvent(e)
|
|
1470
1472
|
}, a = this.opts.engine ?? "auto";
|