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)=>{
|
app.get("/api/playback/:action", (req, res)=>{
|
||||||
const action = req.params.action;
|
const action = req.params.action;
|
||||||
switch(action) {
|
switch(action) {
|
||||||
|
case "playpause":
|
||||||
|
BrowserWindow.win.webContents.executeJavaScript("wsapi.togglePlayPause()")
|
||||||
|
res.send("Play/Pause toggle")
|
||||||
|
break;
|
||||||
case "play":
|
case "play":
|
||||||
BrowserWindow.win.webContents.executeJavaScript("MusicKit.getInstance().play()")
|
BrowserWindow.win.webContents.executeJavaScript("MusicKit.getInstance().play()")
|
||||||
res.send("Playing")
|
res.send("Playing")
|
||||||
|
|
|
@ -96,6 +96,9 @@ const wsapi = {
|
||||||
toggleShuffle() {
|
toggleShuffle() {
|
||||||
MusicKit.getInstance().shuffleMode = MusicKit.getInstance().shuffleMode === 0 ? 1 : 0
|
MusicKit.getInstance().shuffleMode = MusicKit.getInstance().shuffleMode === 0 ? 1 : 0
|
||||||
},
|
},
|
||||||
|
togglePlayPause() {
|
||||||
|
app.mk.isPlaying ? app.mk.pause() : app.mk.play()
|
||||||
|
},
|
||||||
toggleRepeat() {
|
toggleRepeat() {
|
||||||
if(MusicKit.getInstance().repeatMode == 0) {
|
if(MusicKit.getInstance().repeatMode == 0) {
|
||||||
MusicKit.getInstance().repeatMode = 1
|
MusicKit.getInstance().repeatMode = 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue