Skip to content

Commit

Permalink
fix(FEC-10994): Invalid version reported by players (#452)
Browse files Browse the repository at this point in the history
Issue: some clients load the JS script with one uiconf but use another one in the call to setup or they don't provide it at all.
Solution: always take the uiconf config from the bundle object.
  • Loading branch information
Yuvalke authored Jul 1, 2021
1 parent 89629be commit 25fcd7d
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions src/common/utils/setup-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,29 +262,12 @@ function getUrlParameter(name: string): ?string {
}

/**
* Checks if the server UIConf exist
* get the server UIConf
* @private
* @param {number} uiConfId - The server UIConf
* @returns {boolean} - server UIConf exist
*/
function serverUIConfExist(uiConfId: ?number): boolean {
const UIConf = Utils.Object.getPropertyPath(window, '__kalturaplayerdata.UIConf');
const hasUiConfId = uiConfId !== null && uiConfId !== undefined;
return hasUiConfId && ((UIConf !== undefined && UIConf[uiConfId] !== undefined) || false);
}

/**
* Extracts the server UIConf
* @private
* @param {number} uiConfId - The server UIConf
* @returns {Object} - The server UIConf
*/
function extractServerUIConf(uiConfId: number): Object {
let config = {};
if (serverUIConfExist(uiConfId)) {
config = window.__kalturaplayerdata.UIConf[uiConfId];
}
return config;
function getServerUIConf(): Object {
return window.__kalturaplayerdata || {};
}
/**
Expand Down Expand Up @@ -313,10 +296,7 @@ function getDefaultOptions(options: PartialKPOptionsObject): KPOptionsObject {
}
};
Utils.Object.mergeDeep(defaultOptions, options);
if (defaultOptions.provider.uiConfId) {
const uiConfOptions = supportLegacyOptions(extractServerUIConf(defaultOptions.provider.uiConfId));
defaultOptions = Utils.Object.mergeDeep({}, uiConfOptions, defaultOptions);
}
defaultOptions = Utils.Object.mergeDeep({}, supportLegacyOptions(getServerUIConf()), defaultOptions);
checkNativeHlsSupport(defaultOptions);
checkNativeTextTracksSupport(defaultOptions);
setDefaultAnalyticsPlugin(defaultOptions);
Expand Down

0 comments on commit 25fcd7d

Please sign in to comment.