import { useContext } from "react"; import { PlayerContext, PlayerContextValue } from "./PlayerProvider"; export function usePlayerContext() : PlayerContextValue { const context = useContext(PlayerContext); if (!context) { throw new Error("useAudioPlayer must be used within a PlayerProvider"); } return context; }