Open Zaniyar opened 6 years ago
Here is my Code:
constructor() { this._recorder = new TNSRecorder(); this._player = new TNSPlayer(); this.play_options = {audioFile:"~/test.mp3", loop:false}; this.record_options = {filename:"~/test.mp3"}; } onRecordTap(): void { this._recorder.start(this.record_options) .then((x)=>{ console.log(x) }) } onStopTap(): void { this._recorder.stop() .then((x)=>{ this._player.initFromFile(this.play_options).then(()=>{ this._player.play(); }) }) }
Here the errors:
Android: JS: ERROR Error: Uncaught (in promise): Error: java.io.FileNotFoundException: ~/test.mp3: open failed: ENOENT (No such file or directory) iOS:
JS: ERROR Error: Uncaught (in promise): Error: java.io.FileNotFoundException: ~/test.mp3: open failed: ENOENT (No such file or directory)
CONSOLE LOG file:///app/vendor.js:59681:20: NativeScript-Audio - TNSRecorder setCategoryError: null CONSOLE LOG file:///app/vendor.js:59681:20: NativeScript-Audio - TNSRecorder Error Domain=NSOSStatusErrorDomain Code=1718449215 "(null)"
In AndroidManifest.xml I have already READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE
Thx.
You are specifying an invalid path, try providing a full path like shown in the example:
https://github.com/nstudio/nativescript-audio/blob/26b2a65bd8a7a714dd615c0d20b0cf027c9d7db4/demo/app/main-view-model.ts#L71
https://github.com/nstudio/nativescript-audio/blob/26b2a65bd8a7a714dd615c0d20b0cf027c9d7db4/demo/app/main-view-model.ts#L85-L88
Here is my Code:
Here the errors:
Android:
JS: ERROR Error: Uncaught (in promise): Error: java.io.FileNotFoundException: ~/test.mp3: open failed: ENOENT (No such file or directory)
iOS:In AndroidManifest.xml I have already READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE
Thx.