@vyonio/player 0.0.0-stage → 0.2.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 +273 -2
- package/THIRD_PARTY_NOTICES.txt +682 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +38 -0
- package/dist/plyr-icons.svg +1 -0
- package/dist/style.css +2 -0
- package/package.json +37 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Authentication errors contain safe codes rather than endpoint response details. */
|
|
2
|
+
export class PlaybackTokenError extends Error {
|
|
3
|
+
constructor(code?: string);
|
|
4
|
+
code: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface VyonioPlayerError {
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
/** Raw engine diagnostics are available only for public playback. */
|
|
11
|
+
data?: unknown[];
|
|
12
|
+
error: Error;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface VyonioPlayerState {
|
|
16
|
+
currentTime: number;
|
|
17
|
+
duration: number | null;
|
|
18
|
+
paused: boolean;
|
|
19
|
+
ended: boolean;
|
|
20
|
+
muted: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface VyonioPlayerMount {
|
|
24
|
+
/** Advanced Shaka access; intentionally opaque to avoid requiring Shaka types. */
|
|
25
|
+
player: unknown;
|
|
26
|
+
mediaElement: HTMLVideoElement;
|
|
27
|
+
play(): Promise<void>;
|
|
28
|
+
pause(): void;
|
|
29
|
+
seek(seconds: number): void;
|
|
30
|
+
setMuted(muted: boolean): void;
|
|
31
|
+
getState(): VyonioPlayerState;
|
|
32
|
+
destroy(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type VyonioPlayerAuthentication =
|
|
36
|
+
| { tokenEndpoint: string; tokenHeaders?: HeadersInit; getPlaybackToken?: never }
|
|
37
|
+
| { getPlaybackToken?: () => Promise<string>; tokenEndpoint?: never; tokenHeaders?: never };
|
|
38
|
+
|
|
39
|
+
export type VyonioPlayerOptions = VyonioPlayerAuthentication & {
|
|
40
|
+
/** Defaults to https://api.vyonio.com. */
|
|
41
|
+
apiBase?: string;
|
|
42
|
+
embedUuid: string;
|
|
43
|
+
onError?: (detail: VyonioPlayerError) => void;
|
|
44
|
+
autoplay?: boolean;
|
|
45
|
+
muted?: boolean;
|
|
46
|
+
loop?: boolean;
|
|
47
|
+
controls?: boolean;
|
|
48
|
+
controlItems?: Array<'play-large' | 'play' | 'progress' | 'current-time' | 'mute' | 'volume' | 'captions' | 'settings' | 'pip' | 'airplay' | 'fullscreen'>;
|
|
49
|
+
settingsItems?: Array<'quality' | 'speed'>;
|
|
50
|
+
language?: 'en' | 'cs';
|
|
51
|
+
accentColor?: string | null;
|
|
52
|
+
badge?: {
|
|
53
|
+
text: string;
|
|
54
|
+
position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
55
|
+
style: 'dark' | 'light' | 'accent';
|
|
56
|
+
} | null;
|
|
57
|
+
startSeconds?: number;
|
|
58
|
+
popularityHistogram?: { buckets: number[] };
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/** Resolves after the manifest is loaded and playback controls are ready. */
|
|
62
|
+
export function mount(element: HTMLElement, options: VyonioPlayerOptions): Promise<VyonioPlayerMount>;
|
|
63
|
+
export const VyonioPlayer: { mount: typeof mount };
|