apache / apache/cordova-plugin-media
Recorded file neither saving nor playing
- Dominant language
- JavaScript
- Stars
- 391
- Forks
- 762
- PR merge metrics
- No merged PRs in 30d
Description
I'm using this plugin with ionic capacitor instead of cordova with command ```ionic cap sync```.
My code:
```
audioFile: MediaObject;
constructor(private media: Media, private plt: Platform, private file: File) {}
ionViewDidEnter() {
this.plt.ready()
.then(() => {
setTimeout(() => {
this.audioFile = this.media.create(this.file.externalRootDirectory + 'audiofile.mp3');
this.audioFile.onStatusUpdate.subscribe(status => console.log('status: ', status));
this.audioFile.onSuccess.subscribe(() => console.log('Action is successful'));
this.audioFile.onError.subscribe(error => console.log('Error: ', error));
}, 1000);
})
.catch(err => console.log('ready error: ', err));
}
record() {
// When record button clicked
this.audioFile.startRecord();
}
stop() {
// When stop button clicked
this.audioFile.stopRecord();
this.audioFile.play();
}
```
When I clicked record, output was: ```Error: 1``` and when I stopped recording than the output was ```status: 4``` and ```Action is successful```
I expected to either play the recording or get ```audiofile.mp3``` in file manager of my android device but I didn't got any of it.
Contributor guide
Research direction
Reproduce the shown Ionic Capacitor flow and start at the MediaObject calls startRecord(), stopRecord(), and play(), checking the Android path and error/status handling for externalRootDirectory. Done means recording succeeds, audiofile.mp3 is available at the expected location, and the recorded audio plays without the reported error or status-only result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, typescript
- Domain
- audio-video-rtc, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100