Skip to content

Commit da2177d

Browse files
authored
chore: Fix android audio format issues (#952)
1 parent 9e9bb6b commit da2177d

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

app.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
44
return {
55
name: 'Chatwoot',
66
slug: process.env.EXPO_PUBLIC_APP_SLUG || 'chatwoot-mobile',
7-
version: '4.0.19',
7+
version: '4.0.20',
88
orientation: 'portrait',
99
icon: './assets/icon.png',
1010
userInterfaceStyle: 'light',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chatwoot/mobile-app",
3-
"version": "4.0.19",
3+
"version": "4.0.20",
44
"scripts": {
55
"start": "expo start --dev-client",
66
"start:production": "expo start --no-dev --minify",

src/screens/chat-screen/components/audio-recorder/AudioRecorder.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,19 @@ export const AudioRecorder = ({
100100
const dirs = RNFetchBlob.fs.dirs;
101101
const path = Platform.select({
102102
ios: `audio-${localRecordedAudioCacheFilePaths.length}.m4a`,
103-
android: `${dirs.CacheDir}/audio-${localRecordedAudioCacheFilePaths.length}.mp3`,
103+
android: `${dirs.CacheDir}/audio-${localRecordedAudioCacheFilePaths.length}.aac`,
104104
});
105105

106106
ARPlayer.startRecorder(path, {
107107
AVFormatIDKeyIOS: AVEncodingOption.aac,
108108
AVNumberOfChannelsKeyIOS: 2,
109109
AVSampleRateKeyIOS: 44100,
110+
AudioSourceAndroid: 1, // MIC
111+
OutputFormatAndroid: 6, // AAC_ADTS
112+
AudioEncoderAndroid: 3, // AAC
113+
AudioSamplingRateAndroid: 16000,
114+
AudioEncodingBitRateAndroid: 128000,
115+
AudioChannelsAndroid: 2,
110116
})
111117
.then((value: string) => {
112118
if (value) {
@@ -148,9 +154,9 @@ export const AudioRecorder = ({
148154
return {
149155
uri: finalPath,
150156
originalPath: finalPath,
151-
type: 'audio/mp3',
152-
fileName: `audio-${localRecordedAudioCacheFilePaths.length}.mp3`,
153-
name: `audio-${localRecordedAudioCacheFilePaths.length}.mp3`,
157+
type: 'audio/aac',
158+
fileName: `audio-${localRecordedAudioCacheFilePaths.length}.aac`,
159+
name: `audio-${localRecordedAudioCacheFilePaths.length}.aac`,
154160
fileSize: stats.size,
155161
};
156162
}

0 commit comments

Comments
 (0)