jsierles / react-native-audio

Audio recorder library for React Native
MIT License
1.16k stars 539 forks source link

Is it possible to recover recording which receive incoming phone call in the middle of record? #307

Open oded-regev opened 5 years ago

oded-regev commented 5 years ago

Version

Tell us which versions you are using ( you can see the versions in your package.json ):

react-native-audio : "^4.3.0" react-native : "0.57.7" react : "16.6.1" using react-native-sound ? Yes

Expected behaviour :

(Tested on iOS device)

I want to record audio from the application and be able to recover the recording when an incoming phone call received in the middle of recording.

Actual behaviour

incoming call will cause the recording to immediately stop (even before answering the call, it will happen immediately when the call appears on screen), with no option to recover

Steps to reproduce

1) Start recording on device 2) Receive an incoming phone call 3) Recording will stop

Link to a git repo that reproduces bug

If you put a GitHub repo that reproduces your issue then you significantly increase your chances of getting help !

liamse commented 5 years ago

You need to pause recording and go to background when you receive an incoming phone call. you then resume the record when phone call is ended. you can use mine react-native-call-observer to handle phone calls.

julioxavierr commented 5 years ago

@liamse hey, opened a PR on your repo to improve the native module. BTW, do you mind to share your code to so I can see how are you handling this particular case? I couldn't pause then resume the audio after an incoming call when the app is in background, it works only when the app is active.

oded-regev commented 5 years ago

a good example on how this can be done is here: https://stackoverflow.com/questions/54169447/avaudiorecorder-how-to-recover-from-incoming-call

Of course you'll have to write the JS bridge for it

julioxavierr commented 5 years ago

Hey @oded-regev . I was able to achieve this adding a patch to this repo: https://github.com/julioxavierr/react-native-audio/tree/patch-1

But thanks for the response!