Пример
<script>
$(document).ready(function(){
$(window).scroll(lazyload);
lazyload();
});
function lazyload(){
var wt = $(window).scrollTop(); //* top of the window
var wb = wt + $(window).height(); //* bottom of the window
$('#video').each(function(){
var ot = $(this).offset().top; //* top of object (i.e. advertising div)
var ob = ot + $(this).height(); //* bottom of object
if(!$(this).attr('loaded') && wt<=ob && wb >= ot){
$(this).html('<iframe width="560" height="315" src="https://www.youtube.com/embed/41Ts4f1vuP0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="">');
$(this).attr('loaded',true);
}
});
}
</script>