Trying to connect embedded videos with database

in my homepage in making a stripe with 6 youtube/vimeo embedded videos, i am trying to connect them with dataset. so i can easily change them every week witout any time wastetage doing it manually.
but i created dataset with videos and url links. everytime i connect the the dataset with embed video only the first one connects and i dont know why? Can any one help me with this.
(its look like this after the connection done.)

1 Like

Hi,

This is the standard behaviour for dataset connection.
If you wish to display a different video for each element you will have to write some code:
Use the example below:

$w.onReady(() => {
	$w("#dataset1").onReady(() => {
		$w("#dataset1").getItems(0, 4) //gets the 4 newest items
			.then((result) => {
				let items = result.items;
				$w('#video1').videoUrl = items[0].url
				$w('#video2').videoUrl = items[1].url
				$w('#video3').videoUrl = items[2].url
				$w('#video4').videoUrl = items[3].url

			})
			.catch((err) => {
				let errMsg = err.message;
				let errCode = err.code;
			});
	});
});

You have to set up the videos in a repeater and then connect the first video of the repeater to the dataset. Also if you want the small videos to go to a video page when clicked on instead of playing small… Just do an image to stand as a thumbnail instead of a small video on your first repeater, and connect that to the database. Watch this video for the tutorial: https://www.youtube.com/watch?v=ZhPnQozLQ_A&list=PL4xdmElBVuNGlohNDbVY_g0jcd7Q3HyaA&index=3&t=0s