soundcloud-api-ts-next
    Preparing search index...

    Interface PlayerState

    Return shape for the usePlayer hook — controls audio playback of a SoundCloud track.

    const player = usePlayer(trackId);
    player.toggle(); // play or pause
    player.seek(30); // jump to 30 seconds
    interface PlayerState {
        duration: number;
        pause: () => void;
        play: () => void;
        playing: boolean;
        progress: number;
        seek: (time: number) => void;
        toggle: () => void;
    }
    Index

    Properties

    duration: number

    Total track duration in seconds.

    pause: () => void

    Pause playback.

    play: () => void

    Start playback.

    playing: boolean

    Whether audio is currently playing.

    progress: number

    Current playback position in seconds.

    seek: (time: number) => void

    Seek to a specific time in seconds.

    toggle: () => void

    Toggle between play and pause.