F
F
FighterFX2020-09-23 19:21:53
JavaScript
FighterFX, 2020-09-23 19:21:53

Too many mp4 videos to play in Safari, is that possible?

Hello, I asked a question on the stack, but for 40 views 0 answers. I'll try here.

I have many mp4 video elements on my page that are playing at the same time. On average, each video weighs 70-110kb. If you load more than 100 of them in Safari, displaying, say, 20, then a memory leak immediately appears and the tab itself will not be cleared until the page is reloaded, or if you do not upload the video manually, which is no longer in the viewport. In chrome, even without these manipulations, everything is fine, as soon as the page is scrolled lower, the memory is cleared by itself.

I decided to unload the video on the page if it's not already in the viewport and re-render it if it's there again. But here is the problem. Safari takes too long to clean up video and memory. About 2-3 seconds per video, while in chrome it happens instantly. Here is an example to compare both browsers - jsfiddle.net/GhS2Z/3

Is there a solution to this problem for Safari, or can we forget about the large number of simultaneously playing videos on the page? Looked at twitter, coub, Discord, etc. sites, everywhere horror! In the first two cases, there is a stupidly big leak, and the discord page generally freezes when you try to open the video panel in the chat.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question