Skip to content

Commit

Permalink
feat(FEC-7336): set default analyticsd plugins settings (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrenMe authored and Dan Ziv committed Oct 25, 2017
1 parent 058b5de commit ebdec97
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/utils/setup-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import StorageManager from '../storage/storage-manager'

const CONTAINER_CLASS_NAME: string = 'kaltura-player-container';

const DEFAULT_ANALYTICS_BE_URL: string = "//stats.kaltura.com/api_v3";
/**
* Validate the initial user input for the providers.
* @param {Object} config - The fully user provider configuration.
Expand Down Expand Up @@ -102,6 +103,7 @@ function addKalturaPoster(metadata: Object, width: number, height: number): void
function setDefaultPlayerConfig(playerConfig: Object): void {
checkNativeHlsSupport(playerConfig);
checkNativeTextTracksSupport(playerConfig);
setDefaultAnalyticsPlugin(playerConfig);
}

/**
Expand Down Expand Up @@ -142,6 +144,24 @@ function checkNativeTextTracksSupport(playerConfig: Object): void {
}
}

/**
* Sets the player default analyics service
* @param {Object} playerConfig - the player config
* @returns {void}
*/
function setDefaultAnalyticsPlugin(playerConfig: any): void {
let kanalyticsBeUrl = Utils.Object.getPropertyPath(playerConfig, 'plugins.kanalytics.beUrl');
if (typeof kanalyticsBeUrl !== 'string') {
Utils.Object.mergeDeep(playerConfig, {
plugins: {
kanalytics: {
beUrl: DEFAULT_ANALYTICS_BE_URL
}
}
});
}
}

/**
* Sets the storage config on the player config if certain conditions are met.
* @param {Object} playerConfig - The player configuration.
Expand Down

0 comments on commit ebdec97

Please sign in to comment.