@fishjam-cloud/react-client
Version:
React client library for Fishjam
40 lines • 1.66 kB
TypeScript
import { LivestreamError } from "@fishjam-cloud/ts-client";
/** @category Livestream */
export type StreamerInputs = {
/** The video source to publish. e.g. `cameraStream` from {@link useCamera} or `stream` from {@link useScreenShare} */
video: MediaStream;
/** The audio source to publish. e.g. `microphoneStream` from {@link useMicrophone} or `stream` from {@link useScreenShare} */
audio?: MediaStream | null;
} | {
video?: null;
audio: MediaStream;
};
/** @category Livestream */
export type ConnectStreamerConfig = {
inputs: StreamerInputs;
/** Streamer token used to authenticate with Fishjam */
token: string;
};
/** @category Livestream */
export interface UseLivestreamStreamerResult {
/**
* Callback used to start publishing the selected audio and video media streams.
*
* @remarks
* Calling {@link connect} multiple times will have the effect of only publishing the **last** specified inputs.
*/
connect: (inputs: ConnectStreamerConfig, urlOverride?: string) => Promise<void>;
/** Callback to stop publishing anything previously published with {@link connect} */
disconnect: () => void;
/** Any errors encountered in {@link connect} will populate this field */
error: LivestreamError | null;
/** Utility flag which indicates the current connection status */
isConnected: boolean;
}
/**
* Hook for publishing a livestream, which can be then received with {@link useLivestreamViewer}
* @category Livestream
* @group Hooks
*/
export declare const useLivestreamStreamer: () => UseLivestreamStreamerResult;
//# sourceMappingURL=useLivestreamStreamer.d.ts.map