Skip to content

fix: stop the Video.js memory growth on iOS Safari - #135

Merged
Priveetee merged 2 commits into
devfrom
fix/videojs-ios-memory
Nov 20, 2026
Merged

Priveetee merged 2 commits into
devfrom
fix/videojs-ios-memory

Conversation

@Priveetee

Copy link
Copy Markdown
Member

Fixes TypeType-Video/TypeType#425.

I measured WebKit memory on an iOS 26.5 simulator (iPhone 12 mini) while a Twitch VOD played in Video.js: the WebContent process grew by about 70 MB a minute (149 MB to 390 MB in 3.5 minutes), until iOS would reload the tab.

The cause is not the media buffer: the video kept about 50 s buffered, and hls.js alone on a blank page grew far less. Video.js rewrites the time slider on every frame (about 58 style updates a second), and the idle controls stayed in the layout with only opacity 0. Hiding the controls with display: none stops the growth; visibility: hidden does not.

  • Idle controls now leave the layout once they have faded out (transition-behavior: allow-discrete), and fade back in when shown. With this, memory stayed flat at about 150 MB over 4 minutes on the same simulator.
  • The Video.js HLS engine also gets the buffer limits of the other player (20 s back, 36 s ahead, 60 s max) instead of the hls.js defaults, which keep every played segment.

The memory grows again while the controls are shown, so a long time with the controls on screen still costs memory; normal watching keeps them hidden.

@Priveetee
Priveetee merged commit ce451cb into dev Nov 20, 2026
1 check passed
@Priveetee
Priveetee deleted the fix/videojs-ios-memory branch November 20, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: iOS Safari WebKit frequently runs out of memory and force-reloads the page when using Video.js

1 participant