added /api/playback/next and previous
This commit is contained in:
parent
fb9bf582db
commit
eb505291f9
1 changed files with 9 additions and 1 deletions
|
@ -150,7 +150,7 @@ export class BrowserWindow {
|
||||||
res.render("main", this.EnvironmentVariables);
|
res.render("main", this.EnvironmentVariables);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/playback/:action", (req, res)=>{
|
app.get("/api/playback/:action", (req, res)=>{
|
||||||
const action = req.params.action;
|
const action = req.params.action;
|
||||||
switch(action) {
|
switch(action) {
|
||||||
case "play":
|
case "play":
|
||||||
|
@ -165,6 +165,14 @@ export class BrowserWindow {
|
||||||
BrowserWindow.win.webContents.executeJavaScript("MusicKit.getInstance().stop()")
|
BrowserWindow.win.webContents.executeJavaScript("MusicKit.getInstance().stop()")
|
||||||
res.send("Stopped")
|
res.send("Stopped")
|
||||||
break;
|
break;
|
||||||
|
case "next":
|
||||||
|
BrowserWindow.win.webContents.executeJavaScript("MusicKit.getInstance().skipToNextItem()")
|
||||||
|
res.send("Next")
|
||||||
|
break;
|
||||||
|
case "previous":
|
||||||
|
BrowserWindow.win.webContents.executeJavaScript("MusicKit.getInstance().skipToPreviousItem()")
|
||||||
|
res.send("Previous")
|
||||||
|
break;
|
||||||
default: {
|
default: {
|
||||||
res.send("Invalid action")
|
res.send("Invalid action")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue