Firebase Storage video upload error Cross origin is NULL

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Firebase Storage video upload error Cross origin is NULL



I am trying to upload store the videos on Firebase Storage .The code works for images ,but for videos it shows:



Failed to load https://firebasestorage.googleapis.com/v0/b/resource-access-point.appspot.com/o?name=vid%2Fvideoplayback.mp4: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.




<html>

<head>

</head>

<body>
<progress value="0" max="100" id="uploadprog"></progress>
<input type="file" id="upinput"/>
<button onclick="mew()">get url</button>
</body>
<script src="https://www.gstatic.com/firebasejs/5.3.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: ""
};
firebase.initializeApp(config);
function mew()
{
console.log("downloading link");
var storageRef = firebase.storage().ref("vid/dp_001.jpg ");
storageRef.getDownloadURL().then(function(url) {
console.log(url);
});
}




var prog=document.getElementById('uploadprog');
var input=document.getElementById('upinput');
// console.log("progress");
// console.log(prog);

input.addEventListener('change',function(e){
console.log("will upload the files now");
var file=e.target.files[0];
var ref=firebase.storage().ref('vid/'+file.name);
var task=ref.put(file);
task.on('state_changed',
function progress(snap)
{
var per=(snap.bytesTransferred/snap.totalBytes)*100;
prog.value=per;
}
,function error(err)
{
console.log(err);
},
function complete()
{
console.log("file uploaded successfully");
}
);

// console.log("hell yeah");
});
</script>


</html>



Can anyone help me?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results