Play video while "mouse over" or hover


#1

Is it possible to play a video only while the mouse hovers over the video area?

Thanks a lot.


(james koh) #2

sometimes it is better to google if it is about only javascript.
here is what i found.


#3

Thanks @jameskoh

You could run a function ‘On Mouse Over’ using Hype’s built in Actions to run .play or .pause actions on the video. This article explains how to control video playback with JavaScript: Creating Play & Pause Buttons for Video


(Bas) #4

I use this in my video
http://www.localsquares.eu/doku.php?id=tools:videoclips

On mouse over this code:

var mediaElement = document.getElementById('participationvideo');
mediaElement.play();

On mouse out:

var mediaElement = document.getElementById('participationvideo');
mediaElement.pause();

And of course you need to create the java function, give it a name and call it under the mous actions…

Hope this helps.
Bas