useVideoLoop

A hook for managing video playback loops with fade transitions.

Installation

This hook is included when you install the video-loop component:

Usage

Parameters

ParameterTypeRequiredDescription
videosstring[]YesArray of video URLs to loop through
repeatCountnumberYesNumber of times each video should repeat

Return Value

PropertyTypeDescription
videoRefRefObject<HTMLVideoElement>Ref to attach to the video element
currentIndexnumberIndex of the currently playing video
currentRepeatnumberCurrent repeat count (0-indexed)
currentVideostringURL of the currently playing video

How It Works

  1. The hook manages video playback state and automatically handles video transitions
  2. Each video plays repeatCount times before moving to the next
  3. Uses the useFadeElement hook to create smooth transitions between videos
  4. Automatically loops back to the first video after the last one finishes
  5. The video element referenced by videoRef will autoplay when the source changes

Dependencies

This hook depends on:

  • useFadeElement - for fade transitions between videos

Example with Custom Controls