Skip to content
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

Best way to handle audio interruptions? #624

Open
joshmohrer opened this issue Jul 30, 2024 · 7 comments
Open

Best way to handle audio interruptions? #624

joshmohrer opened this issue Jul 30, 2024 · 7 comments

Comments

@joshmohrer
Copy link

Please fill the template to help you out. Also, please try the Example project compare before submiting the issue when you have certain issue with your project setup.

Version of react-native-audio-recorder-player

3.6.7 and 3.6.10

I suddenly have started receiving pings from users indicating interruptions are deleting their recordings. This seems to be happening all at once so either something changed in my app (most likely) or perhaps in iOS?

I was wondering if anyone could share how they handle interruptions on the react native side. As it stands, interruptions seem to restart the recording and discard the audio up to that point. Could anyone share an example of how they handle this?

Version of React Native

Platforms you faced the error (IOS or Android or both?)

Expected behavior

Actual behavior

Steps to reproduce the behabior

@tinkon
Copy link

tinkon commented Jul 31, 2024

I am facing the same problem.

@joshmohrer
Copy link
Author

For now ive moved to expo-av which has gotten better with Expo 51 and handled interruptions a little more elegantly.

@tinkon
Copy link

tinkon commented Aug 1, 2024

According to this commit, this issue should not have been there. I'm not sure what we are doing wrong.

a280080

@tinkon
Copy link

tinkon commented Aug 1, 2024

I messed with the code a bit. It calls to pause and resume based on the interrupt event beginning and end. The problem is, in some cases, you would just want to stop the player and save the file recorded so far. It seems that if you call stopRecorder while it is in the paused stage, you lose the file.

@zeRonaldo
Copy link

I was Having the Exact same issue,

  • I downgraded the lib to before the fix 3.6.6
    -I had to make a module on my native side to handle system audio alert interruptions this rippled a trigger on my ReactNative side, which then paused the recording; BUT and there's a big one, the issue was on IOS;

so I had to put on higher stakes:

  • the bug is a normal behavior on audio implementation dictionary that can be seen here it calls the prepareRecord function that zeroes our current audio;
  • I altered the implementation to keep 2 separate stages, 1 for paused/interrupted audios inside an easily accessible folder; and one for stopped audios (or consolidated);
  • this worked, but I still had audio pieces and not a complete audio, So I stitched them together after hitting stop, using native code;

@codecomeon
Copy link

I was Having the Exact same issue,

  • I downgraded the lib to before the fix 3.6.6
    -I had to make a module on my native side to handle system audio alert interruptions this rippled a trigger on my ReactNative side, which then paused the recording; BUT and there's a big one, the issue was on IOS;

so I had to put on higher stakes:

  • the bug is a normal behavior on audio implementation dictionary that can be seen here it calls the prepareRecord function that zeroes our current audio;
  • I altered the implementation to keep 2 separate stages, 1 for paused/interrupted audios inside an easily accessible folder; and one for stopped audios (or consolidated);
  • this worked, but I still had audio pieces and not a complete audio, So I stitched them together after hitting stop, using native code;

I did the same, i use ffmpeg-kit to merge all the pieces.

@awallish
Copy link

Downgrading from 3.6.10 to 3.6.7 fixed this for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants