2020-08-14 08:46:34 +02:00
|
|
|
import 'jquery';
|
|
|
|
import loading from '../../components/loading/loading';
|
|
|
|
import libraryMenu from '../../scripts/libraryMenu';
|
|
|
|
import globalize from '../../scripts/globalize';
|
2020-10-12 23:08:55 +01:00
|
|
|
import Dashboard from '../../scripts/clientUtils';
|
2020-07-08 19:58:28 +01:00
|
|
|
|
|
|
|
/* eslint-disable indent */
|
2018-10-23 01:05:09 +03:00
|
|
|
|
|
|
|
function loadPage(page, config) {
|
2020-05-04 12:44:12 +02:00
|
|
|
$('#txtMinResumePct', page).val(config.MinResumePct);
|
|
|
|
$('#txtMaxResumePct', page).val(config.MaxResumePct);
|
|
|
|
$('#txtMinResumeDuration', page).val(config.MinResumeDurationSeconds);
|
2019-11-06 13:43:39 +03:00
|
|
|
loading.hide();
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function onSubmit() {
|
|
|
|
loading.show();
|
2020-07-09 11:36:54 +01:00
|
|
|
const form = this;
|
2019-11-06 13:43:39 +03:00
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
|
|
|
config.MinResumePct = $('#txtMinResumePct', form).val();
|
|
|
|
config.MaxResumePct = $('#txtMaxResumePct', form).val();
|
|
|
|
config.MinResumeDurationSeconds = $('#txtMinResumeDuration', form).val();
|
|
|
|
|
|
|
|
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
|
|
|
});
|
|
|
|
|
|
|
|
return false;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getTabs() {
|
|
|
|
return [{
|
2020-05-04 12:44:12 +02:00
|
|
|
href: 'encodingsettings.html',
|
|
|
|
name: globalize.translate('Transcoding')
|
2019-08-16 00:25:31 -07:00
|
|
|
}, {
|
2020-05-04 12:44:12 +02:00
|
|
|
href: 'playbackconfiguration.html',
|
2020-08-16 20:34:39 +09:00
|
|
|
name: globalize.translate('ButtonResume')
|
2018-10-23 01:05:09 +03:00
|
|
|
}, {
|
2020-05-04 12:44:12 +02:00
|
|
|
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
|
|
|
|
2020-05-04 12:44:12 +02:00
|
|
|
$(document).on('pageinit', '#playbackConfigurationPage', function () {
|
|
|
|
$('.playbackConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
|
|
|
|
}).on('pageshow', '#playbackConfigurationPage', function () {
|
2019-08-16 00:25:31 -07:00
|
|
|
loading.show();
|
2020-05-04 12:44:12 +02:00
|
|
|
libraryMenu.setTabs('playback', 1, getTabs);
|
2020-07-09 11:36:54 +01:00
|
|
|
const page = this;
|
2019-11-06 13:43:39 +03:00
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
|
|
|
loadPage(page, config);
|
|
|
|
});
|
|
|
|
});
|
2020-07-08 19:58:28 +01:00
|
|
|
|
|
|
|
/* eslint-enable indent */
|