2016-03-19 05:26:17 +01:00
|
|
|
|
define(['jQuery'], function ($) {
|
2014-01-07 13:39:35 -05:00
|
|
|
|
|
|
|
|
|
function loadPage(page, config) {
|
|
|
|
|
|
2016-02-08 21:15:26 -05:00
|
|
|
|
page.querySelector('#chkEnableThrottle').checked = config.EnableThrottling;
|
2015-03-30 12:16:34 -04:00
|
|
|
|
|
2015-11-26 23:33:20 -05:00
|
|
|
|
$('#selectVideoDecoder', page).val(config.HardwareAccelerationType);
|
2015-09-03 13:01:51 -04:00
|
|
|
|
$('#selectThreadCount', page).val(config.EncodingThreadCount);
|
2014-04-18 13:16:25 -04:00
|
|
|
|
$('#txtDownMixAudioBoost', page).val(config.DownMixAudioBoost);
|
2016-06-20 02:19:28 -04:00
|
|
|
|
$('.txtEncoderPath', page).val(config.EncoderAppPath || '');
|
2014-07-03 22:22:57 -04:00
|
|
|
|
$('#txtTranscodingTempPath', page).val(config.TranscodingTempPath || '');
|
2014-04-18 13:16:25 -04:00
|
|
|
|
|
2014-01-07 13:39:35 -05:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-07 21:23:56 -04:00
|
|
|
|
function onSubmit() {
|
|
|
|
|
|
|
|
|
|
var form = this;
|
|
|
|
|
|
2016-06-20 02:19:28 -04:00
|
|
|
|
var onDecoderConfirmed = function () {
|
2016-02-04 23:56:07 -05:00
|
|
|
|
Dashboard.showLoadingMsg();
|
2015-06-07 21:23:56 -04:00
|
|
|
|
|
2016-02-04 23:56:07 -05:00
|
|
|
|
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
|
|
|
|
|
|
|
|
|
config.DownMixAudioBoost = $('#txtDownMixAudioBoost', form).val();
|
|
|
|
|
config.TranscodingTempPath = $('#txtTranscodingTempPath', form).val();
|
2016-06-20 02:19:28 -04:00
|
|
|
|
config.EncoderAppPath = $('.txtEncoderPath', form).val();
|
2016-02-04 23:56:07 -05:00
|
|
|
|
config.EncodingThreadCount = $('#selectThreadCount', form).val();
|
|
|
|
|
config.HardwareAccelerationType = $('#selectVideoDecoder', form).val();
|
|
|
|
|
|
2016-02-08 21:15:26 -05:00
|
|
|
|
config.EnableThrottling = form.querySelector('#chkEnableThrottle').checked;
|
|
|
|
|
|
2016-02-04 23:56:07 -05:00
|
|
|
|
ApiClient.updateNamedConfiguration("encoding", config).then(Dashboard.processServerConfigurationUpdateResult);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if ($('#selectVideoDecoder', form).val()) {
|
|
|
|
|
|
2016-02-26 15:29:27 -05:00
|
|
|
|
require(['alert'], function (alert) {
|
|
|
|
|
alert({
|
|
|
|
|
title: Globalize.translate('TitleHardwareAcceleration'),
|
|
|
|
|
text: Globalize.translate('HardwareAccelerationWarning')
|
|
|
|
|
}).then(onDecoderConfirmed);
|
2016-02-04 23:56:07 -05:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
onDecoderConfirmed();
|
|
|
|
|
}
|
2015-06-07 21:23:56 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-13 01:28:45 -04:00
|
|
|
|
function getTabs() {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
href: 'cinemamodeconfiguration.html',
|
|
|
|
|
name: Globalize.translate('TabCinemaMode')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
href: 'playbackconfiguration.html',
|
|
|
|
|
name: Globalize.translate('TabResumeSettings')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
href: 'streamingsettings.html',
|
|
|
|
|
name: Globalize.translate('TabStreaming')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
href: 'encodingsettings.html',
|
|
|
|
|
name: Globalize.translate('TabTranscoding')
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 10:01:59 -04:00
|
|
|
|
$(document).on('pageinit', "#encodingSettingsPage", function () {
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2016-06-20 02:19:28 -04:00
|
|
|
|
$('#btnSelectEncoderPath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
|
|
|
|
|
|
|
|
|
var picker = new directoryBrowser({
|
|
|
|
|
includeFiles: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
picker.show({
|
|
|
|
|
|
|
|
|
|
callback: function (path) {
|
|
|
|
|
|
|
|
|
|
if (path) {
|
|
|
|
|
$('.txtEncoderPath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2014-07-03 22:22:57 -04:00
|
|
|
|
$('#btnSelectTranscodingTempPath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
var picker = new directoryBrowser();
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
picker.show({
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
callback: function (path) {
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
if (path) {
|
|
|
|
|
$('#txtTranscodingTempPath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
|
|
|
|
},
|
2014-07-03 22:22:57 -04:00
|
|
|
|
|
2015-10-13 15:22:45 -04:00
|
|
|
|
header: Globalize.translate('HeaderSelectTranscodingPath'),
|
|
|
|
|
|
|
|
|
|
instruction: Globalize.translate('HeaderSelectTranscodingPathHelp')
|
|
|
|
|
});
|
2014-07-03 22:22:57 -04:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2015-06-07 21:23:56 -04:00
|
|
|
|
$('.encodingSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
|
|
|
|
|
|
|
|
|
|
2015-09-24 13:08:10 -04:00
|
|
|
|
}).on('pageshow', "#encodingSettingsPage", function () {
|
2014-01-07 13:39:35 -05:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2016-06-20 02:19:28 -04:00
|
|
|
|
LibraryMenu.setTabs('playback', 3, getTabs);
|
2014-01-07 13:39:35 -05:00
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-12-14 10:43:03 -05:00
|
|
|
|
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
2014-01-07 13:39:35 -05:00
|
|
|
|
|
|
|
|
|
loadPage(page, config);
|
2016-06-20 02:19:28 -04:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ApiClient.getSystemInfo().then(function (systemInfo) {
|
2014-01-07 13:39:35 -05:00
|
|
|
|
|
2016-06-20 02:19:28 -04:00
|
|
|
|
if (systemInfo.HasExternalEncoder) {
|
|
|
|
|
page.querySelector('.fldEncoderPath').classList.add('hide');
|
|
|
|
|
} else {
|
|
|
|
|
page.querySelector('.fldEncoderPath').classList.remove('hide');
|
|
|
|
|
}
|
2014-01-07 13:39:35 -05:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2016-03-19 05:26:17 +01:00
|
|
|
|
});
|