Play a video just by clicking on it



Hi to everyone!

I’m new to Hype and I have this issue… I want to be able to play and pause a video without any buttons or commands. I want the video to be played just by clicking on it, then paused the same way. I guess I’ll need a little bit of Java.

I have to add that there’s gonna be more than one video in the same scene.

Here the file in question. (1.8 MB)


(Hans-Gerd Claßen) #2

set this onclick or touchstart for every hypevideoelement

    var dataPlay = element.getAttribute("data-play");
    if(dataPlay === null || dataPlay === '1'){ 
    element.setAttribute("data-play", '0');;
    element.setAttribute("data-play", '1');

though not tested, but should work …


Thank you so much! That is working like a charm. It feels a little bit like magic :wink:.

Result :