I am trying to upload a video that I have selected from the gallery of the simulator to firebase-storage. However, the places where I log errors, print errors. I am using iOS 15.5 and the video I am trying to upload is file:///Users/data/Containers/Data/Application/146F1DDE-5281-4646-8639-8E4C51B06958/Library/Caches/ImagePicker/4FF42B68-B66C-4020-B4EC-03AFF907FE18.mov.
import firebase from "firebase";
require("firebase/firebase-storage")
export const saveMediaToStorage = (media, path) => new Promise((resolve,reject)=> {
const fileRef = firebase.storage().ref().child(path)
fetch(media)
.then(response =>response.blob())
.then(blob =>fileRef.put(blob))
.catch(()=>console.log("Error1"))
.then(task =>task.ref.getDownloadURL())
.catch(()=>console.log("Error2"))
.then(downloadUrl =>resolve(downloadUrl))
.catch(() => reject())
})
Here is my package.json file
{
"name": "academical",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.17.10",
"@react-native-community/masked-view": "^0.1.11",
"@react-navigation/core": "^6.3.0",
"@react-navigation/material-bottom-tabs": "^6.2.3",
"@react-navigation/native": "^6.0.12",
"@react-navigation/stack": "^6.2.3",
"expo": "^46.0.9",
"expo-av": "~12.0.4",
"expo-camera": "~12.3.0",
"expo-constants": "~13.2.3",
"expo-image-picker": "~13.3.1",
"expo-media-library": "~14.2.0",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"expo-video-thumbnails": "~6.4.0",
"firebase": "^8.10.1",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.5",
"react-native-gesture-handler": "^2.6.0",
"react-native-linear-gradient": "^2.6.2",
"react-native-paper": "^4.12.4",
"react-native-reanimated": "^2.10.0",
"react-native-safe-area-context": "4.3.1",
"react-native-screens": "~3.15.0",
"react-native-vector-icons": "^9.2.0",
"react-native-web": "~0.18.7",
"react-navigation": "^4.4.4",
"react-redux": "^8.0.2",
"redux": "^4.2.0",
"redux-thunk": "^2.4.1",
"uuid-random": "^1.3.2"
},
"devDependencies": {
"@babel/core": "^7.12.9"
}
}