diff --git a/package/expo-package/src/handlers/Audio.ts b/package/expo-package/src/handlers/Audio.ts index f67c3fcb94..5283131e8f 100644 --- a/package/expo-package/src/handlers/Audio.ts +++ b/package/expo-package/src/handlers/Audio.ts @@ -216,7 +216,6 @@ export const Audio = AudioComponent ? { startRecording: async (recordingOptions: RecordingOptions, onRecordingStatusUpdate) => { try { - console.log('Requesting permissions..'); const permissionsGranted = await AudioComponent.getPermissionsAsync().granted; if (!permissionsGranted) { await AudioComponent.requestPermissionsAsync(); @@ -225,7 +224,6 @@ export const Audio = AudioComponent allowsRecordingIOS: true, playsInSilentModeIOS: true, }); - console.log('Starting recording..'); const androidOptions = { audioEncoder: AndroidAudioEncoder.AAC, extension: '.aac', @@ -258,7 +256,6 @@ export const Audio = AudioComponent }, stopRecording: async () => { try { - console.log('Stopping recording..'); await AudioComponent.setAudioModeAsync({ allowsRecordingIOS: false, }); diff --git a/package/native-package/src/optionalDependencies/Audio.ts b/package/native-package/src/optionalDependencies/Audio.ts index 4ed2c36f28..7de216b604 100644 --- a/package/native-package/src/optionalDependencies/Audio.ts +++ b/package/native-package/src/optionalDependencies/Audio.ts @@ -171,16 +171,13 @@ const verifyAndroidPermissions = async () => { export const Audio = AudioRecorderPackage ? { pausePlayer: async () => { - console.log('Pause Player..'); await audioRecorderPlayer.pausePlayer(); }, resumePlayer: async () => { - console.log('Resume Player..'); await audioRecorderPlayer.resumePlayer(); }, startPlayer: async (uri, _, onPlaybackStatusUpdate) => { try { - console.log('Starting Player..'); const playback = await audioRecorderPlayer.startPlayer(uri); console.log({ playback }); audioRecorderPlayer.addPlayBackListener((status) => { @@ -191,7 +188,6 @@ export const Audio = AudioRecorderPackage } }, startRecording: async (options: RecordingOptions, onRecordingStatusUpdate) => { - console.log('Starting recording..'); if (Platform.OS === 'android') { try { await verifyAndroidPermissions(); @@ -230,12 +226,14 @@ export const Audio = AudioRecorderPackage } }, stopPlayer: async () => { - console.log('Stopping player..'); - await audioRecorderPlayer.stopPlayer(); - audioRecorderPlayer.removePlayBackListener(); + try { + await audioRecorderPlayer.stopPlayer(); + audioRecorderPlayer.removePlayBackListener(); + } catch (error) { + console.log(error); + } }, stopRecording: async () => { - console.log('Stopping recording..'); await audioRecorderPlayer.stopRecorder(); audioRecorderPlayer.removeRecordBackListener(); }, diff --git a/package/src/components/MessageInput/hooks/useAudioController.tsx b/package/src/components/MessageInput/hooks/useAudioController.tsx index 0708c2c403..917336f606 100644 --- a/package/src/components/MessageInput/hooks/useAudioController.tsx +++ b/package/src/components/MessageInput/hooks/useAudioController.tsx @@ -138,11 +138,9 @@ export const useAudioController = () => { await Audio.stopPlayer(); } // For Expo CLI - if (recording && typeof recording !== 'string') { - if (soundRef.current?.stopAsync && soundRef.current?.unloadAsync) { - await soundRef.current.stopAsync(); - await soundRef.current?.unloadAsync(); - } + if (soundRef.current?.stopAsync && soundRef.current?.unloadAsync) { + await soundRef.current.stopAsync(); + await soundRef.current?.unloadAsync(); } };