-6

I want to make a video start when clicking on an image. Is there any way I can do this using javascript/jQuery?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • 3
    What kind of video? HTML5, flash, objectX....? We need to see your code. – Rory McCrossan Feb 26 '16 at 11:06
  • Possible double post: http://stackoverflow.com/questions/16626673/playing-a-video-when-clicking-on-an-element-of-an-image http://stackoverflow.com/questions/7406063/how-to-play-start-youtube-video-after-clicking-on-an-image http://stackoverflow.com/questions/10327907/play-pause-html5-video-javascript – XsiSecOfficial Feb 26 '16 at 11:11
  • 1
    Please show us what you have so far. SO is not a code writing service, and you will get a better response if you provide evidence of your own work. Please read the [ask] section in the help, and this [excellent article](http://whathaveyoutried.com). – freefaller Feb 26 '16 at 11:12
  • just a html5 video ?! – Khàlil H't Feb 26 '16 at 11:12

1 Answers1

0

You should do this with HTML.

<video controls poster="/images/the-image-to-show.png">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

This will do the job just fine. Remember, "controls" gives you the default video controls. Play/pause/sound etc

OZI
  • 424
  • 3
  • 8