@fishjam-cloud/react-client
Version:
React client library for Fishjam
35 lines • 1.21 kB
TypeScript
import { LivestreamError } from "@fishjam-cloud/ts-client";
export type ConnectViewerConfig = {
token: string;
streamId?: never;
} | {
streamId: string;
token?: never;
};
/**
* @category Livestream
*/
export interface UseLivestreamViewerResult {
/** The received livestream media */
stream: MediaStream | null;
/**
* Callback to start receiving a livestream.
* If the livestream is private, provide `token`.
* If the livestream is public, provide `streamId`.
*/
connect: (config: ConnectViewerConfig, url?: string) => Promise<void>;
/** Callback used to disconnect from a stream previously connected to with {@link connect} */
disconnect: () => void;
/** Any errors encountered in {@link connect} will be present in this field. */
error: LivestreamError | null;
/** Utility flag which indicates the current connection status */
isConnected: boolean;
getStatistics: () => Promise<RTCStatsReport | undefined>;
}
/**
* Hook for receiving a published livestream.
* @category Livestream
* @group Hooks
*/
export declare const useLivestreamViewer: () => UseLivestreamViewerResult;
//# sourceMappingURL=useLivestreamViewer.d.ts.map