Skip to content
← Public packages

@kentcdodds/spotify

Spotify playback, playlist, search, library, and device helpers.

src/exports/transfer-playback.ts

18 lines · 859 B · TypeScript
import { transferPlayback } from '../lib/spotify-api.ts'
import type { TransferPlaybackParams } from '../lib/export-types.ts'

/**
 * Transfer Spotify playback to another Connect device.
 * Prefer `deviceName` (and optional `deviceType`) over raw `deviceId`.
 * All params accept an optional `account` ('personal' | 'family', default 'personal').
 * @returns Confirmation with ok, action 'transferred', deviceId, play flag, and status.
 * @example
 * import transferPlayback from 'kody:@kentcdodds/spotify/transfer-playback'
 * const result = await transferPlayback({ deviceName: 'Living Room', play: true })
 * // => { ok: true, action: 'transferred', deviceId: '...', play: true, status: 204 }
 */
async function spotifyTransferPlayback(params: TransferPlaybackParams = {}) {
	return await transferPlayback(params)
}

export default spotifyTransferPlayback