How do I specify the file format of a recording?

Please provide the following:

  1. SDK Version: 4.6.0
  2. Platforms(Android/iOS/web/all): Android/iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I am using the Expo Audio API to create and upload a recording to a server. It seems that I can do so, but I’m using an iPhone with a Windows PC. The iPhone uploads a CAF file, which my computer doesn’t understand.

Now, I can maybe install a codec on my PC, but I’m developing this application for a client business who may not want to have to install a codec to play the audio files that are uploaded to the server.

Can I tell the Expo Audio API that I want the recording in a format other than CAF, such as m4a?

So, I just tried this:

let recordingOptions = {

                isMeteringEnabled: basePreset.isMeteringEnabled,

                android: basePreset.android,

                ios: {

                    extension: ".mp4",

                    outputFormat: Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4HVXC,

                    audioQuality: basePreset.audioQuality,

                    sampleRate: basePreset.sampleRate,

                    numberOfChannels: basePreset.numberOfChannels,

                    bitRate: basePreset.bitRate,

                    bitRateStrategy: basePreset.bitRateStrategy,

                    bitDepthHint: basePreset.bitDepthHint,

                    linearPCMBitDepth: basePreset.linearPCMBitDepth,

                    linearPCMIsBigEndian: basePreset.linearPCMIsBigEndian,

                    linearPCMIsFloat: basePreset.linearPCMIsFloat

                }

            }

            await recording.prepareToRecordAsync(recordingOptions);

and I got an error:

[Unhandled promise rejection: Error: Prepare encountered an error: Error Domain=NSOSStatusErrorDomain Code=1718449215 “(null)”]
at node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:103:50 in promiseMethodWrapper
at node_modules@unimodules\react-native-adapter\build\NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
at node_modules\expo-av\build\Audio\Recording.js:214:4 in prepareToRecordAsync
at node_modules\regenerator-runtime\runtime.js:63:36 in tryCatch
at node_modules\regenerator-runtime\runtime.js:293:29 in invoke
at node_modules\regenerator-runtime\runtime.js:63:36 in tryCatch
at node_modules\regenerator-runtime\runtime.js:154:27 in invoke
at node_modules\regenerator-runtime\runtime.js:189:16 in PromiseImpl$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:45:6 in tryCallTwo
at node_modules\react-native\node_modules\promise\setimmediate\core.js:200:22 in doResolve
at node_modules\react-native\node_modules\promise\setimmediate\core.js:66:11 in Promise
at node_modules\regenerator-runtime\runtime.js:188:15 in callInvokeWithMethodAndArg
at node_modules\regenerator-runtime\runtime.js:211:38 in enqueue
at node_modules\regenerator-runtime\runtime.js:238:8 in exports.async
at node_modules\expo-av\build\Audio\Recording.js:209:4 in setProgressUpdateInterval
at node_modules\regenerator-runtime\runtime.js:63:36 in tryCatch
at node_modules\regenerator-runtime\runtime.js:293:29 in invoke
at node_modules\regenerator-runtime\runtime.js:63:36 in tryCatch
at node_modules\regenerator-runtime\runtime.js:154:27 in invoke
at node_modules\regenerator-runtime\runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.