volume max for web remote so I don't go deaf
This commit is contained in:
parent
748db1030a
commit
308193061d
4 changed files with 27 additions and 1 deletions
|
@ -61,6 +61,9 @@ export class wsapi {
|
|||
electron.ipcMain.on('wsapi-returnLyrics', (_event: any, arg: any) => {
|
||||
this.returnLyrics(JSON.parse(arg));
|
||||
});
|
||||
electron.ipcMain.on('wsapi-returnvolumeMax', (_event: any, arg: any) => {
|
||||
this.returnmaxVolume(JSON.parse(arg));
|
||||
});
|
||||
this.wss = new WebSocketServer({
|
||||
port: this.port,
|
||||
perMessageDeflate: {
|
||||
|
@ -162,6 +165,10 @@ export class wsapi {
|
|||
this._win.webContents.executeJavaScript(`MusicKit.getInstance().stop()`);
|
||||
response.message = "Stopped";
|
||||
break;
|
||||
case "volumeMax":
|
||||
this._win.webContents.executeJavaScript(`wsapi.getmaxVolume()`);
|
||||
response.message = "maxVolume";
|
||||
break;
|
||||
case "volume":
|
||||
this._win.webContents.executeJavaScript(`MusicKit.getInstance().volume = ${parseFloat(data.volume)}`);
|
||||
response.message = "Volume";
|
||||
|
@ -295,4 +302,11 @@ export class wsapi {
|
|||
client.send(JSON.stringify(response));
|
||||
});
|
||||
}
|
||||
|
||||
returnmaxVolume(vol: any) {
|
||||
const response: standardResponse = {status: 0, data: vol, message: "OK", type: "maxVolume"};
|
||||
this.clients.forEach(function each(client: any) {
|
||||
client.send(JSON.stringify(response));
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue