I wanted to display same video in two area of the application. So using canvas its working fine but the quality of original video is getting dropped but canvas video quality is fine.
var canvas = document.getElementById('shrinkVideo');
var context = canvas.getContext('2d');
var video = document.getElementById('mainVideo');
video.addEventListener('play', () => {
// canvas.width = 270;
// canvas.height = 480;
this.draw(video, context, canvas.width,canvas.height);
}, false);
draw(v, c, w, h) {
if (v.paused || v.ended) return false;
c.drawImage(v, 0, 0, w, h);
setTimeout(this.draw, 20, v, c, w, h);
}
This is my code to sync two video's and it is working fine but 'mainVideo' quality gets dropped.
But if I remove all the canvas code and just play 'mainVideo' the quality is maintained but using canvas its quality get dropped.
Expected Result This is output of the video when canvas code is not added
Actual Result This is output I am getting after adding the canvas code
Thanks In Advance