2019-11-06 13:43:39 +03:00
|
|
|
define(["jQuery", "libraryMenu", "loading"], function ($, libraryMenu, loading) {
|
2018-10-23 01:05:09 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
function loadPage(page, config) {
|
2019-11-06 13:43:39 +03:00
|
|
|
$("#txtRemoteClientBitrateLimit", page).val(config.RemoteClientBitrateLimit / 1e6 || "");
|
|
|
|
loading.hide();
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function onSubmit() {
|
|
|
|
loading.show();
|
|
|
|
var form = this;
|
2019-11-06 13:43:39 +03:00
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
|
|
|
config.RemoteClientBitrateLimit = parseInt(1e6 * parseFloat($("#txtRemoteClientBitrateLimit", form).val() || "0"));
|
|
|
|
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
|
|
|
});
|
|
|
|
return false;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getTabs() {
|
|
|
|
return [{
|
2019-08-16 00:25:31 -07:00
|
|
|
href: "encodingsettings.html",
|
|
|
|
name: Globalize.translate("Transcoding")
|
|
|
|
}, {
|
2018-10-23 01:05:09 +03:00
|
|
|
href: "playbackconfiguration.html",
|
|
|
|
name: Globalize.translate("TabResumeSettings")
|
|
|
|
}, {
|
|
|
|
href: "streamingsettings.html",
|
|
|
|
name: Globalize.translate("TabStreaming")
|
2019-11-06 13:43:39 +03:00
|
|
|
}];
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-08-16 00:25:31 -07:00
|
|
|
|
2019-11-06 13:43:39 +03:00
|
|
|
$(document).on("pageinit", "#streamingSettingsPage", function () {
|
2018-10-23 01:05:09 +03:00
|
|
|
var page = this;
|
2019-11-06 13:43:39 +03:00
|
|
|
$("#btnSelectTranscodingTempPath", page).on("click.selectDirectory", function () {
|
|
|
|
require(["directorybrowser"], function (directoryBrowser) {
|
|
|
|
var picker = new directoryBrowser();
|
2018-10-23 01:05:09 +03:00
|
|
|
picker.show({
|
2019-11-06 13:43:39 +03:00
|
|
|
callback: function (path) {
|
|
|
|
if (path) {
|
|
|
|
$("#txtTranscodingTempPath", page).val(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
picker.close();
|
2018-10-23 01:05:09 +03:00
|
|
|
},
|
2019-11-06 13:43:39 +03:00
|
|
|
validateWriteable: true,
|
2018-10-23 01:05:09 +03:00
|
|
|
header: Globalize.translate("HeaderSelectTranscodingPath"),
|
|
|
|
instruction: Globalize.translate("HeaderSelectTranscodingPathHelp")
|
2019-11-06 13:43:39 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$(".streamingSettingsForm").off("submit", onSubmit).on("submit", onSubmit);
|
|
|
|
}).on("pageshow", "#streamingSettingsPage", function () {
|
2019-08-16 00:25:31 -07:00
|
|
|
loading.show();
|
|
|
|
libraryMenu.setTabs("playback", 2, getTabs);
|
2018-10-23 01:05:09 +03:00
|
|
|
var page = this;
|
2019-11-06 13:43:39 +03:00
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
|
|
|
loadPage(page, config);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|