added /api/playback/playpause
This commit is contained in:
parent
eb505291f9
commit
f9a2954e51
2 changed files with 7 additions and 0 deletions
|
@ -153,6 +153,10 @@ export class BrowserWindow {
|
|||
app.get("/api/playback/:action", (req, res)=>{
|
||||
const action = req.params.action;
|
||||
switch(action) {
|
||||
case "playpause":
|
||||
BrowserWindow.win.webContents.executeJavaScript("wsapi.togglePlayPause()")
|
||||
res.send("Play/Pause toggle")
|
||||
break;
|
||||
case "play":
|
||||
BrowserWindow.win.webContents.executeJavaScript("MusicKit.getInstance().play()")
|
||||
res.send("Playing")
|
||||
|
|
|
@ -96,6 +96,9 @@ const wsapi = {
|
|||
toggleShuffle() {
|
||||
MusicKit.getInstance().shuffleMode = MusicKit.getInstance().shuffleMode === 0 ? 1 : 0
|
||||
},
|
||||
togglePlayPause() {
|
||||
app.mk.isPlaying ? app.mk.pause() : app.mk.play()
|
||||
},
|
||||
toggleRepeat() {
|
||||
if(MusicKit.getInstance().repeatMode == 0) {
|
||||
MusicKit.getInstance().repeatMode = 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue