play walkout songs

This commit is contained in:
yohlo
2025-09-22 17:57:29 -05:00
parent ae934e77f4
commit b93ce38d48
12 changed files with 152 additions and 42 deletions

View File

@@ -96,6 +96,17 @@ export class SpotifyWebApiClient {
});
}
async playTrack(trackId: string, deviceId?: string, positionMs?: number): Promise<void> {
const endpoint = deviceId ? `/me/player/play?device_id=${deviceId}` : '/me/player/play';
await this.request(endpoint, {
method: 'PUT',
body: JSON.stringify({
uris: [`spotify:track:${trackId}`],
position_ms: positionMs || 0,
}),
});
}
async pause(): Promise<void> {
await this.request('/me/player/pause', {
method: 'PUT',