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));
|
||||
});
|
||||
}
|
||||
}
|
|
@ -107,5 +107,8 @@ const wsapi = {
|
|||
}else{
|
||||
MusicKit.getInstance().repeatMode = 0
|
||||
}
|
||||
},
|
||||
getmaxVolume() {
|
||||
ipcRenderer.send('wsapi-returnvolumeMax',JSON.stringify(app.cfg.audio.maxVolume));
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ var app = new Vue({
|
|||
player: {
|
||||
currentMediaItem: {},
|
||||
songActions: false,
|
||||
maxVolume: 1,
|
||||
lyrics: {},
|
||||
lyricsMediaItem: {},
|
||||
lyricsDebug: {
|
||||
|
@ -161,6 +162,11 @@ var app = new Vue({
|
|||
volume: volume
|
||||
}));
|
||||
},
|
||||
getVolumeMax() {
|
||||
socket.send(JSON.stringify({
|
||||
action: "volumeMax",
|
||||
}));
|
||||
},
|
||||
getQueue() {
|
||||
socket.send(JSON.stringify({
|
||||
action: "get-queue"
|
||||
|
@ -570,6 +576,9 @@ var app = new Vue({
|
|||
self.updatePlaybackState(response.data)
|
||||
}
|
||||
break;
|
||||
case "maxVolume":
|
||||
this.player.maxVolume = response.data;
|
||||
break;
|
||||
}
|
||||
// console.log(e.data);
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@
|
|||
<div class="player-volume-glyph decrease"></div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input type="range" class="web-slider volume-slider" max="1" min="0" step="0.01"
|
||||
<input type="range" class="web-slider volume-slider" :max="getVolumeMax()" min="0" step="0.01"
|
||||
@input="setVolume($event.target.value)" :value="player.currentMediaItem.volume">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue