This problem occurs only on the iOS device. On iOS simulator or Android device and simulator it works fine.
I am creating a recording, passing it a callback.
await Audio.Recording.createAsync(
{...Audio.RecordingOptionsPresets.HIGH_QUALITY},
statusUpdateCallback,
);
The callback receives an Audio.RecordingStatus object which should display some real time information about the recording.
const statusUpdateCallback = async (status: Audio.RecordingStatus) => {
console.log(status);
};
LOG {"canRecord": true, "durationMillis": 0, "isRecording": false, "mediaServicesDidReset": false, "metering": -120}
LOG {"canRecord": true, "durationMillis": 0, "isRecording": false, "mediaServicesDidReset": false, "metering": -120}
LOG {"canRecord": true, "durationMillis": 0, "isRecording": true, "mediaServicesDidReset": false, "metering": -28.657485961914062}
LOG {"canRecord": true, "durationMillis": 0, "isRecording": true, "mediaServicesDidReset": false, "metering": -24.778385162353516}
As you can see durationMillis
is zero on the device but it works on the simulator. What's more, it used to work on the device also, but at some point it stopped.
I have no idea how to troubleshoot this, could anybody give me some pointers please?
I tried installing/uninstalling the app, using both Expo Go and a Test Flight build.
Strange thing, it sorted itself after I restarted the iPhone.