-
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
Track the object element during init and remove it if the tech is dispos... #1340
Conversation
…posed before onReady. For videojs#1339. If dispose() was called before the SWF triggered onReady(), the placeholder div would be cleaned up but the actual object element would be left behind to mess things up in the future. Keep track of the object element during initialization and make sure it is removed if flash is unloaded early.
@@ -244,12 +244,19 @@ vjs.Flash = vjs.MediaTechController.extend({ | |||
|
|||
// If not using iFrame mode, embed as normal object | |||
} else { | |||
vjs.Flash.embed(options['swf'], placeHolder, flashVars, params, attributes); | |||
this.obj = vjs.Flash.embed(options['swf'], placeHolder, flashVars, params, attributes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we just set this.el_ = obj here? Then component would remove that instead of the placeholder.
I think the main reason for not doing that before was that we were using swfobj which uses an object or embed depending on the platform, but now we built a custom object that works across platforms. I'm trying to remember if there were any other reasons. Either way if it works on IE8 we should be good, and that should simplify this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like an improvement to me. I'll update the PR.
The flash tech doesn't need to hold onto a reference to the placeholder element after the embed code has been generated. Set this.el_ to the embed code immediately instead of using another property to track it during init. Tested in IE8.
Awesome. Did it work in IE8? |
Yep-- noted it at the bottom of my extended commit comment. |
Thanks for contributing! :) |
@@ -96,3 +96,19 @@ test('currentTime is the seek target during seeking', function() { | |||
seeking = true; | |||
strictEqual(7, tech.currentTime(), 'during seeks the target time is returned'); | |||
}); | |||
|
|||
test('dispose removes the object element even before ready fires', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi, this test just saved me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
...ed before onReady. For #1339.
If dispose() was called before the SWF triggered onReady(), the placeholder div would be cleaned up but the actual object element would be left behind to mess things up in the future. Keep track of the object element during initialization and make sure it is removed if flash is unloaded early.