Okay, that's phrased awkwardly, but what I'm looking for is a script that checks, onclick if a video is playing, and if it is, don't start playing it again.
It's for a page that has six thumbs in an array that each play a video, and you're not supposed to be able to restart the video(which means its acting like its not selected)
how would I be able to do this?
Okay, that's phrased awkwardly, but what I'm looking for is a script that checks, onclick if a video is playing, and if it is, don't start playing it again.
It's for a page that has six thumbs in an array that each play a video, and you're not supposed to be able to restart the video(which means its acting like its not selected)
how would I be able to do this?
- Natasha, what have you tried so far? It's much much easier to get help from this munity if you give us a place to start, like showing research you've done in the form of your own code, explaining what you've tried, what didn't work and why, etc, etc. Otherwise, you're asking everyone to lift dead weight, which is really hard even for the strongest programmers. Consider editing your question and including this additional info. Good luck! – jamesmortensen Commented May 21, 2012 at 3:28
- @jmort253 sorry, I should have put what I've done. Really, I've looked for it, but since I'm not sure how to phrase it, I haven't had any luck and haven't tried to much yet. I was hoping I could just get pointed in a general direction, really – Nata2ha Mayan2 Commented May 21, 2012 at 4:56
- This was in Matt's answer: w3/2010/05/video/mediaevents.html Check it out. It shows all the events and properties while the video is playing. "Paused" looks like one you could use to determine if the vid is playing as it's true whenever the video isn't playing. – jamesmortensen Commented May 21, 2012 at 5:00
-
if( $('video').paused == true ) { /* Do what you want when not playing */ } else { /* vid playing */ }
– jamesmortensen Commented May 21, 2012 at 5:03
1 Answer
Reset to default 5To prevent clicking from doing anything to the video you can do this:
$("video").click(function(e) {
e.preventDefault();
return false;
});
To determine if the video is playing or not you can read this previous question: Detect if HTML5 Video element is playing
So you'll want to read that and then do something like:
$("video").click(function(e) {
if (videoStatus === "playing") {
e.preventDefault();
return false;
}
});
Let me know if you're not using jQuery and I'll update my answer to use getElementsByTagName
.