From c2545ddb6dc32ecc7ad718caaddb0b8b49277fc8 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Thu, 26 Jan 2017 17:13:27 -0500 Subject: [PATCH] feat: make `registerTech` add that tech to the default `techOrder` (#3985) --- src/js/player.js | 2 +- src/js/tech/tech.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/js/player.js b/src/js/player.js index 4bde35f1e8..c61de4a0af 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -3221,7 +3221,7 @@ const navigator = window.navigator; */ Player.prototype.options_ = { // Default order of fallback technology - techOrder: ['html5'], + techOrder: Tech.defaultTechs_, html5: {}, flash: {}, diff --git a/src/js/tech/tech.js b/src/js/tech/tech.js index 1384b0a2ad..849502ce04 100644 --- a/src/js/tech/tech.js +++ b/src/js/tech/tech.js @@ -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; } @@ -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;