mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
fix(webui): hide v4l2 if not available (#782)
* fix(webui): hide v4l2 if not available * Whups
This commit is contained in:
parent
884c68b239
commit
e79615534c
@ -2,7 +2,8 @@ $(document).ready( function() {
|
||||
performTranslation();
|
||||
var conf_editor_v4l2 = null;
|
||||
var conf_editor_fg = null;
|
||||
var conf_editor_instCapt = null;
|
||||
var conf_editor_instCapt = null;
|
||||
var V4L2_AVAIL = window.serverInfo.grabbers.available.includes("v4l2");
|
||||
|
||||
// Dynamic v4l2 enum schema
|
||||
var v4l2_dynamic_enum_schema = {
|
||||
@ -157,15 +158,19 @@ $(document).ready( function() {
|
||||
$('#conf_cont_fg').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg'));
|
||||
$('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title")));
|
||||
|
||||
// V4L2
|
||||
$('#conf_cont').append(createRow('conf_cont_v4l'));
|
||||
$('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
|
||||
$('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title")));
|
||||
// V4L2 - hide if not available
|
||||
if(V4L2_AVAIL){
|
||||
$('#conf_cont').append(createRow('conf_cont_v4l'));
|
||||
$('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
|
||||
$('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title")));
|
||||
}
|
||||
} else {
|
||||
$('#conf_cont').addClass('row');
|
||||
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt'));
|
||||
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg'));
|
||||
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
|
||||
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg'));
|
||||
if(V4L2_AVAIL){
|
||||
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
|
||||
}
|
||||
}
|
||||
|
||||
// Instance Capture
|
||||
@ -194,69 +199,73 @@ $(document).ready( function() {
|
||||
requestWriteConfig(conf_editor_fg.getValue());
|
||||
});
|
||||
|
||||
conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', {
|
||||
grabberV4L2 : window.schema.grabberV4L2
|
||||
}, true, true);
|
||||
if(V4L2_AVAIL){
|
||||
conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', {
|
||||
grabberV4L2 : window.schema.grabberV4L2
|
||||
}, true, true);
|
||||
|
||||
conf_editor_v4l2.on('change',function() {
|
||||
conf_editor_v4l2.validate().length ? $('#btn_submit_v4l2').attr('disabled', true) : $('#btn_submit_v4l2').attr('disabled', false);
|
||||
});
|
||||
conf_editor_v4l2.on('change',function() {
|
||||
conf_editor_v4l2.validate().length ? $('#btn_submit_v4l2').attr('disabled', true) : $('#btn_submit_v4l2').attr('disabled', false);
|
||||
});
|
||||
|
||||
conf_editor_v4l2.on('ready', function() {
|
||||
setWatchers(v4l2_dynamic_enum_schema);
|
||||
conf_editor_v4l2.on('ready', function() {
|
||||
setWatchers(v4l2_dynamic_enum_schema);
|
||||
|
||||
if (window.serverConfig.grabberV4L2.available_devices == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||
toggleOption('device', true);
|
||||
if (window.serverConfig.grabberV4L2.available_devices == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||
toggleOption('device', true);
|
||||
|
||||
if (window.serverConfig.grabberV4L2.device == 'auto')
|
||||
conf_editor_v4l2.getEditor('root.grabberV4L2.available_devices').setValue('auto');
|
||||
if (window.serverConfig.grabberV4L2.device == 'auto')
|
||||
conf_editor_v4l2.getEditor('root.grabberV4L2.available_devices').setValue('auto');
|
||||
|
||||
if (window.serverConfig.grabberV4L2.available_devices == 'auto') {
|
||||
['resolutions', 'framerates'].forEach(function(item) {
|
||||
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).setValue('auto');
|
||||
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).disable();
|
||||
});
|
||||
}
|
||||
if (window.serverConfig.grabberV4L2.available_devices == 'auto') {
|
||||
['resolutions', 'framerates'].forEach(function(item) {
|
||||
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).setValue('auto');
|
||||
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).disable();
|
||||
});
|
||||
}
|
||||
|
||||
if (window.serverConfig.grabberV4L2.resolutions == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||
(toggleOption('width', true), toggleOption('height', true));
|
||||
if (window.serverConfig.grabberV4L2.resolutions == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||
(toggleOption('width', true), toggleOption('height', true));
|
||||
|
||||
if (window.serverConfig.grabberV4L2.framerates == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||
toggleOption('fps', true);
|
||||
if (window.serverConfig.grabberV4L2.framerates == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||
toggleOption('fps', true);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn_submit_v4l2').off().on('click',function() {
|
||||
var v4l2Options = conf_editor_v4l2.getValue()
|
||||
$('#btn_submit_v4l2').off().on('click',function() {
|
||||
var v4l2Options = conf_editor_v4l2.getValue()
|
||||
|
||||
if (v4l2Options.grabberV4L2.available_devices != 'custom' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||
v4l2Options.grabberV4L2.device = v4l2Options.grabberV4L2.available_devices;
|
||||
if (v4l2Options.grabberV4L2.available_devices != 'custom' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||
v4l2Options.grabberV4L2.device = v4l2Options.grabberV4L2.available_devices;
|
||||
|
||||
if (v4l2Options.grabberV4L2.available_devices == 'auto')
|
||||
v4l2Options.grabberV4L2.device = 'auto';
|
||||
if (v4l2Options.grabberV4L2.available_devices == 'auto')
|
||||
v4l2Options.grabberV4L2.device = 'auto';
|
||||
|
||||
if (v4l2Options.grabberV4L2.resolutions != 'custom' && v4l2Options.grabberV4L2.resolutions != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||
(v4l2Options.grabberV4L2.width = parseInt(v4l2Options.grabberV4L2.resolutions.split('x')[0]),
|
||||
v4l2Options.grabberV4L2.height = parseInt(v4l2Options.grabberV4L2.resolutions.split('x')[1]));
|
||||
if (v4l2Options.grabberV4L2.resolutions != 'custom' && v4l2Options.grabberV4L2.resolutions != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||
(v4l2Options.grabberV4L2.width = parseInt(v4l2Options.grabberV4L2.resolutions.split('x')[0]),
|
||||
v4l2Options.grabberV4L2.height = parseInt(v4l2Options.grabberV4L2.resolutions.split('x')[1]));
|
||||
|
||||
if (v4l2Options.grabberV4L2.resolutions == 'auto')
|
||||
(v4l2Options.grabberV4L2.width = 0, v4l2Options.grabberV4L2.height = 0);
|
||||
if (v4l2Options.grabberV4L2.resolutions == 'auto')
|
||||
(v4l2Options.grabberV4L2.width = 0, v4l2Options.grabberV4L2.height = 0);
|
||||
|
||||
if (v4l2Options.grabberV4L2.framerates != 'custom' && v4l2Options.grabberV4L2.framerates != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||
v4l2Options.grabberV4L2.fps = parseInt(v4l2Options.grabberV4L2.framerates);
|
||||
if (v4l2Options.grabberV4L2.framerates != 'custom' && v4l2Options.grabberV4L2.framerates != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||
v4l2Options.grabberV4L2.fps = parseInt(v4l2Options.grabberV4L2.framerates);
|
||||
|
||||
if (v4l2Options.grabberV4L2.framerates == 'auto')
|
||||
v4l2Options.grabberV4L2.fps = 15;
|
||||
if (v4l2Options.grabberV4L2.framerates == 'auto')
|
||||
v4l2Options.grabberV4L2.fps = 15;
|
||||
|
||||
requestWriteConfig(v4l2Options);
|
||||
});
|
||||
requestWriteConfig(v4l2Options);
|
||||
});
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
//create introduction
|
||||
if(window.showOptHelp) {
|
||||
createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg");
|
||||
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2");
|
||||
createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg");
|
||||
if(V4L2_AVAIL){
|
||||
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2");
|
||||
}
|
||||
}
|
||||
|
||||
function hideEl(el) {
|
||||
|
Loading…
Reference in New Issue
Block a user