Skip to content

[Refactor] useVideoPlayer hardcodes maxRetries = 3 with no external configuration #775

Description

@RUKAYAT-CODER

Overview

src/app/hooks/useVideoPlayer.tsx defines maxRetries as a hardcoded constant of 3. On mobile connections or slow networks, 3 retries may be insufficient; on a high-reliability CDN, 1 retry might be enough. The value is exported in the hook return object, suggesting callers might want to control it, but the prop is never accepted.

Specifications

Features:

  • maxRetries is configurable via a hook parameter with a sensible default of 3
  • Callers can increase retries for poor network scenarios

Tasks:

  • Add maxRetries?: number = 3 to the hook options parameter
  • Remove the hardcoded constant and use the parameter instead
  • Update the hook's TypeScript interface to include maxRetries in the options type
  • Add a test that passes maxRetries: 1 and asserts only one retry is attempted

Impacted Files:

  • src/app/hooks/useVideoPlayer.tsx

Acceptance Criteria

  • useVideoPlayer({ maxRetries: 5 }) retries up to 5 times on error
  • Default behavior (3 retries) is unchanged when the option is omitted
  • TypeScript correctly types the options parameter

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions