@xnstream/player-sdk
Version:
XStream Player SDK - A powerful video player SDK for streaming content
116 lines • 2.82 kB
TypeScript
import { BufferAppendedData } from 'hls.js';
export type { BufferAppendedData };
export interface Stream {
id: string;
name: string;
description: string;
organization_id: string;
poster: {
original: string;
thumb: string;
};
}
export interface Vod {
id: string;
title?: string;
organization_id: string;
thumbnail?: {
cover: string;
thumb: string;
};
}
export interface Resource {
type: 'live' | 'vod';
resource: Stream | Vod;
}
export interface MediaSession {
host: string;
sig: string;
}
export interface PlayerConfig {
theme?: {
primary?: string;
secondary?: string;
background?: string;
[key: string]: string | undefined;
};
[key: string]: unknown;
}
export interface RSession {
sid: string;
resource: Resource;
config?: PlayerConfig;
}
export interface RegistrationResponse extends RSession {
aps: string;
}
export interface StreamPlayerOptions {
appId: string;
stream_code: string;
containerId: string;
autoPlay?: boolean;
context?: Record<string, any>;
}
export interface Level {
id: number;
bitrate: number;
width: number;
height: number;
frameRate: number;
videoCodec?: string;
audioCodec?: string;
}
export interface ProgressUpdate {
position: number;
seekStart: number;
seekEnd: number;
latency?: number;
targetLatency?: number;
}
export interface StreamPlayerEvents {
ready: () => void;
playing: () => void;
paused: () => void;
ended: () => void;
buffering: () => void;
error: (error: Error) => void;
onResourceChange: (resource: Resource) => void;
onDataLoaded: (duration: number) => void;
volumechange: (volume: number) => void;
onLevelSwitch: (level: Level) => void;
onLevelsLoaded: (levels: Level[]) => void;
onBufferUpdated: (buffer: BufferAppendedData) => void;
onProgressUpdate: (progress: ProgressUpdate) => void;
}
export interface AnalyticsData {
events: Array<{
name: string;
timestamp: number;
data: object;
}>;
device: UDevice;
version: string;
pb_id: string;
ow: string;
}
export interface UDevice {
user_agent: string;
ua_client_type: string;
ua_client_name: string;
ua_client_version: string;
ua_client_engine: string;
ua_client_engine_version: string;
ua_device_type: string;
ua_device_brand: string;
ua_device_model: string;
ua_os_name: string;
ua_os_version: string;
}
export interface DeviceInfo extends UDevice {
}
export interface SecureStorage {
get(key: string): Promise<string | undefined>;
set(key: string, value: string): Promise<void>;
remove(key: string): Promise<void>;
}
//# sourceMappingURL=types.d.ts.map