2016-12-23 16:26:22 +08:00
|
|
|
import Storage from '/imports/ui/services/storage/session';
|
|
|
|
import Captions from '/imports/api/captions';
|
|
|
|
|
|
|
|
getClosedCaptionSettings = () => {
|
|
|
|
let ccSettings = {};
|
|
|
|
let ccEnabled = Storage.getItem('closedCaptions');
|
2016-12-24 02:49:17 +08:00
|
|
|
ccSettings.ccEnabled = !!ccEnabled;
|
2016-12-23 16:26:22 +08:00
|
|
|
|
|
|
|
//list of unique locales in the Captions Collection
|
|
|
|
let locales = _.uniq(Captions.find({}, {
|
|
|
|
sort: { locale: 1 },
|
|
|
|
fields: { locale: true },
|
|
|
|
}).fetch().map(function (obj) {
|
|
|
|
return obj.locale;
|
|
|
|
}), true);
|
|
|
|
|
|
|
|
//adding the list of active locales to the closed-captions settings object
|
2016-12-24 02:49:17 +08:00
|
|
|
ccSettings.locales = locales;
|
2016-12-23 16:26:22 +08:00
|
|
|
|
|
|
|
return ccSettings;
|
2017-04-20 04:52:50 +08:00
|
|
|
};
|
2016-12-23 16:26:22 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
getClosedCaptionSettings,
|
|
|
|
};
|