mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-15 18:08:17 -07:00
Merge pull request #5740 from dmitrylyzo/fix-tv-volume
Don't change volume if it is physically controlled
This commit is contained in:
commit
e0a0c92b43
@ -33,6 +33,10 @@ function enableLocalPlaylistManagement(player) {
|
||||
return player.isLocalPlayer;
|
||||
}
|
||||
|
||||
function supportsPhysicalVolumeControl(player) {
|
||||
return player.isLocalPlayer && appHost.supports('physicalvolumecontrol');
|
||||
}
|
||||
|
||||
function bindToFullscreenChange(player) {
|
||||
if (Screenfull.isEnabled) {
|
||||
Screenfull.on('change', function () {
|
||||
@ -1157,7 +1161,7 @@ class PlaybackManager {
|
||||
self.setVolume = function (val, player) {
|
||||
player = player || self._currentPlayer;
|
||||
|
||||
if (player) {
|
||||
if (player && !supportsPhysicalVolumeControl(player)) {
|
||||
player.setVolume(val);
|
||||
}
|
||||
};
|
||||
@ -1165,15 +1169,17 @@ class PlaybackManager {
|
||||
self.getVolume = function (player) {
|
||||
player = player || self._currentPlayer;
|
||||
|
||||
if (player) {
|
||||
if (player && !supportsPhysicalVolumeControl(player)) {
|
||||
return player.getVolume();
|
||||
}
|
||||
|
||||
return 1;
|
||||
};
|
||||
|
||||
self.volumeUp = function (player) {
|
||||
player = player || self._currentPlayer;
|
||||
|
||||
if (player) {
|
||||
if (player && !supportsPhysicalVolumeControl(player)) {
|
||||
player.volumeUp();
|
||||
}
|
||||
};
|
||||
@ -1181,7 +1187,7 @@ class PlaybackManager {
|
||||
self.volumeDown = function (player) {
|
||||
player = player || self._currentPlayer;
|
||||
|
||||
if (player) {
|
||||
if (player && !supportsPhysicalVolumeControl(player)) {
|
||||
player.volumeDown();
|
||||
}
|
||||
};
|
||||
|
@ -263,7 +263,10 @@ class HtmlAudioPlayer {
|
||||
document.body.appendChild(elem);
|
||||
}
|
||||
|
||||
elem.volume = htmlMediaHelper.getSavedVolume();
|
||||
// TODO: Move volume control to PlaybackManager. Player should just be a wrapper that translates commands into API calls.
|
||||
if (!appHost.supports('physicalvolumecontrol')) {
|
||||
elem.volume = htmlMediaHelper.getSavedVolume();
|
||||
}
|
||||
|
||||
self._mediaElement = elem;
|
||||
|
||||
|
@ -1584,7 +1584,11 @@ export class HtmlVideoPlayer {
|
||||
playerDlg.innerHTML = html;
|
||||
const videoElement = playerDlg.querySelector('video');
|
||||
|
||||
videoElement.volume = getSavedVolume();
|
||||
// TODO: Move volume control to PlaybackManager. Player should just be a wrapper that translates commands into API calls.
|
||||
if (!appHost.supports('physicalvolumecontrol')) {
|
||||
videoElement.volume = getSavedVolume();
|
||||
}
|
||||
|
||||
videoElement.addEventListener('timeupdate', this.onTimeUpdate);
|
||||
videoElement.addEventListener('ended', this.onEnded);
|
||||
videoElement.addEventListener('volumechange', this.onVolumeChange);
|
||||
|
Loading…
Reference in New Issue
Block a user