I would like to upload video and image to pro gallery and then store gallery to database. However, I found some problems when uploading video. The video cannot be shown in gallery (photo 1 and 2) and the database (photo 3) cannot show the video item (no.2). Please advise how to solve this problem, the code for uploading video to gallery and storing gallery to database is shown below for your reference.
let workvideo = [];
export async function uploadButton11_change(event) {
//Add your code for this event here:
let greenFlag = false;
let file = $w('#uploadButton11').value;
if (file.length > 0) {
let response = await $w('#uploadButton11').startUpload($w('#uploadButton11').buttonLabel = 'Uploading ...');
greenFlag = response;
if (greenFlag) {
workvideo.push(response.url);
greenFlag = false;
console.log(workvideo, file[0].name);
$w('#uploadButton11').buttonLabel = 'Add another video'
$w('#text18').expand();
$w('#text18').text = `Done, Uploaded ${file[0].name}`;
$w('#gallery1').expand();
let uploadfileurl = response.url;
let items = $w("#gallery1").items;
items.push({
"src": uploadfileurl,
"description": "",
"title": ""
});
console.log(uploadfileurl);
$w("#gallery1").items = items;
}
}
}
export function button1_click(event) {
//Add your code for this event here:
$w("#dataset1").onReady(() => {
$w("#dataset1").setFieldValues({
"gallery": $w('#gallery1').items,
});
});
}