Change YouTube video ID in video module when clicking on another item

Hi there,

I’m looking for the best way to dynamically change the video ID in the video module, when clicking on another element.

I have to build a video player like this one:

I will have a video module on the left, and a query loop with other videos on the right. When clicking on one of the loop items, I have to load that video ID into the video module on the left.

All videos are represented in the DB as posts. The left video can be a result of a query loop with a single item, if needed.

What would be the best way to approach this?

As for now, I solved this with an interaction set on the little videos. I call a custom JS function, that updates the iframe’s src parameter of the main video by repacing the ID part, with some regex. I would appreciate any better solutions :wink: