let v=document.getElementById("video1");
let c=document.getElementById("myCanvas");
ctx=c.getContext('2d');
v.addEventListener('play',function() {
let i=window.setInterval(function() {
ctx.drawImage(v,0,0,270,135)
},20);
},false);
v.addEventListener('pause',function() {
window.clearInterval(i);
} ,false);
v.addEventListener('ended',function() {
clearInterval(i);
},false);