Firebase storage, audio,

I try to download and play mp3 file that store in FIreabse.
I get the link from Firebase but cant play it.
I upload the audio on base64.

here is how I play the file:
const snd = new Audio(“data:audio/mp3;base64,” + url);
snd.play();

When you upload the audio to Firebase Storage, do you just pass the base64 string or do you also pass the appropriate metadata?

Also, if you copy/paste the downloadURL in the browser, does it play?

I pass base64 string and pass metadata for mp3.
the url not working in the browser as is…

really thanks for your answer…

If it’s not working on the browser you might not be storing the appropriate metadata.

Can you actually download the .mp3 and play it on your computer?

the audio not working when I download it.
I was think its because I encode it to base64 so I need to decode the audio again to hear it…

anyway here is how I save the file >>

saveRecord() {

     const audioFile = { name: `${this.currentUid}.mp3` };
      this.file.readAsDataURL(this.file.externalDataDirectory, audioFile.name).then((data: any) => {
        if (data) {
          const blob = new Blob([data], { type: “audio/mp3” });
          const uploadAudio = this.usersStorageAboutRecordRef.child(`${this.currentUid}/${this.currentUid}.mp3`).put(blob);
          uploadAudio.on(firebase.storage.TaskEvent.STATE_CHANGED,
            (snapshot) => {
              var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
              console.dir(progress);
            }, (error) => {
              console.dir(error);
            }, () => {
              var downloadURL = uploadAudio.snapshot.downloadURL;
              console.dir(‘savedAudio1: ’,downloadURL);
            });
          uploadAudio.then((savedAudio) => {
            console.log(‘savedAudio: ’, savedAudio);
          });
        }
      });
  }

this.usersStorageAboutRecordRef = firebase.storage().ref(‘users/aboutMeRecord’);

Thanks a lot!!:slight_smile: