javascript - Click a certain area of a video and change video time -


i have html5 video , i'd make interactive. if user clicks on area of video (let's top left area), makes video time changes -> currenttime=60 (just example)

if clicks on bottom right area, currenttime=138. how can that?

i know need create overlay div , make clickable need that.

thanks reading!

i'll give example of changing 3seconds, can understand how make 60 or 138. in jsfiddle: http://jsfiddle.net/3jyfu/

if doesn't work:

html:

<video id="video1" controls="controls">   <source src="http://www.808.dk/pics/video/gizmo.mp4" type="video/mp4">   <source src="http://www.808.dk/pics/video/gizmo.ogg" type="video/ogg">   browser not support html5 video. </video> <div id="time_3" onclick="setcurtime()"></div>        <script>           myvid=document.getelementbyid("video1"); function setcurtime()   {    myvid.currenttime=3;   }       </script>        <p> press top-left part of video make jump 3 seconds.</p> 

css:

#video1{     width:500px;     position:absolute; } #time_3{     position:relative;     width:250px;     height:125px;     cursor:pointer; }  p {     margin-top:170px; } 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -