Skip to content

PlayerContext

This file defines the context for managing the state of the video player. It allows the player's state (e.g., loaded video, subtitles, settings) to persist across component mounts and unmounts, enabling navigating between pages.

Interfaces

PlayerContextState

Defined in: src/contexts/PlayerContext.tsx:14

PlayerContextState Defines the shape of the data stored in the PlayerContext.

Properties

Property Type Defined in
clearPlayerState () => void src/contexts/PlayerContext.tsx:29
drawerOpen boolean src/contexts/PlayerContext.tsx:25
setDrawerOpen (open) => void src/contexts/PlayerContext.tsx:26
setShowFurigana (show) => void src/contexts/PlayerContext.tsx:28
setSrt (file) => void src/contexts/PlayerContext.tsx:20
setSrtFileName (name) => void src/contexts/PlayerContext.tsx:22
setVideo (file) => void src/contexts/PlayerContext.tsx:16
setVideoFileName (name) => void src/contexts/PlayerContext.tsx:18
setVideoUrl (url) => void src/contexts/PlayerContext.tsx:24
showFurigana boolean src/contexts/PlayerContext.tsx:27
srt null | File src/contexts/PlayerContext.tsx:19
srtFileName null | string src/contexts/PlayerContext.tsx:21
video null | File src/contexts/PlayerContext.tsx:15
videoFileName null | string src/contexts/PlayerContext.tsx:17
videoUrl null | string src/contexts/PlayerContext.tsx:23

PlayerProviderProps

Defined in: src/contexts/PlayerContext.tsx:38

PlayerProviderProps Defines the shape of the Player Provider Props

Properties

Property Type Defined in
children ReactNode src/contexts/PlayerContext.tsx:39

Variables

PlayerProvider

const PlayerProvider: React.FC<PlayerProviderProps>;

Defined in: src/contexts/PlayerContext.tsx:48

The provider component that supplies the PlayerContext to its children. It encapsulates the state logic and provides the state and action functions to its descendants.

Param

The props for the component.

Returns

The provider component.

Functions

usePlayer()

function usePlayer(): PlayerContextState;

Defined in: src/contexts/PlayerContext.tsx:100

A custom hook for consuming the PlayerContext.

Returns

PlayerContextState

The state and actions from the PlayerContext.

Throws

If the hook is used outside of a PlayerProvider.