I am currently working on a Video Gallery website showcasing my YouTube videos, all embedded using the iframe tag. However, I have been facing slow load times when opening the page. I want to incorporate some form of loading animation or method to improve the loading speed. Any suggestions?
Here is a snippet of my code:
`@for (link of youtubeLinks; track $index) {
<div class="video-container mx-1 mb-2">
<iframe #youtubeVideos
width="315"
height="560"
[src]="getVideoSrc(link)"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen>
</iframe>
</div>
}`
I have tried using a @defer directive to no avail.
My goal is to load each iframe either as the page is scrolled or one at a time, rather than loading all of them at once upon entering the page.