N
N
nanny_ogg2017-08-23 10:20:05
YouTube
nanny_ogg, 2017-08-23 10:20:05

How to optimize video loading on a website from youtube.com?

I am using an iframe to display a youtube video.

<iframe width="100%" height="200" src="https://www.youtube.com/embed/<? echo $video_path ?>"></iframe>


The paths to the videos are retrieved from the database and displayed on the page in a loop. The problem is just brutally slow page loading, even with 2 elements. I look at the server requests in the console, there are about 30 different requests to youtube.com. I suspect that the page may take so long to load because of these requests. Is there any way to optimize video loading? Or maybe something else could be the problem here?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2017-08-23
@politon

There can be many problems.
1. The speed of your Internet.
2. Hoster's server
3. Browser cache
....
And of course, it would not hurt to see a link to the resource, so as not to vang.

A
Aspect-zero, 2021-08-06
@Aspect-zero

https://jsfiddle.net/ped3hL9f/1/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question