New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to stopAndUnloadAsync a recording that just got started #1709
Comments
I am having the same problem with Expo 32.0.2 on Android. If I call recording.stopAndUnloadAsync() less than 120ms after recording.startAsync() is resolved, I get the following error:
|
I am facing the same issue no matter how long I wait. |
I'm facing this issue too. It says: |
hello guys, I face the same error. Did you solve the error ? |
I had this issue after getting overly ES6.
vs
This allows |
Some updates about this issue? I'm having this issue on latest version and I haven't way to stop a recording |
I'm still having this issue too. Any solutions? It is something to do with the fact that its all asynchronous |
I also got this problem so far, |
I made it work by seriously consider the docs
by introducing a hook for recording instance Here's the full source: https://gist.github.com/tanbt/857da772db304c0f1562b28c823a0777 (just for the recording feature). |
@IjzerenHein So I can say this isn't a bug, but the docs' example can be improved |
Thanks for investigating this @tanbt! We'll have a closer look at this! |
Hi! I've taken a closer look at this and updated the snack to work with SDK 38 and add some additional error handling. https://snack.expo.io/@ijzerenhein/43e79d What appears to be going on, is that when After digging around, it seems that the MediaRecorder class on Android will purposely cause
So in short, this behaviour is sort of by design in Android. But unfortunately expo-av is not handling this case or giving an appropriate error. We'll have a look on how to address this. |
For anyone who needs this fix on managed until the SDK 40 release comes out... try {
await recordRef.current.stopAndUnloadAsync();
} catch (e) {
if (e.message.includes("Stop encountered an error: recording not stopped")) {
await ExponentAV.unloadAudioRecorder();
await recordRef.current._cleanupForUnloadedRecorder({durationMillis: 0} as any);
} else {
await handleError(e, {userMessage: "An error occurred stopping the recording."});
}
} finally {
recordRef.current = undefined;
timerStop();
success = true;
} |
@Aryk could you tell me more about I use
|
Look at the stopAndUnloadAsync function. I added it because I saw it there as well. |
Reproducible Demo
https://snack.expo.io/rJ6j67G6f
After calling
await recording.startAsync()
, it needs at least ~300ms beforerecording.stopAndUnloadAsync()
can be called, otherwise it'll fail and subsequentstartAsync
calls will result inTested on Android.
The text was updated successfully, but these errors were encountered: