Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Play dynamic video throught js

Level 3
Level 3

Hi everyone does anyone knows how can I start playing the video automatically after the user clicks on the button ?


In my html script I call the dynamic media component:


<div class="dialog__content" data-sly-resource="${'video' @ resourceType='dam/components/scene7/dynamicmedia'}">


In witch I pass a video, Now what I’ll like to do is that want to play the video when the user click on the button:



<button class="video-player__button" aria-label="play video">
   <!-- Image de fond -->
   <div data-sly-resource="${'.' @ resourceType='core/wcm/components/image/v2/image'}"></div>
   <!-- Image du bouton play -->
   <img src="" class="video-player__button-play" alt="Button play" />
   <img src="" class="video-player__button-play--hover" alt="Button play" />


But when I try to get the video I get an undefined.




Here’s the HTML generated by the dynamic media:


Does anyone knows how can I play the video through js?

Thanks in advance.

0 Replies