diff --git a/dashboard-ui/encodingsettings.html b/dashboard-ui/encodingsettings.html index 5b81d25548..56affeb7d8 100644 --- a/dashboard-ui/encodingsettings.html +++ b/dashboard-ui/encodingsettings.html @@ -29,11 +29,18 @@
${OptionEnableTranscodingThrottleHelp}
+ +
+ +
diff --git a/dashboard-ui/scripts/encodingsettings.js b/dashboard-ui/scripts/encodingsettings.js index 3a059aa776..74a93e7167 100644 --- a/dashboard-ui/scripts/encodingsettings.js +++ b/dashboard-ui/scripts/encodingsettings.js @@ -1,6 +1,6 @@ define(['jQuery'], function ($) { - function loadPage(page, config) { + function loadPage(page, config, systemInfo) { page.querySelector('#chkEnableThrottle').checked = config.EnableThrottling; @@ -10,6 +10,11 @@ page.querySelector('.txtEncoderPath').value = config.EncoderAppPath || ''; $('#txtTranscodingTempPath', page).val(config.TranscodingTempPath || ''); + var selectEncoderPath = page.querySelector('#selectEncoderPath'); + + selectEncoderPath.value = systemInfo.EncoderLocationType; + onSelectEncoderPathChange.call(selectEncoderPath); + Dashboard.hideLoadingMsg(); } @@ -27,6 +32,25 @@ }); } + function updateEncoder(form) { + + return ApiClient.getSystemInfo().then(function(systemInfo) { + + if (systemInfo.EncoderLocationType == "External") { + return; + } + + return ApiClient.ajax({ + url: ApiClient.getUrl('System/MediaEncoder/Path'), + type: 'POST', + data: { + Path: form.querySelector('.txtEncoderPath').value, + PathType: form.querySelector('#selectEncoderPath').value + } + }).then(Dashboard.processServerConfigurationUpdateResult, onSaveEncodingPathFailure); + }); + } + function onSubmit() { var form = this; @@ -45,14 +69,7 @@ ApiClient.updateNamedConfiguration("encoding", config).then(function () { - ApiClient.ajax({ - url: ApiClient.getUrl('System/MediaEncoder/Path'), - type: 'POST', - data: { - Path: form.querySelector('.txtEncoderPath').value - } - }).then(Dashboard.processServerConfigurationUpdateResult, onSaveEncodingPathFailure); - + updateEncoder(form); }); }); }; @@ -95,6 +112,17 @@ }]; } + function onSelectEncoderPathChange(e) { + + var page = $(this).parents('.page')[0]; + + if (this.value == 'Custom') { + page.querySelector('.fldEncoderPath').classList.remove('hide'); + } else { + page.querySelector('.fldEncoderPath').classList.add('hide'); + } + } + $(document).on('pageinit', "#encodingSettingsPage", function () { var page = this; @@ -144,6 +172,7 @@ $('.encodingSettingsForm').off('submit', onSubmit).on('submit', onSubmit); + page.querySelector('#selectEncoderPath').addEventListener('change', onSelectEncoderPathChange); }).on('pageshow', "#encodingSettingsPage", function () { @@ -154,17 +183,17 @@ ApiClient.getNamedConfiguration("encoding").then(function (config) { - loadPage(page, config); + ApiClient.getSystemInfo().then(function (systemInfo) { + + if (systemInfo.EncoderLocationType == "External") { + page.querySelector('.fldSelectEncoderPathType').classList.add('hide'); + } else { + page.querySelector('.fldSelectEncoderPathType').classList.remove('hide'); + } + loadPage(page, config, systemInfo); + }); }); - ApiClient.getSystemInfo().then(function (systemInfo) { - - if (systemInfo.HasExternalEncoder) { - page.querySelector('.fldEncoderPath').classList.add('hide'); - } else { - page.querySelector('.fldEncoderPath').classList.remove('hide'); - } - }); }); }); diff --git a/dashboard-ui/scripts/wizardcomponents.js b/dashboard-ui/scripts/wizardcomponents.js index 78956254ee..3515a9382e 100644 --- a/dashboard-ui/scripts/wizardcomponents.js +++ b/dashboard-ui/scripts/wizardcomponents.js @@ -16,10 +16,10 @@ view.querySelector('.suggestedLocation').innerHTML = Globalize.translate('FFmpegSuggestedDownload', 'https://ffmpeg.zeranoe.com'); if (systemInfo.SystemArchitecture == 'X86') { - instructions = 'Download 32-Bit Static'; + instructions = 'Download FFmpeg 32-Bit Static'; } else if (systemInfo.SystemArchitecture == 'X64') { - instructions = 'Download 64-Bit Static'; + instructions = 'Download FFmpeg 64-Bit Static'; } view.querySelector('.downloadInstructions').innerHTML = instructions; @@ -90,7 +90,8 @@ url: ApiClient.getUrl('System/MediaEncoder/Path'), type: 'POST', data: { - Path: form.querySelector('.txtEncoderPath').value + Path: form.querySelector('.txtEncoderPath').value, + PathType: 'Custom' } }).then(goNext, onSaveEncodingPathFailure); diff --git a/dashboard-ui/strings/en-US.json b/dashboard-ui/strings/en-US.json index 3564d575fa..5797a57594 100644 --- a/dashboard-ui/strings/en-US.json +++ b/dashboard-ui/strings/en-US.json @@ -2374,6 +2374,7 @@ "SettingsWarning": "Changing these values may cause instability or connectivity failures. If you experience any problems, we recommend changing them back to default.", "MapChannels": "Map Channels", "LabelffmpegPath": "FFmpeg path:", + "LabelffmpegVersion": "FFmpeg version:", "LabelffmpegPathHelp": "The path to your downloaded FFmpeg application, or folder containing FFmpeg.", "SetupFFmpeg": "Setup FFmpeg", "SetupFFmpegHelp": "FFmpeg is a required component and needs to be configured.", @@ -2381,5 +2382,7 @@ "DownloadFFmpeg": "Download FFmpeg", "FFmpegSuggestedDownload": "Suggested download: {0}", "UnzipFFmpegFile": "Unzip the downloaded file to a folder of your choice.", + "OptionUseSystemInstalledVersion": "Use system installed version", + "OptionUseMyCustomVersion": "Use a custom version", "FFmpegSavePathNotFound": "We're unable to locaate FFmpeg using the path you've entered. FFprobe is also required and must exist in the same folder. These components are normally bundled together in the same download. Please check the path and try again." }