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

    Function useStreamingDuration

    • Hook to track streaming duration.

      Parameters

      • startTime: Date | null

        The streaming start time, or null if not streaming

      Returns number

      The duration in seconds

      This hook computes the streaming duration in seconds from a start time. It updates every second while streaming is active.

      import { useStreamingDuration } from '@hiyve/react-capture';

      function StreamingTimer({ isStreaming, startTime }) {
      const duration = useStreamingDuration(isStreaming ? startTime : null);

      return <span>{duration}s</span>;
      }