HELP: The embed video code for the database

I am building a base in which I want to put embed code for movies from external vshare.io servers. I want the content of the database and films to be presented on item dynamic page. But I can not connect the HTML element (frame) with the contents of the database in which the embed code is. How to do it?

example embed code:

Hey
Create a field for videoUrl as text and put the //vshare.io/v/9g94t0q/width-470/height-305/ inside that field and then add the iframe component to your dynamic page and using code like

let currentItem = $w("#dataset1").getCurrentItem();
$w("#iframeComponent").src = currentItem.videoUrl;

Or, you could take the whole html code and store it inside a text field and then insert that chunk into a html component.

Or, you could make a standard html code snippet which will listen for the dynamic page video fields and send those from Wix Code using the postMessage of the HTML Component and then inside the html code snippet you use the onMessage and get the event.data which could consist of the video url and then load the contents of it.

1 Like

I think I’m doing something wrong. I do not know about coding

@officetwebdesign Hey, you get an error because you are referring to #iframeComponent in your code and the name of that component is not that I guess. Click the grey iframe and then look in the properties panel what the id is for that component.

1 Like

@andreas-kviby You’re right. I changed it but still does not display the movie on the dynamic page

@officetwebdesign Ok so if you do console.log(currentItem); and then look in the developer console do you see the item there?
Info from API about html component and the src property

You might have to add before let currentItem the below

$w(“#dynamicDataset”).onReady( () => {
// All your code here
});

1 Like

@Andreas Kviby Thank you for professional and quick help. Thanks to you, I can generate amazing movie bases.

how to do that I have not yet

help me

This is an old post and will be closed. If you have further questions please open up a new thread with your own problem/issue.

Bumping up old posts is against the Community Guidelines .