upload video to firebase and show it in next js
Hello
when i uploaded a video to firebase from nextjs project and tried to show it the console gives me this error
video:1 Access to video at 'https://firebasestorage.googleapis.com/v0/b/video-tutorial-6f559.firebasestorage.app/o/videos%2Fmysql%20-%20no%20connection%20established%20or%20unable%20to%20connect%20to%20local%20host.mp4?alt=media&token=b7f221ba-553f-4ca7-aaea-4e387666cc06' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
i think i must edit something in the rules in the firebase storage rules but i don't know what..
can you help me ?
2 Replies
@Amro_97
By default, Firebase Storage restricts access. To allow public access (not recommended for production), update your Firebase Storage rules.
Go to
Firebase Console -> Storage -> Rules
, and modify them to:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read;
allow write: if request.auth != null;
}
}
}
Why not use uploadthing?