• Gets the current playback state

    Retrieves the complete current playback state object containing all track information, playback details, and internal tracking data. This returns a direct reference to the state for performance reasons, so consumers should not modify the returned object.

    Returns PlaybackState

    Current playback state with all properties

    // Get current track information
    const state = getPlaybackState();
    if (state.isPlaying) {
    console.log(`Now playing: ${state.currentTrackName} by ${state.currentArtistName}`);
    }
    export function getPlaybackState(): PlaybackState {
    return playbackState;
    }