No problem my friend,
This 2nd post from Tom has captured my attention and trying to find a case to use it!
I can’t make it to work in our case. My apologies for that…
Another way is Javascript:
- This is the repeat containing a dmx-video:
<div class="row align-items-center">
<div class="col align-self-center">
<div class="row" is="dmx-repeat" id="repeatVideos" dmx-bind:repeat="srvc_getVideos.data.qr_getVideos">
<div class="col-6 text-center">
<video class="myvideo" is="dmx-video" id="video" dmx-bind:id="'video' + $index" dmx-bind:src="'assets/images/'+vid_link" controls="true" dmx-bind:width="400" dmx-on:play="run({runJS:{function:'pauseAllVideos',outputType:'text'}})"></video>
</div>
</div>
</div>
</div>
make sure to give the video a class="myvideo"
(or whatever class name you want but make sure to change it also in the next step
- add this code inside the head just before the
</head>
/* before the end head tag: /*
<script type="text/javascript">
function pauseAllVideos() {
document.querySelectorAll(".myvideo").forEach((el) => {
el.onplay = function(e){
// pause all the videos except the current.
document.querySelectorAll(".myvideo").forEach((el1) => {
if(el === el1)
el1.play();
else
el1.pause();
});
}
});
}
</script>
</head>