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

Tech change handler spam #1859

Closed

Conversation

benjipott
Copy link
Contributor

Disables spam error handlers when changing tech
Fixes #882 #1485 #1505 #1484

@benjipott benjipott changed the title Tech change handler spam fixes #882 #1485 #1505 #1484 Tech change handler spam Feb 11, 2015
@@ -81,6 +75,15 @@ vjs.MediaTechController.prototype.initControlsListeners = function(){
});
};

vjs.MediaTechController.prototype.removeControlsListeners = function () {
Copy link
Member

Choose a reason for hiding this comment

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

There's already a removeControlsListeners. Should this be combined with that?

Copy link
Member

Choose a reason for hiding this comment

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

I think there's a problem with this. It will remove the removeControlsListeners and activateControls listeners when controlsdisabled is triggered, but what if controlsenabled is triggered again? I think this will break that use case.
e.g.

  • enable controls
  • disable controls
  • enable controls again

@heff
Copy link
Member

heff commented Feb 11, 2015

Thanks for the help! This looks like a good update to me. Any interested in writing a test for this? It doesn't appear we have any tests for this yet, but it would go in the media tech tests file.

@heff
Copy link
Member

heff commented Feb 11, 2015

Have you verified that this fixes the issue, and can you describe how this is fixing the problem?

@@ -239,7 +256,8 @@ vjs.MediaTechController.prototype.stopTrackingCurrentTime = function(){
this.player().trigger('timeupdate');
};

vjs.MediaTechController.prototype.dispose = function() {
vjs.MediaTechController.prototype.dispose = function(){
this.removeControlsListeners();
Copy link
Member

Choose a reason for hiding this comment

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

This actuallyl shouldn't be needed. When you use this.off(player, 'controlsenabled', this.activateControls); it should automatically remove the activateControls listener from the player when this tech is disposed. It's a feature of the off method.

@vasklund
Copy link

Just wanted to chip in and say I've experienced several of the problems this pull is supposed to solve, and I think the root problem lies deeper. I've tried the best I could to explain my findings in short in a new issue at #1896, hopefully you can make sense of my description there.

The problems this pull solves are related to these event handlers (MediaTechController.initControlsListeners)

this.on(player, 'controlsenabled', activateControls);
this.on(player, 'controlsdisabled', this.removeControlsListeners);

but the real problem is that these handlers, among others, should have been automatically deregistred by the Component.on() logic in response to the dispose event.

@mmcc
Copy link
Member

mmcc commented Feb 27, 2015

I'm going to close this in lieu of @vasklund's investigation in #1896. We shouldn't pull in things to fix a symptom that we should solve upstream. Thanks for the PR, though @benjipott!

@mmcc mmcc closed this Feb 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switching between sources with diffrenet technologies causes problem
4 participants