Hey all,
I’m trying to upload videos (via code) to the Wix Gallery Pro media manager since it’s suppose to support images & videos. With the code below, I’m able to upload IMAGES but when I try VIDEOS it throughs the following error:
Wix code SDK error: The “src” property of the item at index 0 cannot be set to " wix:video:// v1/c8261d_a5cc506471fa4ca3a5399184cd3edb91/1080 snowboad trailer (online-video-cutter.com).mp4#posterUri=c8261d_a5cc506471fa4ca3a5399184cd3edb91f001.jpg&posterWidth=514&posterHeight=360". It must be a valid URL starting with “http://”, “https://”, or “wix:image://”.
This seems to imply that it doesn’t accept wix:videos.
Since the PRO GALLERY is suppose to accept videos, how am-I suppose to structure the uploadedFile ?
export function inputGalleryv_change(event, $w) {
let uploadedImageSizeLimit = 50000000;
if ($w("#gallery").items.length > 0) { //checks if there's already an item in the media manager
if ($w("#gallery").items[0].title === "NoItemUploaded") {
let items = $w("#gallery").items;
items.splice($w("#gallery").items[0], 1);
$w("#gallery").items = items;
}
}
let selectedFile = $w("#inputGalleryv").value; //InputButton is for Videos
let selectedFileSize = selectedFile[0].size;
if (selectedFileSize < uploadedImageSizeLimit) {
$w("#inputGalleryv").startUpload($w("#inputGalleryv").buttonLabel = "Uploading")
.then((uploadedFile) => {
let uploadfileurl = uploadedFile.url;
let items = $w("#gallery").items;
items.push({
"src": uploadfileurl//,
//"description": "",
//"title": ""
});
$w("#gallery").items = items;
$w("#inputGalleryv").reset();
$w("#inputGalleryv").buttonLabel = "Upload";
$w('#txtGalleryDonev').show();
})
.catch((uploadError) => {
console.log(`Error: ${uploadError.errorCode}`);
$w("#inputGalleryv").reset();
$w("#inputGalleryv").buttonLabel = "Upload Error";
});
} else {
$w("#inputGalleryv").reset();
$w("#inputGalleryv").buttonLabel = "File Size Bigger Than 50MB"
}
}
Any help would be much appreciated…
Thanks!