html:getContext effet de flou, ne peux pas trouver this.prev ('canvas')?
<div class="span">
<canvas></canvas>
<video autoplay loop muted onloadeddata="loaded(this)">
<source src="xxx.mp4" type="video/mp4">
</video>
</div>
<div class="span">
<canvas></canvas>
<video autoplay loop muted onloadeddata="loaded(this)">
<source src="yyy.mp4" type="video/mp4">
</video>
</div>
js:
function draw(v, c, w, h) {
if (v.paused || v.ended) return false;
c.drawImage(v, 0, 0, w, h);
setTimeout(draw, 1, v, c, w, h);
};
function loaded(vid) {
$(vid).on('play', function() {
var $this = $(vid).prev('canvas'),//this one dont work?
$this = $('canvas').get(0),//i dont want this get(x), i need "this"
cw = Math.floor($this.clientWidth/1),
ch = Math.floor($this.clientHeight/1);
$this.width = cw;
$this.height = ch;
draw(this, $this.getContext("2d"), cw, ch);
});
};
pourquoi je ne peux pas trouver "ce" ???
$ this = $ (vid) .prev ('canvas'), // celui-ci ne fonctionne pas?
$ this = $ ('toile') get (0), // Je ne veux pas ce get (x), j'ai besoin "ce"
homme merci, aide-moi à résoudre ce problème. https://codepen.io/anon/pen/YrJqwQ
homme bon travail, merci – tester4