javascript - How to get the starting point of a seeking event in HTML5 Video? -


i find in html5 video when users perform seek action clicking controls, there no way time before seeking.

what want whenever users seek video point, system know @ point before users seek. example, if user watching video untill 2:00 , click control @ 4:00, need keep track of time 2:00. have tried seeking , seeked event can't time 2:00. return me time 4:00. there solution?

you should able track timeupdate event, short delay :

var video = document.queryselector('video');  video.bp = 0;    video.addeventlistener('timeupdate', function(e){  var = this;  (function(){  	settimeout(function(){  	  that.bp=that.currenttime;    	}, 500);    }).call(that);}    );    video.addeventlistener('seeking', function(e){    log('boringpart = '+this.bp+          " gone "+this.currenttime)    })  function log(txt){document.queryselector('p').innerhtml = txt;}
<video controls="true" autoplay="true" height="200" width="600"><source type="video/ogg" src="http://media.w3.org/2010/05/sintel/trailer.ogv"><source type="video/mp4" src="http://media.w3.org/2010/05/sintel/trailer.mp4"></video>  <p style="position:absolute; top: 0.5em;left: 3em; color: #fff;background:#000"></p>


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -