mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-26 13:25:49 +08:00
fix(player): suppress volume indicator during audio duck events (#1899)
When using AAudio output on Android, the system notifies the app to manually handle ducking instead of silently lowering volume itself. This caused the in-app volume indicator to pop up on every notification. Pass showIndicator: false for duck begin/end calls so volume is adjusted silently, consistent with other audio output modes.
This commit is contained in:
@@ -507,8 +507,11 @@ class PlPlayerController with BlockConfigMixin {
|
||||
return _instance?.volume.value;
|
||||
}
|
||||
|
||||
static Future<void>? setVolumeIfExists(double volumeNew) {
|
||||
return _instance?.setVolume(volumeNew);
|
||||
static Future<void>? setVolumeIfExists(
|
||||
double volumeNew, {
|
||||
bool showIndicator = true,
|
||||
}) {
|
||||
return _instance?.setVolume(volumeNew, showIndicator: showIndicator);
|
||||
}
|
||||
|
||||
Box video = GStorage.video;
|
||||
@@ -1255,7 +1258,7 @@ class PlPlayerController with BlockConfigMixin {
|
||||
bool volumeInterceptEventStream = false;
|
||||
|
||||
static final double maxVolume = PlatformUtils.isDesktop ? 2.0 : 1.0;
|
||||
Future<void> setVolume(double volume) async {
|
||||
Future<void> setVolume(double volume, {bool showIndicator = true}) async {
|
||||
if (this.volume.value != volume) {
|
||||
this.volume.value = volume;
|
||||
try {
|
||||
@@ -1269,7 +1272,9 @@ class PlPlayerController with BlockConfigMixin {
|
||||
if (kDebugMode) debugPrint(err.toString());
|
||||
}
|
||||
}
|
||||
volumeIndicator.value = true;
|
||||
if (showIndicator) {
|
||||
volumeIndicator.value = true;
|
||||
}
|
||||
volumeInterceptEventStream = true;
|
||||
volumeTimer?.cancel();
|
||||
volumeTimer = Timer(const Duration(milliseconds: 200), () {
|
||||
|
||||
Reference in New Issue
Block a user