@karnstack/kino 0.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.
@@ -0,0 +1,90 @@
1
+ //#region src/core/types.d.ts
2
+ type QualityLevel = {
3
+ id: string;
4
+ height: number;
5
+ bitrate: number;
6
+ selected: boolean;
7
+ };
8
+ type TextTrackInfo = {
9
+ id: string;
10
+ kind: string;
11
+ label: string;
12
+ lang: string;
13
+ mode: "showing" | "hidden" | "disabled";
14
+ };
15
+ type Capabilities = {
16
+ canSetQuality: boolean;
17
+ hasStoryboard: boolean;
18
+ canPiP: boolean;
19
+ canFullscreen: boolean;
20
+ canSetRate: boolean;
21
+ hasTextTracks: boolean;
22
+ };
23
+ type MediaError = {
24
+ code: number;
25
+ message: string;
26
+ };
27
+ type MediaState = {
28
+ paused: boolean;
29
+ currentTime: number;
30
+ duration: number;
31
+ buffered: Array<[number, number]>;
32
+ rate: number;
33
+ volume: number;
34
+ muted: boolean;
35
+ readyState: number;
36
+ seeking: boolean;
37
+ ended: boolean;
38
+ error: MediaError | null;
39
+ qualities: QualityLevel[];
40
+ activeQualityId: string | "auto";
41
+ videoHeight: number;
42
+ textTracks: TextTrackInfo[];
43
+ activeTextTrackId: string | null;
44
+ activeCueText: string;
45
+ fullscreen: boolean;
46
+ pip: boolean;
47
+ storyboard: {
48
+ vttUrl: string;
49
+ } | null;
50
+ capabilities: Capabilities;
51
+ };
52
+ type PlayerActions = {
53
+ play(): void;
54
+ pause(): void;
55
+ seek(time: number): void;
56
+ setRate(rate: number): void;
57
+ setVolume(v: number): void;
58
+ setMuted(m: boolean): void;
59
+ setQuality(id: string | "auto"): void;
60
+ setTextTrack(id: string | null): void;
61
+ enterFullscreen(wrapper: HTMLElement): void;
62
+ exitFullscreen(): void;
63
+ enterPiP(): void;
64
+ exitPiP(): void;
65
+ };
66
+ type SourceOptions = {
67
+ playbackId?: string;
68
+ src?: string;
69
+ poster?: string;
70
+ tokens?: {
71
+ playback?: string;
72
+ thumbnail?: string;
73
+ storyboard?: string;
74
+ };
75
+ metadata?: {
76
+ videoId?: string;
77
+ videoTitle?: string;
78
+ viewerUserId?: string;
79
+ };
80
+ };
81
+ interface Provider {
82
+ mount(container: HTMLElement): void;
83
+ getState(): MediaState;
84
+ subscribe(listener: () => void): () => void;
85
+ actions: PlayerActions;
86
+ destroy(): void;
87
+ swapSource?(opts: SourceOptions): void;
88
+ }
89
+ //#endregion
90
+ export { Provider as a, TextTrackInfo as c, PlayerActions as i, MediaError as n, QualityLevel as o, MediaState as r, SourceOptions as s, Capabilities as t };
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@karnstack/kino",
3
+ "version": "0.1.0",
4
+ "description": "Themeable React video player with pluggable providers.",
5
+ "license": "MIT",
6
+ "author": "Karn",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/karnstack/kino.git"
10
+ },
11
+ "homepage": "https://github.com/karnstack/kino#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/karnstack/kino/issues"
14
+ },
15
+ "keywords": [
16
+ "video",
17
+ "player",
18
+ "react",
19
+ "mux",
20
+ "hls",
21
+ "video-player"
22
+ ],
23
+ "type": "module",
24
+ "engines": {
25
+ "node": ">=24"
26
+ },
27
+ "sideEffects": [
28
+ "**/*.css",
29
+ "./dist/mux.js"
30
+ ],
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "import": "./dist/index.js"
38
+ },
39
+ "./mux": {
40
+ "types": "./dist/mux.d.ts",
41
+ "import": "./dist/mux.js"
42
+ },
43
+ "./styles.css": "./dist/styles.css"
44
+ },
45
+ "peerDependencies": {
46
+ "react": ">=19",
47
+ "react-dom": ">=19"
48
+ },
49
+ "dependencies": {
50
+ "@mux/mux-video": "^0.31.0"
51
+ },
52
+ "devDependencies": {
53
+ "@changesets/cli": "^2.31.0",
54
+ "@eslint/js": "^9.0.0",
55
+ "@tailwindcss/vite": "^4.3.1",
56
+ "@testing-library/jest-dom": "^6.6.0",
57
+ "@testing-library/react": "^16.1.0",
58
+ "@types/node": "^24.13.2",
59
+ "@types/react": "^19.0.0",
60
+ "@types/react-dom": "^19.0.0",
61
+ "@vitejs/plugin-react": "^4.3.0",
62
+ "eslint": "^9.0.0",
63
+ "jsdom": "^25.0.0",
64
+ "prettier": "^3.3.0",
65
+ "react": "^19.2.0",
66
+ "react-dom": "^19.2.0",
67
+ "tailwindcss": "^4.3.1",
68
+ "tsdown": "^0.22.3",
69
+ "typescript": "^5.7.0",
70
+ "typescript-eslint": "^8.0.0",
71
+ "vite": "^6.0.0",
72
+ "vitest": "^2.1.0"
73
+ },
74
+ "scripts": {
75
+ "build": "tsdown",
76
+ "dev": "vite --config demo/vite.config.ts",
77
+ "test": "vitest run",
78
+ "test:watch": "vitest",
79
+ "typecheck": "tsc --noEmit",
80
+ "lint": "eslint .",
81
+ "format": "prettier --write .",
82
+ "format:check": "prettier --check ."
83
+ }
84
+ }