Repository navigation
Fix: Video players are never disposed after a transition out - #151
Merged
Merged
Conversation
When a video widget has an out transition, VideoMedia holds its player and leaves disposing it to the region once the transition has finished. The region looked for the video.js wrapper as the parent of the element it finds by the media's class, but video.js moves that class onto the wrapper itself, so the player was never disposed. Each playlist cycle left its players registered in video.js, with their video elements and sources, and renderer memory grew for as long as the layout looped. Treat the element found as the wrapper when it is one, so the held player is disposed after the transition. Relates to xibosignage/electron-player#265
nadzpogi
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renderer memory grows while a layout with transitions on its video widgets loops, and stays flat without them. Every playlist cycle leaves its video.js players behind.
Cause
When a video widget has an out transition,
VideoMedia.stop()holds the player and leaves disposing it toRegion.removeOldMedia()once the transition has finished (#142).removeOldMedia()finds the old media by its class, and only disposes the player when that element's parent is thevideo-jswrapper. But video.js moves the media's class onto the wrapper itself, so the element found is the wrapper, its parent is the region, andstop(true)never runs. Each player stays invideojs.players, with its tech,<video>element and source.A heap snapshot on
developshowed the retainer pathwindow → Player.players → Player → tech_ → Html5.el_ → <video>. That's 3 players per cycle for a 3-video playlist. Without transitions,stop()disposes the player straight away, which is why the reporter saw flat memory.Change
removeOldMedia()now treats the element it found as the wrapper when it has thevideo-jsclass, and keeps the parent check as a fallback. The held player is then disposed after the out transition, as #142 intended.Testing
Electron player (4.0.13,
develop, Windows) against develop.xibo.co.uk, looping one full-screen layout of 3 muted videos with 1 s fade in/out. The player was restarted before each run, then sampled every 30 s for 14 min, with growth measured after the first 2 min:develop<video>elements after the runVideos still play in turn with their fades, and no new errors appear in the log.
On Windows the leaked players cost a few MB a minute. The report (Linux, software video decoding) measured +38 MB/min, because each leaked player there holds much larger decode buffers. The leaked players, which are the cause, are gone either way. Not yet measured on Linux.
relates to xibosignage/electron-player#265