Skip to content

Commit

Permalink
feat: make registerTech add that tech to the default techOrder (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey authored and gkatsev committed Jan 26, 2017
1 parent 05b39fe commit c2545dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -3221,7 +3221,7 @@ const navigator = window.navigator;
*/
Player.prototype.options_ = {
// Default order of fallback technology
techOrder: ['html5'],
techOrder: Tech.defaultTechs_,

html5: {},
flash: {},
Expand Down
11 changes: 11 additions & 0 deletions src/js/tech/tech.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,10 @@ class Tech extends Component {
middleware.use('*', {name, tech});

Tech.techs_[name] = tech;
if (name !== 'Tech') {
// camel case the techName for use in techOrder
Tech.defaultTechs_.push(name.charAt(0).toLowerCase() + name.slice(1));
}
return tech;
}

Expand Down Expand Up @@ -1171,4 +1175,11 @@ Tech.withSourceHandlers = function(_Tech) {
Component.registerComponent('Tech', Tech);
Tech.registerTech('Tech', Tech);

/**
* A list of techs that should be added to techOrder on Players
*
* @private
*/
Tech.defaultTechs_ = [];

export default Tech;

0 comments on commit c2545dd

Please sign in to comment.