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

feat(middleware): make setSource be optional #5295

Merged
merged 6 commits into from
Jul 6, 2018
Merged

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Jul 3, 2018

Adding tests first and implementation will be available after tests fail.

setSource is useful if you care to be fiddling with the source or doing some work depending on what source is set. However, sometimes, you don't need a setSource and want the middleware to always be selected.
Now, if setSource is missing, it will implicitly be included in the middleware chain.

@gkatsev gkatsev added the needs: LGTM Needs one or more additional approvals label Jul 4, 2018
@mister-ben
Copy link
Contributor

Looks good, but docs/guides/middleware.md will need to be updated.

@gkatsev
Copy link
Member Author

gkatsev commented Jul 4, 2018

Good call, I'll update docs tomorrow.

@gkatsev
Copy link
Member Author

gkatsev commented Jul 5, 2018

docs updated

@misteroneill misteroneill removed the needs: LGTM Needs one or more additional approvals label Jul 6, 2018
@@ -37,6 +38,8 @@ videojs.use('*', function(player) {
});
```

Alternative, in versions greater than 7.0.5, you may omit `setSource` entirely and the middleware will get selected implicitly.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just put this above the explanation of how to pass along the source, since it'll be default behavior from now on

@gkatsev gkatsev merged commit 781a6d8 into master Jul 6, 2018
@gkatsev gkatsev deleted the optional-mw-setsource branch July 6, 2018 18:16
gkatsev added a commit that referenced this pull request Jul 9, 2018
setSource is useful if you care to be fiddling with the source or doing some work depending on what source is set. However, sometimes, you don't need a setSource and want the middleware to always be selected.
Now, if setSource is missing, it will implicitly be included in the middleware chain.
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.

4 participants