Cordova media plugin play and record error after force exit


#1

Hello everyone. I hope somebody can help me with my problem. I have inside my app audio recorder which was created with cordova-media-plugin. Also app can record in background mode (when user is not in app). Everything works great besides only one case:

  1. Creating file. For example lol.m4a
  2. run file.startRecord();
  3. go home screen
  4. kill app with help task manager

So about my problem:
When i opening the app next time i see that recorded file is available and it’s not empty and i even can play it in VLC player but media plugin can’t play it and throwing error

2017-11-26 15:01:57.450070+0200 speechpad[61328:5090308] Will attempt to use file resource '/Users/oleksandernaberezhnev/Library/Developer/CoreSimulator/Devices/29276D98-735A-475D-B66B-6158299B644A/data/Containers/Data/Application/1CD2D253-8163-4C3A-95BF-3FAC36E3121E/Library/NoCloud/speechpad/sp-1511698611729/sp-1511698611729.m4a'
2017-11-26 15:01:57.450599+0200 speechpad[61328:5090465] 103:  OpenFromDataSource failed
2017-11-26 15:01:57.450691+0200 speechpad[61328:5090465] 78:  Open failed
2017-11-26 15:01:57.452572+0200 speechpad[61328:5090465] Failed to initialize AVAudioPlayer: The operation couldn’t be completed. (OSStatus error 1685348671.)