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:33
drawerOpen boolean src/contexts/PlayerContext.tsx:29
setDrawerOpen (open) => void src/contexts/PlayerContext.tsx:30
setShowFurigana (show) => void src/contexts/PlayerContext.tsx:32
setSrt (file) => void src/contexts/PlayerContext.tsx:22
setSrtFileId (id) => void src/contexts/PlayerContext.tsx:26
setSrtFileName (name) => void src/contexts/PlayerContext.tsx:24
setTimestamp (time) => void src/contexts/PlayerContext.tsx:35
setVideo (file) => void src/contexts/PlayerContext.tsx:16
setVideoFileId (id) => void src/contexts/PlayerContext.tsx:20
setVideoFileName (name) => void src/contexts/PlayerContext.tsx:18
setVideoUrl (url) => void src/contexts/PlayerContext.tsx:28
showFurigana boolean src/contexts/PlayerContext.tsx:31
srt File | null src/contexts/PlayerContext.tsx:21
srtFileId string | null src/contexts/PlayerContext.tsx:25
srtFileName string | null src/contexts/PlayerContext.tsx:23
timestamp number | null src/contexts/PlayerContext.tsx:34
video File | null src/contexts/PlayerContext.tsx:15
videoFileId string | null src/contexts/PlayerContext.tsx:19
videoFileName string | null src/contexts/PlayerContext.tsx:17
videoUrl string | null src/contexts/PlayerContext.tsx:27

PlayerProviderProps

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

PlayerProviderProps Defines the shape of the Player Provider Props

Properties

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

Variables

PlayerProvider

const PlayerProvider: React.FC<PlayerProviderProps>;

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

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

props

The props for the component.

Returns

The provider component.

Functions

usePlayer()

function usePlayer(): PlayerContextState;

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

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.