here is a live example - https://abuena.net/_livex/02/
when the first video is finished and the second is started player changes its height, producing a flickering effect.
how to avoid this?
both videos are of the same dimensions and resolution
pls check console
html
<video class='player' id='player' src='01.mp4' controls></video>
css
.player{
display:block;
width:100%;
margin:0 auto;
outline:none;
}
js
var player = document.getElementById('player');
player.onended = function(){
if(this.getAttribute('src') == '01.mp4'){
console.log(this.clientHeight);
this.setAttribute('src', '02.mp4');
this.play();
console.log(this.clientHeight);
}
else{
this.setAttribute('src', '01.mp4');
this.load();
}
};
window.onload = function() {
let x = player.clientHeight;
console.log(x);
player.clientHeight = x;
};