mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 15:05:44 +03:00
avoid IllegalStateException for CallActivity#stopCallingSound
This might happen sometimes. For now it's a try-catch instead trying to control the state of the mediaPlayer which could be quite difficult. this will avoid the following exception: java.lang.IllegalStateException at android.media.MediaPlayer.isPlaying(Native Method) at com.nextcloud.talk.activities.CallActivity.stopCallingSound(CallActivity.java:2640) at com.nextcloud.talk.activities.CallActivity.lambda$setCallState$31$com-nextcloud-talk-activities-CallActivity(CallActivity.java:2583) at com.nextcloud.talk.activities.CallActivity$$ExternalSyntheticLambda7.run(Unknown Source:2) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:8167) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100) Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
a8225bfd27
commit
bad8e2a705
1 changed files with 11 additions and 5 deletions
|
@ -2593,14 +2593,20 @@ public class CallActivity extends CallBaseActivity {
|
|||
|
||||
private void stopCallingSound() {
|
||||
if (mediaPlayer != null) {
|
||||
try {
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
mediaPlayer.stop();
|
||||
}
|
||||
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e(TAG, "mediaPlayer was not initialized", e);
|
||||
} finally {
|
||||
if (mediaPlayer != null) {
|
||||
mediaPlayer.release();
|
||||
}
|
||||
mediaPlayer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary implementation of SignalingMessageReceiver until signaling related code is extracted from
|
||||
|
|
Loading…
Reference in a new issue