What I'm doing: - call setup with my options - provide callbacks to some API events (eg. onReady, onPlay, onComplete) - play video - at completion of video, I call remove()
No matter what variation and or tweak I do, I do not see memory in Chrome ever come down from after calling remove(). In using Chromes Profiling tools, I do not have any detached DOM nodes after the removal happens. I do however see some leftover objects pertaining to jwplayer.
I will try and put together a smaller text example but may not be able to provide one soon. In the meantime, I will elaborate a bit more on what I'm trying to achieve and what's been happening.
The issue I've been facing in general with HTML5 video and why I moved to using JW Player is that I have a requirement for displaying video inside a "widget" to which there will be multiple instances of this widget and each one will play its video and then cycle to the next widget, to continuously play video in a rotation, indefinitely. It needs to run for as long as it needs to (days, weeks, months, etc - it's digital signage). This is within Chrome browser. I have encountered an issue of steady memory incline and over an extended period of time, Chrome crashes or the videos stop playing, due to memory overload.
I started using JW Player so that I could leverage certain functionality as well as make use of the remove() method so that all the DOM nodes and listeners would be removed and cleaned up, in hopes of releasing memory and prevent the steady incline.
Unfortunately, this hasn't worked out. Although I do see some memory drop when I analyze after a remove() call, it still doesn't prevent a steady incline in memory over an extended period of time. I think this may be due to jwplayer objects leaking and preventing garbage collection (from doing JS Heap profiling).
One workaround I'm doing now is to do all the importing, setup and management of the jwplayer instance within an iframe and then destroy the iframe when video has completed, thus ensuring that everything is garbage collected.
Can you provide any insight into these memory issues and best recommendations?
Quite candidly, running a video player for weeks or months at a time is certainly an atypical use case for the player. That being said, again, it would help greatly if we had some sort of test to look at. This would help to know what kind of stream or file was being used, as well as the version of the player.
This question has received the maximum number of answers.