phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.35k stars 1.43k forks source link

Flickering when playing multiple subsequent videos #336

Open incube8r opened 4 years ago

incube8r commented 4 years ago

I'm trying to play multiple subsequent videos (1 second video each and about ~1MB each give or take), with this code:

let canvas = document.getElementById('videoCanvas');
let loop = setInterval(function(){
     ++$("#count")[0].innerText >= 1000 && clearInterval(loop);
     let count = parseInt($('#count').text(), 10) || 0;
     let num = `00${count}`.slice(-3);
     let fileName = `videos/output${num}.ts`;
     console.log(fileName);
     let player = new JSMpeg.Player(fileName, {canvas:canvas, autoplay:true, loop: false, progressive:true});
}, 1000)

The problem is that it flickers, on each video play. Is there a way to for jsmpeg to play smoothly from multiple subsequent videos?