Workaround of AudioEffect crashing on Lenovo tablets (#7309)
Android 14 on Lenovo tablets does not intialize this AudioEffect. Catch this exception and continue playback.
This commit is contained in:
parent
be3ad792b6
commit
627d8ee83f
|
@ -274,14 +274,22 @@ public class ExoPlayerWrapper {
|
||||||
public void setVolume(float v, float v1) {
|
public void setVolume(float v, float v1) {
|
||||||
if (v > 1) {
|
if (v > 1) {
|
||||||
exoPlayer.setVolume(1f);
|
exoPlayer.setVolume(1f);
|
||||||
if (loudnessEnhancer != null) {
|
try {
|
||||||
loudnessEnhancer.setEnabled(true);
|
if (loudnessEnhancer != null) {
|
||||||
loudnessEnhancer.setTargetGain((int) (1000 * (v - 1)));
|
loudnessEnhancer.setEnabled(true);
|
||||||
|
loudnessEnhancer.setTargetGain((int) (1000 * (v - 1)));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d(TAG, e.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exoPlayer.setVolume(v);
|
exoPlayer.setVolume(v);
|
||||||
if (loudnessEnhancer != null) {
|
try {
|
||||||
loudnessEnhancer.setEnabled(false);
|
if (loudnessEnhancer != null) {
|
||||||
|
loudnessEnhancer.setEnabled(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d(TAG, e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue