@connectedxm/stream-player 0.0.1

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,3 @@
1
+ export { default as StreamPlayer } from '../src/StreamPlayer';
2
+ export { useStreamPlayer } from '../src/hooks/useStreamPlayer';
3
+ export type { StreamPlayerProps, BaseStreamInput } from '../src/interfaces';
package/dist/main.d.ts ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ declare const Example: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Example;
@@ -0,0 +1,26 @@
1
+ import { default as React } from 'react';
2
+ import { BaseStreamInput } from './interfaces';
3
+ interface StreamControlsProps {
4
+ playing: boolean;
5
+ volume: number;
6
+ muted: boolean;
7
+ qualities: {
8
+ level: number;
9
+ height: number;
10
+ label: string;
11
+ }[];
12
+ currentQuality: number;
13
+ isLive: boolean;
14
+ isBehindLive: boolean;
15
+ isFullscreen: boolean;
16
+ streamInputs: BaseStreamInput[];
17
+ selectedStreamInput: BaseStreamInput | null;
18
+ onPlayPause: () => void;
19
+ onMuteToggle: () => void;
20
+ onQualityChange: (level: number) => void;
21
+ onGoToLive: () => void;
22
+ onFullscreenToggle: () => void;
23
+ onLanguageChange: (streamInput: BaseStreamInput) => void;
24
+ }
25
+ declare const StreamControls: React.FC<StreamControlsProps>;
26
+ export default StreamControls;
@@ -0,0 +1,3 @@
1
+ import { StreamPlayerProps } from './interfaces';
2
+ declare const StreamPlayer: ({ streamInputs, cloudflareStreamDomain, preferredLocale, onError, hlsConfig, }: StreamPlayerProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default StreamPlayer;
@@ -0,0 +1,30 @@
1
+ export type StreamLifecycleStatus = "disconnected" | "ready" | "ended";
2
+ export interface StreamLifecycle {
3
+ isInput: boolean;
4
+ videoUID: string | null;
5
+ live: boolean;
6
+ status: StreamLifecycleStatus;
7
+ chunked: boolean;
8
+ unstable: {
9
+ ltxEnabled: boolean;
10
+ };
11
+ }
12
+ export interface GetStreamLifecycleProps {
13
+ cloudflareId: string;
14
+ cloudflareStreamDomain: string;
15
+ }
16
+ export declare const GetStreamLifecycle: ({ cloudflareId, cloudflareStreamDomain, }: GetStreamLifecycleProps) => Promise<StreamLifecycle | null>;
17
+ export interface UseGetStreamLifecycleOptions {
18
+ enabled?: boolean;
19
+ refetchOnWindowFocus?: boolean;
20
+ }
21
+ export declare const useGetStreamLifecycle: (cloudflareId?: string, cloudflareStreamDomain?: string, options?: UseGetStreamLifecycleOptions) => {
22
+ data: StreamLifecycle | null;
23
+ isLoading: boolean;
24
+ isFetching: boolean;
25
+ error: Error | null;
26
+ refetch: () => Promise<void>;
27
+ isLive: boolean;
28
+ status: StreamLifecycleStatus;
29
+ videoUID: string | null;
30
+ };
@@ -0,0 +1,30 @@
1
+ import { default as Hls } from 'hls.js';
2
+ interface UseStreamPlayerProps {
3
+ cloudflareId?: string;
4
+ cloudflareStreamDomain: string;
5
+ videoRef: React.RefObject<HTMLVideoElement | null>;
6
+ onError?: (error: {
7
+ type: string;
8
+ message: string;
9
+ fatal: boolean;
10
+ }) => void;
11
+ hlsConfig?: Partial<Hls["config"]>;
12
+ }
13
+ export declare const useStreamPlayer: ({ cloudflareId, cloudflareStreamDomain, videoRef, onError, hlsConfig, }: UseStreamPlayerProps) => {
14
+ isLive: boolean;
15
+ hasError: boolean;
16
+ playing: boolean;
17
+ volume: number;
18
+ muted: boolean;
19
+ qualities: {
20
+ level: number;
21
+ height: number;
22
+ label: string;
23
+ }[];
24
+ currentQuality: number;
25
+ handlePlayPause: () => void;
26
+ handleVolumeChange: (newVolume: number) => void;
27
+ handleMuteToggle: () => void;
28
+ handleQualityChange: (level: number) => void;
29
+ };
30
+ export {};
@@ -0,0 +1,18 @@
1
+ import { default as Hls } from 'hls.js';
2
+ export interface BaseStreamInput {
3
+ id: string;
4
+ name: string;
5
+ locale?: string;
6
+ cloudflareId: string;
7
+ }
8
+ export interface StreamPlayerProps {
9
+ streamInputs: BaseStreamInput[];
10
+ cloudflareStreamDomain: string;
11
+ preferredLocale?: string;
12
+ onError?: (error: {
13
+ type: string;
14
+ message: string;
15
+ fatal: boolean;
16
+ }) => void;
17
+ hlsConfig?: Partial<Hls["config"]>;
18
+ }
@@ -0,0 +1 @@
1
+ export declare const GetLivestreamUrl: (cloudflareId: string, cloudflareStreamDomain: string) => string;
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@connectedxm/stream-player",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "type": "module",
6
+ "main": "dist/index.es.js",
7
+ "module": "dist/index.es.js",
8
+ "types": "dist/lib/index.d.ts",
9
+ "style": "dist/stream-player.css",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.es.js",
13
+ "types": "./dist/lib/index.d.ts"
14
+ },
15
+ "./styles.css": "./dist/stream-player.css"
16
+ },
17
+ "scripts": {
18
+ "dev": "vite --port 3050 --mode development --force",
19
+ "build": "tsc -b ./tsconfig.lib.json && vite build",
20
+ "local": "npm run build && npm pack",
21
+ "upgrade": "ncu -i --format group",
22
+ "test": "vitest",
23
+ "test:run": "vitest run"
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "peerDependencies": {
29
+ "react": "^19.0.0",
30
+ "react-dom": "^19.0.0"
31
+ },
32
+ "devDependencies": {
33
+ "@tailwindcss/vite": "^4.1.17",
34
+ "@types/node": "^22.15.3",
35
+ "@types/react": "^19.2.7",
36
+ "@types/react-dom": "^19.2.3",
37
+ "@vitejs/plugin-react": "^5.1.1",
38
+ "react": "^19.2.0",
39
+ "react-dom": "^19.2.0",
40
+ "tailwindcss": "^4.1.17",
41
+ "typescript": "^5.9.3",
42
+ "vite": "^7.2.4",
43
+ "vite-plugin-css-injected-by-js": "^3.5.2",
44
+ "vite-plugin-dts": "^4.5.4",
45
+ "vitest": "^4.0.14"
46
+ },
47
+ "dependencies": {
48
+ "hls.js": "^1.6.15"
49
+ }
50
+ }