javascript - Safari 9 paints only the first frame of a video on canvas (bug) -


i'm trying paint the current frame of <video> on canvas safari 9.0.3 on 10.11 paints first frame… sometimes! appears work after video cached because hard refresh causes not work again.

.drawimage(video, 0, 0, width, height) how i'm painting it.


this simple snippet works correctly in browsers, including safari 9 yosemite, not in safari 9 el capitan

var video = document.queryselector('video');  var canvas = document.queryselector('canvas');  canvas.addeventlistener('click', function () {    canvas    .getcontext('2d')    .drawimage(video, 0, 0, canvas.width, canvas.height);  });
<p>play video , click on canvas paint</p>  <canvas width='240' height='135' style="border: solid;"></canvas>  <video width='240' height='135' controls loop src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video>

is there workaround? other way paint videos on canvas?

using blob cache seems work on safari

sample (in coffeescript):

preparelocalcache: ->     @vidtemp = document.createelement('video')     @vidtemp.preload = 'auto'     @xhr = new window.xmlhttprequest     @xhr.open 'get', 'video link here.mp4', true     @xhr.responsetype = 'blob'     @xhr.onload = (e) =>       if e.currenttarget.status == 200         myblob = e.currenttarget.response         @vidcache = window.url.createobjecturl(myblob)         @vidtemp.src = @vidcache     @xhr.send()  ... ...  context = canvas.getcontext '2d' context.drawimage @vidtemp, 0, 0, canvas.width, canvas.height 

@vidtemp dynamically created video tag.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -