W
W
WebforSelf2021-06-28 12:18:56
HTML
WebforSelf, 2021-06-28 12:18:56

How to upload videos to the site correctly?

Friends, such a question. We have video in mp4 , respectively, there is a video tag for connecting video to the site.
But after all, the mp4 video itself is not universal, so you need to upload it in other formats in order to make it cross-browser.
Total we have

<video controls width="400" height="300">
  <source src="video.mp4" type="video/mp4"><!-- MP4 для Safari, IE9, iPhone, iPad, Android, и Windows Phone 7 -->
  <source src="video.webm" type="video/webm"><!-- WebM/VP8 для Firefox4, Opera, и Chrome -->
  <source src="video.ogv" type="video/ogg"><!-- Ogg/Vorbis для старых версий браузеров Firefox и Opera -->
</video>


But what about the user side? After all, he will not load each vidos in 3 copies? How do you get out of the situation?

Personally, my opinion is that it is better to upload videos to a hosting such as YouTube. But maybe I'm wrong and the video has a place to be on the client's website?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
weranda, 2021-06-28
@WebforSelf

I will suggest uploading the video to YouTube. On the site, make a stub under the video. Previews can be loaded via the API. When you click on the stub, download the video from YouTube already - this way you save on downloading video data when loading the page.
On the site, you don’t have to worry about connecting several formats - my opinion. For example, MP4 is supported by almost 99% of browsers: https://caniuse.com/mpeg4

E
Evgeny Golubev, 2021-06-28
@bestowhope

mp4 video is not universal

Name now at least one current browser that is not able to open mp4?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question