-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flash tech breaks event handlers and leaks memory #1896
Comments
Thanks for the in depth writeup on this one. @videojs/contributors thoughts on the proposed solutions? |
It seems like This is a great writeup of a complex issue. Thanks for the analysis from me too, @vasklund! |
Yeah, the placeholder piece is definitely a remnant, possibly even from when SWFObject (external lib) was being used to create the object. I believe that project required you to pass it a placeholder. I can't see any issues with updating the Flash tech to have a createEl function that just builds the object from the start. |
I have a potential fix ready for this issue, but am having problems writing good, specific tests. The problem, as discussed earlier, is that the Flash tech replacing this.el_ in I found the If anyone has any ideas, I'm listening - I should be able to provide a pull request as long as I have some method of testing through the inheritance chain. |
@vasklund : I can help you in writing unit tests for your potential fix related to this problem. Let me know if you want to pair up. |
@saxena-gaurav: Sounds great! I've got a fork up at https://github.com/vasklund/video.js/commits/flash-dispose-fix if you want to take a look. What timezone are you in? |
After debugging a
Cannot read property 'vdata1424889252489' of null
error I found what seems to be a problem with how the Flash tech is initialized. Essentially, because the Flash tech overwrites this.el_ in two places (init
andembed
), not copying over the expando ID to the new element, the data associated with the old element is lost.This seems to have some pretty nasty implications, because event handling functions (vjs.on, vjs.off, vjs.cleanUpEvents, vjs.trigger) rely on data stored in the expando.
A broken example scenario already in the Video.js core:
player.controls(false)
generates an error, because the old MediaTechController.removeControlsListeners is still hooked up, but the original element doesn't exist anymoreSuper simple test case (have to run the output in it's own window):
http://jsbin.com/cigihufico/2/edit?html,js
The best solution I can think of would be to reuse the existing element throughout Flash.init and Flash.embed (don't use
placeHolder
), but I guess there's a reason that's not possible? Copying over the expando ID to the new element also seems to work, although that might not completely remove all references to the element?This is probably the real solution to #1793 (comment), and might also help with #1505 (which I suspect is still not fixed). #1859 is also related.
The text was updated successfully, but these errors were encountered: