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

Fixes so that the source handler mixin adds the expected API after minification #2348

Closed
wants to merge 1 commit into from

Conversation

imbcmdth
Copy link
Member

Issue:

In video.js, the withSourceHandlers mixin was getting all the names of the functions it used in the SourceHandlers (canHandleSource, handleSource, and dispose) mangled by Closure Compiler.

As a result, it worked only with native source handlers that were compiled together with video.js but not any source handler that was registered later.

In addition, the nativeSourceHandler property was also mangled which meant that any Techs not compiled with video.js would not be able to fall-back to their nativeSourceHandler as a last ditch attempt to play the source if no SourceHandler was found that matched the type.

Finally, the tests were written expecting any SourceHandlers that were registered to use the same mangling as video.js instead of testing that the SourceHandler interface worked as expected.

Changes:

Source

  • No longer explicitly export registerSourceHandler since it is properly mixed-in unmangled
  • Mixin code now calls functions canHandleSource, dispose, and handleSource explicitly instead of by their mangled names
  • A tech's nativeSourceHandler property is no longer mangled in the code and is called explicitly unmangled

Tests

  • withSourceHandlers and registerSourceHandler are used explicitly instead of using the mangled names
  • canHandleSource and handleSource are quoted to avoid mangling

… minification

Source:
- No longer explicitly export 'registerSourceHandler' since it is properly mixed-in unmangled
- Mixin code now calls functions `canHandleSource`, `dispose`, and `handleSource` explicitly instead of by their mangled names
- A tech's `nativeSourceHandler` property is no longer mangled in the code and is called explicitly unmangled
Tests:
- `withSourceHandlers` and `registerSourceHandler` are used explicitly instead of using the mangled names
- `canHandleSource` and `handleSource` are quoted to avoid mangling
@imbcmdth imbcmdth changed the title Fixes to make source handlers mix-in and export the correct api after minification Fixes so that the source handler mixin adds the expected API after minification Jul 13, 2015
@heff
Copy link
Member

heff commented Jul 14, 2015

Wow, fun... Really glad we're moving away from GCC.

Should we just say source handlers is a 5.0 feature? If there continues to be updates to it it's gonna be a pain to change in two places.

Otherwise lgtm.

@imbcmdth
Copy link
Member Author

@heff If you are asking whether or not this PR should be merged in, I think yes. It is simply fixing the SourceHandler API that was being destroyed by minification - there are not functional changes.

If you are asking whether we should consider source handlers an unsupported or beta features on vjs4, then I agree we shouldn't spend time adding or fixing them if any bugs or strange behaviors are discovered. Instead we should direct people wishing to write SHs to 5.

@gkatsev
Copy link
Member

gkatsev commented Jul 16, 2015

I'll be merging this in today unless there are objections. @heff?

@heff
Copy link
Member

heff commented Jul 16, 2015

None from me.

gkatsev pushed a commit to gkatsev/video.js that referenced this pull request Jul 16, 2015
@gkatsev
Copy link
Member

gkatsev commented Jul 16, 2015

Closed by d2de00c

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

Successfully merging this pull request may close these issues.

3 participants