Add stop command

This commit is contained in:
2025-04-20 01:23:34 -07:00
parent dd79fd9ecd
commit 98f4bd032a
2 changed files with 9 additions and 0 deletions

View File

@@ -142,6 +142,10 @@ export class MediaPlayer {
return this.modify(UserEvent.NowPlayingUpdate, () => this.writeCommand("set_property", ["pause", true])); 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() { public async skip() {
return this.modify(UserEvent.PlaylistUpdate, () => this.writeCommand("playlist-next", [])); return this.modify(UserEvent.PlaylistUpdate, () => this.writeCommand("playlist-next", []));
} }

View File

@@ -55,6 +55,11 @@ apiRouter.post("/pause", withErrorHandling(async (req, res) => {
res.send(JSON.stringify({ success: true })); 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) => { apiRouter.post("/skip", withErrorHandling(async (req, res) => {
await mediaPlayer.skip(); await mediaPlayer.skip();
res.send(JSON.stringify({ success: true })); res.send(JSON.stringify({ success: true }));