I am trying to upload video files to Moralis, however, when I check in the dashboard or try to retrieve them, it is a black screen. Some videos work randomly but I do not know why? Can anyone help?
Here is my code
const saveAsset = async () => {
try {
// save the video to ipfs
const videodata = highlight.file;
const vidfile = new Moralis.File(highlight.file.name, videodata);
// const savedVid = await vidfile.saveIPFS();
// console.log(savedVid);
// console.log("saved video to ipfs");
// save the json to ipfs
const jsonfile = new Moralis.File("file.json", {
base64: btoa(JSON.stringify(highlight)),
});
//save video w Moralis Object
const highlightFile = new Moralis.Object("HighlightVideo");
console.log("created moralis object");
highlightFile.set("title", highlight.title);
console.log("set Title");
highlightFile.set("creatorAddress", highlight.creatorAddress)
console.log("set creatorAddress");
highlightFile.set("description", highlight.description);
console.log("set description");
highlightFile.set("video", vidfile);
console.log("set video");
highlightFile.set("supply", highlight.supply);
console.log("set supply");
highlightFile.set("price", highlight.price);
console.log("set price");
const uploadedVid = await highlightFile.save();
console.log(uploadedVid);
console.log("uploaded video to cloud");
setUploaded(true)
const savedFile = await jsonfile.saveIPFS();
console.log("i saved this file first", savedFile);
console.log("saved json to ipfs");
const savedVid = await vidfile.saveIPFS();
console.log(savedVid);
console.log("saved video to ipfs");
} catch (err) {
setError(err);
console.log("error error error error", Error);
}
};