Hiyve Components - v1.0.0
    Preparing search index...

    Function useStreaming

    • Access live streaming state and controls.

      Provides the current streaming status, a live duration counter that updates every second while streaming is active, and actions to start and stop streaming to external platforms (e.g., YouTube, Twitch).

      Returns {
          clearStreamingError: () => void;
          error: string | null;
          featuredUserId: string | null;
          isStreaming: boolean;
          isStreamingStarting: boolean;
          startStreaming: (options?: StreamingOptions) => Promise<void>;
          stopStreaming: () => Promise<void>;
          streamingDuration: number;
          streamingId: string | null;
          streamingStartTime: Date | null;
          streamingUrl: string | null;
      }

      Object containing streaming state (isStreaming, isStreamingStarting, streamingId, featuredUserId, streamingStartTime, streamingDuration, streamingUrl, error) and actions (startStreaming, stopStreaming, clearStreamingError)

      • clearStreamingError: () => void
      • error: string | null
      • featuredUserId: string | null
      • isStreaming: boolean
      • isStreamingStarting: boolean
      • startStreaming: (options?: StreamingOptions) => Promise<void>
      • stopStreaming: () => Promise<void>
      • streamingDuration: number
      • streamingId: string | null
      • streamingStartTime: Date | null
      • streamingUrl: string | null
      import { useStreaming } from '@hiyve/rn-react';

      function StreamingControls() {
      const { isStreaming, streamingDuration, streamingUrl, startStreaming, stopStreaming } = useStreaming();

      return (
      <View>
      {isStreaming && <Text>Live: {streamingDuration}s</Text>}
      {streamingUrl && <Text>Stream URL: {streamingUrl}</Text>}
      <Button
      title={isStreaming ? 'Stop Streaming' : 'Go Live'}
      onPress={() => isStreaming ? stopStreaming() : startStreaming({ url: 'rtmp://...' })}
      />
      </View>
      );
      }