How to upload audio to firebase storage?

100 Views Asked by At

how do uploading audio to Firebase storage python, 1.wav.wav is a audio file that i want to upload to my firebase

import pyrebase

config = {
 "apiKey": "xxxxxxxxxxxxxxxxxx",
    "authDomain": "xxxxxxxxxxx",
    "projectId": "xxxxxxxxxxx",
    "storageBucket": "xxxxxxxxxxxxxx",
    "messagingSenderId": "xxxxxxxxxxxxx",
    "appId": "xxxxxxxxxxxxxxxxxxxx",
    "measurementId": "G-5GCDEC526E"
}

firebase = pyrebase.initialize_app(config)
localpath="1.wav.wav" 
cloudpath="audios/audi1.wav"


firebase.storage().child(cloudpath).put(localpath)
1

There are 1 best solutions below

0
jmvcollaborator On BEST ANSWER

I see databaseURL missing, double check your config and add it as shown below:

import pyrebase

config = {
 "apiKey": "xxxxxxxxxxxxxxxxxx",
    "authDomain": "xxxxxxxxxxx",
    "projectId": "xxxxxxxxxxx",
    “databaseURL” : “https://project_name.firebaseio.com",
    "storageBucket": "xxxxxxxxxxxxxx",
    "messagingSenderId": "xxxxxxxxxxxxx",
    "appId": "xxxxxxxxxxxxxxxxxxxx",
    "measurementId": "G-5GCDEC526E"
}

#initializing firebase {pyrebase}

firebase = pyrebase.initialize_app(config)

#initializing storage variable

storage = firebase.storage()

#uploading the audio to firebase database
#storage.child(“folder_name/audio_name”).put(“file_to_be_uploaded”)

storage.child(“audios/audi1.wav”).put(“./1.wav.wav”)