Ionic 2 - IOS both: Native Media Plugin and crodova media plugin Not working


#1

I am trying to record audio using the cordova media plugin, I followed few solutions about creating file before starting media and replacing the “file://” prefix. without success. The file is created but seems like media.create fails as the file stays 0Bytes

this.file.createFile(this.dir, this.filename, true).then(() => {
this.m = this.media.create(this.dir.replace(/^file:///, ‘’) + this.filename);
this.m.startRecord();
}).catch(e=>alert(JSON.stringify(e)));

this.dir has value of tempDirecotory

I have also tried to use the cordova media plugin directly without success it gives me error:
“failed to start recording using avaudiorecorder code 1”

Any guidance is appreciated.
Thanks