Media Plugin (cordova-plugin-media) not recording

Hi all,

I’m trying to capture an audio in Android with the Media Plugin but the recorded file seems to be corrupted. My code is:

Imports
´
import {MediaPlugin} from ‘ionic-native’;
import { File } from ‘@ionic-native/file’;
´

Start recording function

public startRecord() {
let filepath = this.file.externalDataDirectory + “my_audio.mp3”;
this._fileRecord = new MediaPlugin(path);
this._fileRecord.startRecord();
}

Stop recording function

public stopRecord(): void {
this._fileRecord.stopRecord();
}

I’m sure is working because I can see the file in /storage/emulated/0/Android/data/<app_name>/files.
When I try to reproduce it with the play() method an error with code 1 appears.

'
public startPlay(): void {
let filepath = this.file.externalDataDirectory + “my_audio.mp3”;
this._fileRecord = new MediaPlugin(filepath);

this._fileRecord.init.then(() => {
  console.log("alert playback finished..");

      }, (err) => {
  console.log("on error.." + JSON.stringify(err));

});

this._fileRecord.play();

}

I don’t see any system alert saying that I want to use the microphone or something similar.
What could be the problem? Permissions? Incorrect code?
Is cordova-plugin-media the correct plugin o is cordova-plugin-media-capture?
Any working code is welcomed?

Thanks and best regards.