When changing volume connected to chromecast change the device volume instead of the jellyfin-player volume

This commit is contained in:
Froghut 2019-03-31 12:05:54 +02:00
parent 9677981344
commit 732d8b5e26

View File

@ -779,12 +779,15 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
});
};
ChromecastPlayer.prototype.volumeDown = function () {
ChromecastPlayer.prototype.volumeDown = function () {
vol = this._castPlayer.session.receiver.volume.level;
if (vol == null)
vol = 0.5;
vol -= 0.02;
vol = Math.max(vol, 0);
this._castPlayer.session.setReceiverVolumeLevel(vol);
this._castPlayer.sendMessage({
options: {},
command: 'VolumeDown'
});
};
ChromecastPlayer.prototype.endSession = function () {
@ -799,24 +802,22 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
};
ChromecastPlayer.prototype.volumeUp = function () {
vol = this._castPlayer.session.receiver.volume.level;
if (vol == null)
vol = 0.5;
vol += 0.02;
vol = Math.min(vol, 1);
this._castPlayer.sendMessage({
options: {},
command: 'VolumeUp'
});
this._castPlayer.session.setReceiverVolumeLevel(vol);
};
ChromecastPlayer.prototype.setVolume = function (vol) {
vol = Math.min(vol, 100);
vol = Math.max(vol, 0);
this._castPlayer.sendMessage({
options: {
volume: vol
},
command: 'SetVolume'
});
vol = vol / 100;
this._castPlayer.session.setReceiverVolumeLevel(vol);
};
ChromecastPlayer.prototype.unpause = function () {