increase desktop max volume

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-17 14:05:30 +08:00
parent 830f3b60e0
commit 02e0d34127
3 changed files with 8 additions and 4 deletions

View File

@@ -59,7 +59,10 @@ class PlayerFocus extends StatelessWidget {
void _setVolume({required bool isIncrease}) { void _setVolume({required bool isIncrease}) {
final volume = isIncrease final volume = isIncrease
? math.min(1.0, plPlayerController.volume.value + 0.1) ? math.min(
PlPlayerController.maxVolume,
plPlayerController.volume.value + 0.1,
)
: math.max(0.0, plPlayerController.volume.value - 0.1); : math.max(0.0, plPlayerController.volume.value - 0.1);
plPlayerController.setVolume(volume); plPlayerController.setVolume(volume);
} }

View File

@@ -1336,6 +1336,7 @@ class PlPlayerController {
Timer? volumeTimer; Timer? volumeTimer;
final RxBool volumeInterceptEventStream = false.obs; final RxBool volumeInterceptEventStream = false.obs;
static final double maxVolume = PlatformUtils.isDesktop ? 2.0 : 1.0;
Future<void> setVolume(double volume) async { Future<void> setVolume(double volume) async {
if (this.volume.value != volume) { if (this.volume.value != volume) {
this.volume.value = volume; this.volume.value = volume;

View File

@@ -1116,7 +1116,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final double volume = clampDouble( final double volume = clampDouble(
plPlayerController.volume.value - delta.dy / level, plPlayerController.volume.value - delta.dy / level,
0.0, 0.0,
1.0, PlPlayerController.maxVolume,
); );
plPlayerController.setVolume(volume); plPlayerController.setVolume(volume);
}, },
@@ -1340,7 +1340,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final double volume = clampDouble( final double volume = clampDouble(
plPlayerController.volume.value - event.localPanDelta.dy / level, plPlayerController.volume.value - event.localPanDelta.dy / level,
0.0, 0.0,
1.0, PlPlayerController.maxVolume,
); );
plPlayerController.setVolume(volume); plPlayerController.setVolume(volume);
}, },
@@ -1358,7 +1358,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final volume = clampDouble( final volume = clampDouble(
plPlayerController.volume.value + offset, plPlayerController.volume.value + offset,
0.0, 0.0,
1.0, PlPlayerController.maxVolume,
); );
plPlayerController.setVolume(volume); plPlayerController.setVolume(volume);
} }