0

I have videos on my website that are taking very long to load.

I don't think it is my webhost since it also happens on localhost. Each time there is only 1 video shown to the user, depending which category they chose. (So it is not loading each video always).

The videos that take longer to load are the bigger ones (the biggest one is about 351MB video file)

This is my html code for the video:

<div class='video'><h2>$vidTitle</h2><video width='640' height='360' controls preload='metadata'><source src='$viddir' type='video/mp4'></video></div>

I've also read that it could be that the video indexing could be at the end, could this be the case?

What can I do about this, do I need to use another player thann the default html5 player | do I need to use a cdn?

How can I solve this?

Thanks!

gmuylen
  • 33
  • 8
  • What is the video encoding? This can have a big impact on page loading. – vinceAmstoutz Jul 04 '22 at 12:25
  • Most videos if not all are in the mp4 encoding. – gmuylen Jul 04 '22 at 12:28
  • Just see http://camendesign.com/code/video_for_everybody#video-encode and https://stackoverflow.com/questions/2299347/how-do-i-embed-a-mp4-movie-into-my-html – vinceAmstoutz Jul 04 '22 at 12:44
  • @vinceAmstoutz Isn't this player a bit dated? I read that they fallback to "Flash player" which is deprecated. Also would another player solve the loading problems? - "If HTML5 video is not supported, Adobe Flash is used." Also what are the benefits of embedding a video instead of just html5 video? – gmuylen Jul 04 '22 at 12:48
  • This is just an example to make you understand the principle of encoding. You can find a modern and adapted solution with a little research. Take courage! – vinceAmstoutz Jul 04 '22 at 12:51
  • I see, but my main question is, will this fastenn up the loading? The player is not my concern, the loading time is – gmuylen Jul 04 '22 at 12:53
  • For sure, I found a [complete tutorial](https://www.dacast.com/blog/optimizing-html5-video-streaming/) in 5s, make an effort please! You can use for example VIDEOJs or host your video on a platform like Youtube or a CDN – vinceAmstoutz Jul 04 '22 at 12:55
  • @vinceAmstoutz I have just tried video.js and it has not improved my loading times. Do you know anything else I can try? – gmuylen Jul 04 '22 at 13:23
  • Nice! You just have to host your video on a CDN like Cloudflare Stream for example and using [this](https://github.com/videojs/http-streaming) and it will really improve your loading time! Moreover, if you want to increase your performance here are some tips : set maximum physical size to provide control over uploads and lower lag time. Using a 1280×720 frame size, for example, is usually plenty for most videos. Finally if possible compress your video and use a better codec with [Handbrake](https://handbrake.fr/) for example. The last both are very fundamentals. That's all I know! Courage! – vinceAmstoutz Jul 04 '22 at 13:36
  • Wouldn't a CDN be useless if it isn't even loading fast on localhost? I will defenitely take those last tips into account. – gmuylen Jul 04 '22 at 13:46
  • Yes indeed it requires that the site itself be efficient and optimized. Ok :) – vinceAmstoutz Jul 04 '22 at 14:00
  • The site is efficient, very, it only shows 1 video at a time. But still I think it is the indexing of the video that is at the ennd so it has to download the whole video. – gmuylen Jul 04 '22 at 14:08
  • Again this is just an example there are plenty of soft that do this ;) – vinceAmstoutz Jul 04 '22 at 14:58
  • @gmuylen did you ever find a suitable answer for this? I am experiencing the same thing. It's aggravating since the server and client are on the same machine. It should be instantaneous. – horace Dec 13 '22 at 03:46

0 Answers0