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

Reset seekable function when no source handler in tech #2401

Closed
wants to merge 2 commits into from
Closed

Reset seekable function when no source handler in tech #2401

wants to merge 2 commits into from

Conversation

nickygerritsen
Copy link
Contributor

The seekable function was only reset back to its original implementation when a source handler was set.

However, the seekable function is overwritten even if no source handler is set in setSource.

This resulted in a bug in the Flash tech when calling player.src() more than once during the lifetime of the player.

This should fix this issue.

@nickygerritsen
Copy link
Contributor Author

Should we set the original seekable back to undefined or null again? I don't think it really hurts if we don't, but it does clean up the state better.

@heff
Copy link
Member

heff commented Jul 23, 2015

Good catch.

Actually, I don't think we need to be resetting seekable when a source handler is disposed. After a second look at that code, setSource on a source-hander-tech is always used, so we're always just resetting seekable to the same value. We could instead be overriding seekable when the source handler functions are initially added.

In Tech.withSourceHandlers...

let originalSeekable = _Tech.prototype.seekable;

// when a source handler is registered, prefer its implementation of
// seekable when present.
_Tech.prototype.seekable = function() {
  if (this.sourceHandler_ && this.sourceHandler_.seekable) {
    return this.sourceHandler_.seekable();
  }
  return originalSeekable.call(this);
};

@dmlap see any reason why we shouldn't do that?

@dmlap
Copy link
Member

dmlap commented Jul 23, 2015

I did have to fiddle around with the location of that setter a bit but can't think of a reason it wouldn't work in withSourceHandlers.

@nickygerritsen
Copy link
Contributor Author

Should I update this PR to put the code in Tech.withSourceHandlers or will one of you guys change this :)?

@heff
Copy link
Member

heff commented Jul 28, 2015

It'll get merged in faster if you can do it, but otherwise another contributor will get to it at some point.

@nickygerritsen
Copy link
Contributor Author

Ok I'll change it tomorrow. Will probably be a new PR as I accidentally did this one on my own master branch which is not really handy

@nickygerritsen
Copy link
Contributor Author

OK this should be the fix then :)

@heff
Copy link
Member

heff commented Jul 28, 2015

LGTM! @dmlap confirm?

Sent from mobile

@dmlap
Copy link
Member

dmlap commented Jul 30, 2015

Yep. Thanks @nickygerritsen!

@dmlap dmlap closed this in 1d0ae80 Aug 3, 2015
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