jibon57 / nativescript-mediafilepicker

A complete file picker solution for NativeScript
Apache License 2.0
51 stars 39 forks source link

'getFIles' does not fire after audio record #87

Closed anki247 closed 4 years ago

anki247 commented 5 years ago

Describe the bug The event getFIles does not fire after recording audio. Even cancel event fires sometimes (mostly not). From 30 tries I saw once that getFiles triggered with correct data which seem for me weird... I also see that the recorded audio is saved in [Appfolder]/IQAudio, but if there is no event I can not detect when I can look into this folder... :(

To Reproduce

Expected behavior getFiles triggers with file info

NativeScript Info(please run tns info):

Sample Code(please provide minimum code to reproduce problem):

const audioOption: AudioPickerOptions = {
  android: {
    isCaptureMood: true, // if true then voice recorder will open directly.
    isNeedRecorder: true,
    maxNumberFiles: 1,
    isNeedFolderList: false,
  },
  ios: {
    isCaptureMood: true, // if true then voice recorder will open directly.
    maxNumberFiles: 1,
  }
};

export const pickMusic = () => {
  let mediaPicker = new Mediafilepicker();
  mediaPicker.openAudioPicker(audioOption);

  mediaPicker.on("getFiles", function (res) {
    console.log('--> FILE ******************', res);
  });

  mediaPicker.on("error", function (res) {
    console.log('--> Error: ', res);
  });

  mediaPicker.on("cancel", function (res) {
    let msg = res.object.get('msg');
    console.log('--> Cancel: ' , res);
  });
}

Additional context Log:

AVAudioSession.mm:249:HandleRouteChange: Posting AVAudioSessionRouteChangeNotification. Reason: 3
AVAudioSession.mm:249:HandleRouteChange: Posting AVAudioSessionRouteChangeNotification. Reason: 3
AVAudioSession.mm:2315:-[AVAudioSession privateInterruptionWithInfo:]: Posting AVAudioSessionInterruptionNotification (Begin Interruption). Was suspended:0