MediaPlugin does not save audio recording into file [ionic-native]

Hi everyone, I found this solution

// Create root file -> my_file.mp3
this.file.createFile(this.file.externalApplicationStorageDirectory, 'my_file.mp3', true).then(() => {
  // Get file created -> my_file.mp3
  let audioObject: MediaObject = this.media.create(this.file.externalApplicationStorageDirectory.replace(/file:\/\//g, '') + 'my_file.mp3');
  audioObject.release();
  // Start Record
  audioObject.startRecord();

  // This method is very important to know your execution process
  // In my case the recording interface is not shown as in IOS
  audioObject.onStatusUpdate.forEach(n => {
    switch (n) {
        case MEDIA_STATUS.RUNNING: // return code 2 = recording audio
          // recording
        break;
        case MEDIA_STATUS.STOPPED: // return code 4 = stopped audio
            this.file.readAsDataURL(this.file.externalApplicationStorageDirectory, 'my_file.mp3').then(audioo => {
              // base64 audio
            });
            this.loading.hide();
        break;
    }

  });

  window.setTimeout(() => audioObject.stopRecord(), 9000);
});
DOCS https://www.npmjs.com/package/cordova-plugin-media

Media.MEDIA_NONE = 0;
Media.MEDIA_STARTING = 1;
Media.MEDIA_RUNNING = 2;
Media.MEDIA_PAUSED = 3;
Media.MEDIA_STOPPED = 4;

I hope it helps many. :grinning: