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,15 +274,23 @@ public class ExoPlayerWrapper {
|
|||
public void setVolume(float v, float v1) {
|
||||
if (v > 1) {
|
||||
exoPlayer.setVolume(1f);
|
||||
try {
|
||||
if (loudnessEnhancer != null) {
|
||||
loudnessEnhancer.setEnabled(true);
|
||||
loudnessEnhancer.setTargetGain((int) (1000 * (v - 1)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, e.toString());
|
||||
}
|
||||
} else {
|
||||
exoPlayer.setVolume(v);
|
||||
try {
|
||||
if (loudnessEnhancer != null) {
|
||||
loudnessEnhancer.setEnabled(false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue