I started off with creating two separate fields in the database; one for photo uploads and one for video uploads. There are also two separate upload buttons for these fields now.
The repeater where the images and/or videos are shown now contains an image element and a video player for each item; both connected to the corresponding fields in the database. My approach now is to hide or show the video player based on the entries in the database.
This is a code i used to hide and show text fields and it works. But unfortunately, the video player still is shown even if the item in the database has no video uploaded.
$w.onReady(function () {
$w(“#dataset2”).onReady(() => {
var item = $w(“#dataset2”).getCurrentItem();
if (item[“mainVideo”] === “” || item[“mainVideo”] === null || item[“mainVideo”] === undefined) {
$w(“#videoPlayer1”).hide();
} else {
$w(“#videoPlayer1”).show();
}
});
});
I am looking for the reason but cant find anything.