javascript - Passing information between HTML 5 Video and form textarea -


i have simple html5 video player

<video width="100%" controls="controls">     <source src="" type="" /> </video> 

and simple form textarea on page. few things in order make easier clients provide feedback on videos:

  • if user in textarea, when start typing automatically pause video , insert current time code video textarea , resume video when press enter new line. (if possible, functionality should have on/off button.)

  • i have button above textarea allow them insert videos current timecode text area (at end of current text).

is possible?

many in advance help.

this fiddle should headed in right direction. http://jsfiddle.net/3n1gm4/klwl4/

js:

(function() {     var thetext = document.getelementbyid('text1');     var thevideo = document.getelementbyid('video1');     thetext.addeventlistener('focus', function(e) {         curtime = thevideo.currenttime;         cursecs = math.floor((curtime % 60));          curtimetext = "\n" + math.floor( curtime / 60 ) + ":" + ((cursecs < 10)?'0'+cursecs:cursecs);          thetext.value = thetext.value + curtimetext;     }); })(); 

html:

<video width="100%" controls id="video1">   <source type="video/mp4" src=""> </video> <textarea id="text1" cols="20" rows="10"></textarea> 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -