Skip to main content

usePlayerState()

usePlayerState(): PlayerState

Returns the player’s current playback state.

This hook provides a reactive way to observe and respond to changes in the player’s state — e.g., whether it’s playing, buffering, paused, or ended.

⚠️ Must be used within a PlayerProvider or AVPlayerViewControllerProvider component.

Returns

PlayerState

PlayerState The current player state.

Example

const player = usePlayer();
const playerState = usePlayerState();

const onPress = useCallback(() => {
if (playerState === PlayerState.Ended) {
player?.replay();
}
}, [player, playerState]);