This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hi, I am using the native media plugin to record audio and then saving it in Firebase storage but am unable to play the file that is saved.
I am having to Blob() the file that is saved which I suspect is causing the issue as I can play it back when I save it locally and don't upload to Firebase.
I am trying to upload the file so that it can be played on other devices using the streaming media plugin.
Here is my code that uploads the file, any help would be really appreciated as I am going round in circles on this.
upload(fileName) {
if (this.platform.is('ios')) {
this.filePath = this.file.tempDirectory.replace(/^file:\/\//, '') fileName;
} else if (this.platform.is('android')) {
this.filePath = this.file.externalDataDirectory.replace(/file:\/\//g, '') fileName;
}
const ref = storage().ref('voiceRecordings/' fileName);
this.file.readAsDataURL(this.file.tempDirectory, fileName)
.then((file) => {
const blobFile = new Blob([file], {type: 'audio/mpeg-4'});
ref.put(blobFile).then((snapshot) => {
snapshot.ref.getDownloadURL().then((url) => {
this.sendVoice(url);
})
})
.catch(err => {
console.log('UPLOAD ERROR ', err)
});
})
.catch(err => {
})
}
Post Details
- Posted
- 5 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/ionic/comme...