@oddin-gg/havik-player 2.9.3 → 2.11.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 +18 -18
- package/dist/havik-player.global.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -4
- package/dist/index.d.ts +60 -4
- package/dist/index.js +557 -294
- package/dist/index.js.map +1 -1
- package/docs/API.md +55 -23
- package/embed/index.html +1 -1
- package/examples/vanilla.html +1 -1
- package/package.json +4 -1
package/dist/index.d.cts
CHANGED
|
@@ -57,6 +57,29 @@ export declare interface CatalogMatch {
|
|
|
57
57
|
tournamentUrn: string;
|
|
58
58
|
tournamentName: string;
|
|
59
59
|
sport: string;
|
|
60
|
+
/**
|
|
61
|
+
* The two sides, home first, as the server sends them. Absent when no
|
|
62
|
+
* usable team survives parsing: the server sent no `teams` (an older
|
|
63
|
+
* havik-streams), or every entry lacked both a URN and a name. A team with
|
|
64
|
+
* a URN but no name IS kept. `matchName` stays the display string.
|
|
65
|
+
*/
|
|
66
|
+
teams?: CatalogTeam[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* One side of a match. `urn` is the server's competitor URN
|
|
71
|
+
* (`od:competitor:N`); `logoUrl` is an https image URL, present only when
|
|
72
|
+
* the deployment resolves team logos and this team has one.
|
|
73
|
+
*
|
|
74
|
+
* A `logoUrl` can still fail to load (the CDN may not have the file), so
|
|
75
|
+
* always render a fallback for a missing or broken image. Allow the logo
|
|
76
|
+
* hosts (`cdn.oddin.gg`, and `cdn.runestone.gg`) in a CSP `img-src`.
|
|
77
|
+
*/
|
|
78
|
+
export declare interface CatalogTeam {
|
|
79
|
+
urn: string;
|
|
80
|
+
name: string;
|
|
81
|
+
isHome: boolean;
|
|
82
|
+
logoUrl?: string;
|
|
60
83
|
}
|
|
61
84
|
|
|
62
85
|
export declare interface CatalogTournament {
|
|
@@ -162,6 +185,15 @@ export declare interface CreatePlayerOptions {
|
|
|
162
185
|
* playback has fallen well behind. Default: true. Live/LL only.
|
|
163
186
|
*/
|
|
164
187
|
snapToLiveOnRefocus?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* DRM cold start: download the first init segment and parts while the
|
|
190
|
+
* first key is still being acquired, instead of after it (hls.js waits for
|
|
191
|
+
* the key before requesting any media). Bytes are handed to hls.js only
|
|
192
|
+
* when it asks for them, so nothing is appended earlier than before; only
|
|
193
|
+
* the network time leaves the critical path. Default: true. Ignored on
|
|
194
|
+
* clear streams, and when `hlsConfig.fLoader` is set.
|
|
195
|
+
*/
|
|
196
|
+
mediaDuringKey?: boolean;
|
|
165
197
|
/** Force an engine; 'auto' prefers hls.js wherever supported (incl. modern
|
|
166
198
|
* Safari/iOS via ManagedMediaSource) and falls back to native HLS. Default: 'auto'. */
|
|
167
199
|
engine?: 'auto' | 'hls' | 'native';
|
|
@@ -660,11 +692,19 @@ export declare function licenseRequestHeaders(descriptor: StreamDescriptor, cred
|
|
|
660
692
|
* the `/v1/playback` outcome ladder so a pushed event and a follow-up
|
|
661
693
|
* `/v1/playback` call always agree:
|
|
662
694
|
* live ↔ 200 OK (a serveable session exists — play now)
|
|
663
|
-
* upcoming ↔ 425 Too Early (scheduled, not serving yet)
|
|
695
|
+
* upcoming ↔ 425 Too Early (scheduled, not serving yet; `liveStartsAt` says when)
|
|
696
|
+
* pending ↔ 425 Too Early (kickoff has passed, the stream is being packaged —
|
|
697
|
+
* no `liveStartsAt`; `live` follows within seconds
|
|
698
|
+
* to minutes)
|
|
664
699
|
* ended ↔ 503 (was live; media stopped, still in catchup)
|
|
665
700
|
* gone ↔ 410 Gone (ended past the catchup window)
|
|
701
|
+
*
|
|
702
|
+
* `pending` and `upcoming` ask the same thing of a player — wait — and the
|
|
703
|
+
* managed player treats them alike ("Starting soon…"). A host that renders
|
|
704
|
+
* its own waiting UI can tell them apart: `upcoming` has a kickoff to count
|
|
705
|
+
* down to, `pending` means the match is on and media is seconds away.
|
|
666
706
|
*/
|
|
667
|
-
export declare type LiveState = 'live' | 'upcoming' | 'ended' | 'gone';
|
|
707
|
+
export declare type LiveState = 'live' | 'upcoming' | 'pending' | 'ended' | 'gone';
|
|
668
708
|
|
|
669
709
|
export declare interface LiveStateEvent {
|
|
670
710
|
matchUrn: string;
|
|
@@ -680,7 +720,13 @@ export declare interface LiveStateSubscription {
|
|
|
680
720
|
close(): void;
|
|
681
721
|
}
|
|
682
722
|
|
|
683
|
-
|
|
723
|
+
/**
|
|
724
|
+
* `pending` is the catalog's "kickoff has passed, the stream is being
|
|
725
|
+
* packaged" — not playable yet, `live` expected within seconds to minutes. It
|
|
726
|
+
* is NOT `upcoming` (which has a kickoff ahead) and not `live` (nothing serves
|
|
727
|
+
* yet); `/v1/playback` answers `425` for it without a `liveStartsAt`.
|
|
728
|
+
*/
|
|
729
|
+
export declare type MatchLiveStatus = 'upcoming' | 'pending' | 'live' | 'ended';
|
|
684
730
|
|
|
685
731
|
export declare interface MatchStatus {
|
|
686
732
|
matchUrn: string;
|
|
@@ -694,6 +740,12 @@ export declare interface MatchStatus {
|
|
|
694
740
|
*/
|
|
695
741
|
statusRaw?: string;
|
|
696
742
|
datePlannedStart?: string;
|
|
743
|
+
/**
|
|
744
|
+
* The match's teams as of this report (see {@link CatalogTeam}).
|
|
745
|
+
* `watchStatus` fires again when they change, so a logo the server
|
|
746
|
+
* resolves after the first read is re-reported with the same status.
|
|
747
|
+
*/
|
|
748
|
+
teams?: CatalogTeam[];
|
|
697
749
|
}
|
|
698
750
|
|
|
699
751
|
/**
|
|
@@ -1167,7 +1219,11 @@ export declare interface WatchStatusOptions {
|
|
|
1167
1219
|
baseUrl: string;
|
|
1168
1220
|
matchUrn: string;
|
|
1169
1221
|
credential: CredentialSource;
|
|
1170
|
-
/**
|
|
1222
|
+
/**
|
|
1223
|
+
* Fired once on first read and then whenever the status, the teams (a logo
|
|
1224
|
+
* resolved after the first read) or the planned start change. Unchanged
|
|
1225
|
+
* polls (304 or an identical body) stay silent.
|
|
1226
|
+
*/
|
|
1171
1227
|
onChange: (status: MatchStatus) => void;
|
|
1172
1228
|
/** Fired on a poll error; polling continues. */
|
|
1173
1229
|
onError?: (err: PlaybackError) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,29 @@ export declare interface CatalogMatch {
|
|
|
57
57
|
tournamentUrn: string;
|
|
58
58
|
tournamentName: string;
|
|
59
59
|
sport: string;
|
|
60
|
+
/**
|
|
61
|
+
* The two sides, home first, as the server sends them. Absent when no
|
|
62
|
+
* usable team survives parsing: the server sent no `teams` (an older
|
|
63
|
+
* havik-streams), or every entry lacked both a URN and a name. A team with
|
|
64
|
+
* a URN but no name IS kept. `matchName` stays the display string.
|
|
65
|
+
*/
|
|
66
|
+
teams?: CatalogTeam[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* One side of a match. `urn` is the server's competitor URN
|
|
71
|
+
* (`od:competitor:N`); `logoUrl` is an https image URL, present only when
|
|
72
|
+
* the deployment resolves team logos and this team has one.
|
|
73
|
+
*
|
|
74
|
+
* A `logoUrl` can still fail to load (the CDN may not have the file), so
|
|
75
|
+
* always render a fallback for a missing or broken image. Allow the logo
|
|
76
|
+
* hosts (`cdn.oddin.gg`, and `cdn.runestone.gg`) in a CSP `img-src`.
|
|
77
|
+
*/
|
|
78
|
+
export declare interface CatalogTeam {
|
|
79
|
+
urn: string;
|
|
80
|
+
name: string;
|
|
81
|
+
isHome: boolean;
|
|
82
|
+
logoUrl?: string;
|
|
60
83
|
}
|
|
61
84
|
|
|
62
85
|
export declare interface CatalogTournament {
|
|
@@ -162,6 +185,15 @@ export declare interface CreatePlayerOptions {
|
|
|
162
185
|
* playback has fallen well behind. Default: true. Live/LL only.
|
|
163
186
|
*/
|
|
164
187
|
snapToLiveOnRefocus?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* DRM cold start: download the first init segment and parts while the
|
|
190
|
+
* first key is still being acquired, instead of after it (hls.js waits for
|
|
191
|
+
* the key before requesting any media). Bytes are handed to hls.js only
|
|
192
|
+
* when it asks for them, so nothing is appended earlier than before; only
|
|
193
|
+
* the network time leaves the critical path. Default: true. Ignored on
|
|
194
|
+
* clear streams, and when `hlsConfig.fLoader` is set.
|
|
195
|
+
*/
|
|
196
|
+
mediaDuringKey?: boolean;
|
|
165
197
|
/** Force an engine; 'auto' prefers hls.js wherever supported (incl. modern
|
|
166
198
|
* Safari/iOS via ManagedMediaSource) and falls back to native HLS. Default: 'auto'. */
|
|
167
199
|
engine?: 'auto' | 'hls' | 'native';
|
|
@@ -660,11 +692,19 @@ export declare function licenseRequestHeaders(descriptor: StreamDescriptor, cred
|
|
|
660
692
|
* the `/v1/playback` outcome ladder so a pushed event and a follow-up
|
|
661
693
|
* `/v1/playback` call always agree:
|
|
662
694
|
* live ↔ 200 OK (a serveable session exists — play now)
|
|
663
|
-
* upcoming ↔ 425 Too Early (scheduled, not serving yet)
|
|
695
|
+
* upcoming ↔ 425 Too Early (scheduled, not serving yet; `liveStartsAt` says when)
|
|
696
|
+
* pending ↔ 425 Too Early (kickoff has passed, the stream is being packaged —
|
|
697
|
+
* no `liveStartsAt`; `live` follows within seconds
|
|
698
|
+
* to minutes)
|
|
664
699
|
* ended ↔ 503 (was live; media stopped, still in catchup)
|
|
665
700
|
* gone ↔ 410 Gone (ended past the catchup window)
|
|
701
|
+
*
|
|
702
|
+
* `pending` and `upcoming` ask the same thing of a player — wait — and the
|
|
703
|
+
* managed player treats them alike ("Starting soon…"). A host that renders
|
|
704
|
+
* its own waiting UI can tell them apart: `upcoming` has a kickoff to count
|
|
705
|
+
* down to, `pending` means the match is on and media is seconds away.
|
|
666
706
|
*/
|
|
667
|
-
export declare type LiveState = 'live' | 'upcoming' | 'ended' | 'gone';
|
|
707
|
+
export declare type LiveState = 'live' | 'upcoming' | 'pending' | 'ended' | 'gone';
|
|
668
708
|
|
|
669
709
|
export declare interface LiveStateEvent {
|
|
670
710
|
matchUrn: string;
|
|
@@ -680,7 +720,13 @@ export declare interface LiveStateSubscription {
|
|
|
680
720
|
close(): void;
|
|
681
721
|
}
|
|
682
722
|
|
|
683
|
-
|
|
723
|
+
/**
|
|
724
|
+
* `pending` is the catalog's "kickoff has passed, the stream is being
|
|
725
|
+
* packaged" — not playable yet, `live` expected within seconds to minutes. It
|
|
726
|
+
* is NOT `upcoming` (which has a kickoff ahead) and not `live` (nothing serves
|
|
727
|
+
* yet); `/v1/playback` answers `425` for it without a `liveStartsAt`.
|
|
728
|
+
*/
|
|
729
|
+
export declare type MatchLiveStatus = 'upcoming' | 'pending' | 'live' | 'ended';
|
|
684
730
|
|
|
685
731
|
export declare interface MatchStatus {
|
|
686
732
|
matchUrn: string;
|
|
@@ -694,6 +740,12 @@ export declare interface MatchStatus {
|
|
|
694
740
|
*/
|
|
695
741
|
statusRaw?: string;
|
|
696
742
|
datePlannedStart?: string;
|
|
743
|
+
/**
|
|
744
|
+
* The match's teams as of this report (see {@link CatalogTeam}).
|
|
745
|
+
* `watchStatus` fires again when they change, so a logo the server
|
|
746
|
+
* resolves after the first read is re-reported with the same status.
|
|
747
|
+
*/
|
|
748
|
+
teams?: CatalogTeam[];
|
|
697
749
|
}
|
|
698
750
|
|
|
699
751
|
/**
|
|
@@ -1167,7 +1219,11 @@ export declare interface WatchStatusOptions {
|
|
|
1167
1219
|
baseUrl: string;
|
|
1168
1220
|
matchUrn: string;
|
|
1169
1221
|
credential: CredentialSource;
|
|
1170
|
-
/**
|
|
1222
|
+
/**
|
|
1223
|
+
* Fired once on first read and then whenever the status, the teams (a logo
|
|
1224
|
+
* resolved after the first read) or the planned start change. Unchanged
|
|
1225
|
+
* polls (304 or an identical body) stay silent.
|
|
1226
|
+
*/
|
|
1171
1227
|
onChange: (status: MatchStatus) => void;
|
|
1172
1228
|
/** Fired on a poll error; polling continues. */
|
|
1173
1229
|
onError?: (err: PlaybackError) => void;
|