mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
Merge 0c67c297aa into f9c05af45f
This commit is contained in:
commit
b090c16c1e
1 changed files with 18 additions and 0 deletions
|
|
@ -242,6 +242,24 @@
|
|||
$effect(() => {
|
||||
// reactive on `assetFileUrl` changes
|
||||
if (videoPlayer && assetFileUrl) {
|
||||
const player = videoPlayer as HTMLVideoElement & { _logVolumeApplied?: boolean };
|
||||
if (!player._logVolumeApplied) {
|
||||
player._logVolumeApplied = true;
|
||||
const originalDesc = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'volume')!;
|
||||
let currentUiVolume = videoPlayer.volume;
|
||||
Object.defineProperty(videoPlayer, 'volume', {
|
||||
get() {
|
||||
return currentUiVolume;
|
||||
},
|
||||
set(val: number) {
|
||||
currentUiVolume = val;
|
||||
// Apply quadratic curve to hardware volume
|
||||
originalDesc.set!.call(videoPlayer, Math.pow(val, 2));
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
videoPlayer.volume = currentUiVolume;
|
||||
}
|
||||
hasFocused = false;
|
||||
rebuildCount = 0;
|
||||
releaseSession();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue