diff --git a/backend/src/MediaPlayer.ts b/backend/src/MediaPlayer.ts index f6d757e..991e553 100644 --- a/backend/src/MediaPlayer.ts +++ b/backend/src/MediaPlayer.ts @@ -142,6 +142,10 @@ export class MediaPlayer { return this.modify(UserEvent.NowPlayingUpdate, () => this.writeCommand("set_property", ["pause", true])); } + public async stop() { + return this.modify(UserEvent.NowPlayingUpdate, () => this.writeCommand("stop", [])); + } + public async skip() { return this.modify(UserEvent.PlaylistUpdate, () => this.writeCommand("playlist-next", [])); } diff --git a/backend/src/server.ts b/backend/src/server.ts index 707ba12..ea07991 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -55,6 +55,11 @@ apiRouter.post("/pause", withErrorHandling(async (req, res) => { res.send(JSON.stringify({ success: true })); })); +apiRouter.post("/stop", withErrorHandling(async (req, res) => { + await mediaPlayer.stop(); + res.send(JSON.stringify({ success: true })); +})); + apiRouter.post("/skip", withErrorHandling(async (req, res) => { await mediaPlayer.skip(); res.send(JSON.stringify({ success: true }));