Skip to content

Commit 6c15fa3

Browse files
committed
Fix playItem tool for contextUri offset
1 parent 9bb8fb9 commit 6c15fa3

3 files changed

Lines changed: 58 additions & 54 deletions

File tree

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 54 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,9 @@ async function playItemCallback({ uri, contextUri }: PlayItemParameters): Promis
287287
if (!activeDevice?.id) {
288288
return 'No active device found. Start a Spotify client on a device.';
289289
}
290-
const uris = uri ? [uri] : void 0;
291-
await api.player.startResumePlayback(activeDevice.id, contextUri, uris);
290+
const uris = uri && !contextUri ? [uri] : void 0;
291+
const offset = uri && contextUri ? { uri } : void 0;
292+
await api.player.startResumePlayback(activeDevice.id, contextUri, uris, offset);
292293
return `Playback started on device: ${activeDevice?.name}`;
293294
} catch (error) {
294295
console.error('Error queuing track:', error);

0 commit comments

Comments
 (0)