UNPKG

@msquared/pixel-streaming-client

Version:

Browser client for viewing pixel-streamed content from MSquared events

59 lines 1.9 kB
import { type ServerInfo } from "./types"; type Callbacks = { onStarted: () => void; onTerminated: (e?: GFNTerminationError) => void; }; export declare class GFNClientError extends Error { readonly name: string; } export declare const GFNClientNotInitialized: GFNClientError; export declare const GFNClientAlreadyInitialized: GFNClientError; export declare class GFNTerminationError extends GFNClientError { code: number; reason: number; readonly name: string; constructor(code: number, reason: number, message?: string, opts?: ErrorOptions); } type Config = { settings: { serviceUrl?: string; clientId: string; catalogClientId: string; partnerId: string; versionNumber?: string; }; }; type Auth = { cmsId: number; nonce: string; }; declare class GFNClient { readonly config: Config; readonly serverInfo: ServerInfo; private player?; constructor(config: Config, serverInfo: ServerInfo); start(container: HTMLElement, auth: Auth): Promise<GFNClientError | undefined>; cancel(): void; stop(): void; listen({ onTerminated, onStarted }: Callbacks): void; } /** * Configures the GFN client and logs in using the provided nonce. * * @returns the logged in client if successful, otherwise a {@link GFNClientError} */ export declare function initClient(config: Config): Promise<GFNClient | GFNClientError>; export declare function getClient(): GFNClient | GFNClientError; export declare function getOrInitClient(config: Config): Promise<GFNClient | GFNClientError>; export type GeforceStreamConfig = { cmsId: string; nonce: string; redirect: string; zone?: string; state?: string; }; export declare function buildGfnUrl(partnerId: string, cfg: GeforceStreamConfig, { fullscreen }?: { fullscreen?: boolean; }): string; export {}; //# sourceMappingURL=index.d.ts.map