jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/appsettings.js
2016-02-29 23:23:40 -05:00

41 lines
935 B
JavaScript

define(['appStorage'], function (appStorage) {
function getKey(name, userId) {
if (userId) {
name = userId + '-' + name;
}
return name;
}
function get(name, userId) {
return appStorage.getItem(getKey(name, userId));
}
function set(name, value, userId) {
appStorage.setItem(getKey(name, userId), value);
}
return {
enableAutomaticBitrateDetection: function (val) {
if (val != null) {
set('enableAutomaticBitrateDetection', val.toString());
}
return get('enableAutomaticBitrateDetection') != 'false';
},
maxStreamingBitrate: function (val) {
if (val != null) {
set('preferredVideoBitrate', val);
}
return parseInt(get('preferredVideoBitrate') || '') || 1500000;
},
set: set,
get: get
};
});