javascript - Capture video frame on chrome -
i have problem chrome, so, have script can take image video on server x seconds. works on firefox, not chrome. script , this one doesn't work, video timer doesn't change (0 seconds) so, have x images, same. note : script works great local source.
thank !
var = 0; var video = document.createelement("video"); var thumbs = document.getelementbyid("thumbs"); video.addeventlistener('loadeddata', function() { thumbs.innerhtml = ""; video.currenttime = i; }, false); video.addeventlistener('seeked', function(){ generatethumbnail(i); i++; if (i <= video.duration) { video.currenttime = i; } else { alert("done!") } }, false); video.preload = "auto"; video.src = "myvideolinkonserver"; function generatethumbnail() { var c = document.createelement("canvas"); var ctx = c.getcontext("2d"); c.width = 160; c.height = 90; ctx.drawimage(video, 0, 0, 160, 90); thumbs.appendchild(c); };
Comments
Post a Comment