1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-10 22:11:50 +02:00

iOS: Fixes #12314: Fix error shown the first time a user attempts to record (#12328)

This commit is contained in:
Henry Heino
2025-05-27 09:20:42 -07:00
committed by GitHub
parent fa0dbddb9b
commit f5e751c27a

View File

@@ -14,7 +14,7 @@ import { Text } from 'react-native-paper';
import { AndroidAudioEncoder, AndroidOutputFormat, IOSAudioQuality, IOSOutputFormat, RecordingOptions } from 'expo-av/build/Audio';
import time from '@joplin/lib/time';
import { toFileExtension } from '@joplin/lib/mime-utils';
import { formatMsToDurationCompat } from '@joplin/utils/time';
import { formatMsToDurationCompat, msleep } from '@joplin/utils/time';
const logger = Logger.create('AudioRecording');
@@ -119,6 +119,11 @@ const useAudioRecorder = (onFileSaved: OnFileSavedCallback, onDismiss: ()=> void
if (!response.granted) {
throw new Error(_('Missing permission to record audio.'));
}
// Work around "This experience is currently in the background, so the audio session could not be activated"
// See https://github.com/expo/expo/issues/21782
// May be resolved by migrating to expo-audio.
await msleep(500);
}
await Audio.setAudioModeAsync({