Catch new audio recording error states.

This commit is contained in:
Nicholas Tinsley 2023-02-03 13:04:15 -05:00 committed by Alex Hart
parent 7bae8b6e1b
commit 10f376e402

View file

@ -3377,9 +3377,13 @@ public class ConversationParentFragment extends Fragment
requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
voiceNoteMediaController.pausePlayback();
try {
recordingSession = new RecordingSession(audioRecorder.startRecording());
disposables.add(recordingSession);
} catch (AssertionError err) {
Log.e(TAG, "Could not start audio recording.", err);
Toast.makeText(requireContext(), R.string.ConversationActivity_unable_to_record_audio, Toast.LENGTH_SHORT).show();
}
}
@Override
@ -3398,9 +3402,10 @@ public class ConversationParentFragment extends Fragment
requireActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
if (recordingSession != null) {
recordingSession.completeRecording();
}
}
@Override
public void onRecorderCanceled(boolean byUser) {