I still cant get the URL to work says forbidden the SRC is there??
Could take a look see where im going wrong here?
Thanks
// Video Upload Button Function
export function videoUploadbutton_change(event) {
$w("#videoErrortext").hide();
$w("#submitCheckinbutton").disable()
$w("#videoUploadbutton").fileType = "Video"; // File type selector
console.log("Video upload text length =" + " " + $w("#videoUploadbutton").value.length + " " + "(Video selected)");
$w("#videoUploadbutton").buttonLabel = "Uploading Please Wait...." //+ $w("#videoUploadbutton").value[0].name; "If you want to add something more to it"
$w("#videoUploadbutton").startUpload() // "Tells Wix to start the upload and hold it as object before submission"
.then( (uploadedFile) => {
$w("#videoUploadbutton").style.backgroundColor = "#FA9869"
$w("#videoClient").show()
.then( ( ) => {
console.log("Video client shown");
});
$w("#videoExample").hide("fade",fadeOption)
.then( ( ) => {
console.log("Video example photo faded");
});
//$w("#videoClient").fitMode = "fit"
$w("#videoUploadbutton").buttonLabel = "Upload successful"; // "Button label once upload in complete"
$w("#submitCheckinbutton").enable();
$w("#videoClient").src = uploadedFile.url; // "Gets a Wix URL from .src file, doesnt appear to be a normal public URL"
//$w("#myCheckinsdataset").setFieldValue("rightSideImageUrl", uploadedFile.url) // This way creates a image in collection but as a WIX URL but you see an image
let src = $w("#videoClient").src;
let splitter = src.split("/");
let videoPublicurlLink = `https://video.wixstatic.com/video/${splitter[3]}/${splitter[4].split("#")[0]}`;
$w("#myCheckinsdataset").setFieldValue("videoUrl", videoPublicurlLink); // This will upload the converted public URL to a URL field in collection.
$w('#videoURL').text = videoPublicurlLink;console.log(uploadedFile.url);
console.log(videoPublicurlLink); // Just a checker so we can see whats happening in the log.
})
.catch( (uploadError) => {
$w("#videoUploadbutton").buttonLabel = "File upload error";
$w("#videoErrortext").show();
$w('#videoErrortext').text = uploadError.errorDescription
console.log("File upload error: " + uploadError.errorCode);
console.log(uploadError.errorDescription);
});
}