Skip to content
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

Merged
merged 2 commits into from
Jul 28, 2014

Conversation

dmlap
Copy link
Member

@dmlap dmlap commented Jul 9, 2014

...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.

…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);
Copy link
Member

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.

Copy link
Member Author

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.
@mmcc mmcc added bug labels Jul 11, 2014
@heff
Copy link
Member

heff commented Jul 26, 2014

Awesome. Did it work in IE8?

@dmlap
Copy link
Member Author

dmlap commented Jul 26, 2014

Yep-- noted it at the bottom of my extended commit comment.

@heff heff merged commit a77e39f into videojs:master Jul 28, 2014
heff added a commit that referenced this pull request Jul 28, 2014
@heff
Copy link
Member

heff commented Jul 28, 2014

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() {
Copy link
Member

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 :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants