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();
|
performTranslation();
|
||||||
var conf_editor_v4l2 = null;
|
var conf_editor_v4l2 = null;
|
||||||
var conf_editor_fg = 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
|
// Dynamic v4l2 enum schema
|
||||||
var v4l2_dynamic_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(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")));
|
$('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title")));
|
||||||
|
|
||||||
// V4L2
|
// V4L2 - hide if not available
|
||||||
$('#conf_cont').append(createRow('conf_cont_v4l'));
|
if(V4L2_AVAIL){
|
||||||
$('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
|
$('#conf_cont').append(createRow('conf_cont_v4l'));
|
||||||
$('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title")));
|
$('#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 {
|
} else {
|
||||||
$('#conf_cont').addClass('row');
|
$('#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_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_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'));
|
if(V4L2_AVAIL){
|
||||||
|
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instance Capture
|
// Instance Capture
|
||||||
@ -194,69 +199,73 @@ $(document).ready( function() {
|
|||||||
requestWriteConfig(conf_editor_fg.getValue());
|
requestWriteConfig(conf_editor_fg.getValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', {
|
if(V4L2_AVAIL){
|
||||||
grabberV4L2 : window.schema.grabberV4L2
|
conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', {
|
||||||
}, true, true);
|
grabberV4L2 : window.schema.grabberV4L2
|
||||||
|
}, true, true);
|
||||||
|
|
||||||
conf_editor_v4l2.on('change',function() {
|
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.validate().length ? $('#btn_submit_v4l2').attr('disabled', true) : $('#btn_submit_v4l2').attr('disabled', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
conf_editor_v4l2.on('ready', function() {
|
conf_editor_v4l2.on('ready', function() {
|
||||||
setWatchers(v4l2_dynamic_enum_schema);
|
setWatchers(v4l2_dynamic_enum_schema);
|
||||||
|
|
||||||
if (window.serverConfig.grabberV4L2.available_devices == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
if (window.serverConfig.grabberV4L2.available_devices == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||||
toggleOption('device', true);
|
toggleOption('device', true);
|
||||||
|
|
||||||
if (window.serverConfig.grabberV4L2.device == 'auto')
|
if (window.serverConfig.grabberV4L2.device == 'auto')
|
||||||
conf_editor_v4l2.getEditor('root.grabberV4L2.available_devices').setValue('auto');
|
conf_editor_v4l2.getEditor('root.grabberV4L2.available_devices').setValue('auto');
|
||||||
|
|
||||||
if (window.serverConfig.grabberV4L2.available_devices == 'auto') {
|
if (window.serverConfig.grabberV4L2.available_devices == 'auto') {
|
||||||
['resolutions', 'framerates'].forEach(function(item) {
|
['resolutions', 'framerates'].forEach(function(item) {
|
||||||
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).setValue('auto');
|
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).setValue('auto');
|
||||||
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).disable();
|
conf_editor_v4l2.getEditor('root.grabberV4L2.' + item).disable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.serverConfig.grabberV4L2.resolutions == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
if (window.serverConfig.grabberV4L2.resolutions == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||||
(toggleOption('width', true), toggleOption('height', true));
|
(toggleOption('width', true), toggleOption('height', true));
|
||||||
|
|
||||||
if (window.serverConfig.grabberV4L2.framerates == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
if (window.serverConfig.grabberV4L2.framerates == 'custom' && window.serverConfig.grabberV4L2.device != 'auto')
|
||||||
toggleOption('fps', true);
|
toggleOption('fps', true);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_submit_v4l2').off().on('click',function() {
|
$('#btn_submit_v4l2').off().on('click',function() {
|
||||||
var v4l2Options = conf_editor_v4l2.getValue()
|
var v4l2Options = conf_editor_v4l2.getValue()
|
||||||
|
|
||||||
if (v4l2Options.grabberV4L2.available_devices != 'custom' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
if (v4l2Options.grabberV4L2.available_devices != 'custom' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||||
v4l2Options.grabberV4L2.device = v4l2Options.grabberV4L2.available_devices;
|
v4l2Options.grabberV4L2.device = v4l2Options.grabberV4L2.available_devices;
|
||||||
|
|
||||||
if (v4l2Options.grabberV4L2.available_devices == 'auto')
|
if (v4l2Options.grabberV4L2.available_devices == 'auto')
|
||||||
v4l2Options.grabberV4L2.device = 'auto';
|
v4l2Options.grabberV4L2.device = 'auto';
|
||||||
|
|
||||||
if (v4l2Options.grabberV4L2.resolutions != 'custom' && v4l2Options.grabberV4L2.resolutions != 'auto' && v4l2Options.grabberV4L2.available_devices != '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.width = parseInt(v4l2Options.grabberV4L2.resolutions.split('x')[0]),
|
||||||
v4l2Options.grabberV4L2.height = parseInt(v4l2Options.grabberV4L2.resolutions.split('x')[1]));
|
v4l2Options.grabberV4L2.height = parseInt(v4l2Options.grabberV4L2.resolutions.split('x')[1]));
|
||||||
|
|
||||||
if (v4l2Options.grabberV4L2.resolutions == 'auto')
|
if (v4l2Options.grabberV4L2.resolutions == 'auto')
|
||||||
(v4l2Options.grabberV4L2.width = 0, v4l2Options.grabberV4L2.height = 0);
|
(v4l2Options.grabberV4L2.width = 0, v4l2Options.grabberV4L2.height = 0);
|
||||||
|
|
||||||
if (v4l2Options.grabberV4L2.framerates != 'custom' && v4l2Options.grabberV4L2.framerates != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
if (v4l2Options.grabberV4L2.framerates != 'custom' && v4l2Options.grabberV4L2.framerates != 'auto' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||||
v4l2Options.grabberV4L2.fps = parseInt(v4l2Options.grabberV4L2.framerates);
|
v4l2Options.grabberV4L2.fps = parseInt(v4l2Options.grabberV4L2.framerates);
|
||||||
|
|
||||||
if (v4l2Options.grabberV4L2.framerates == 'auto')
|
if (v4l2Options.grabberV4L2.framerates == 'auto')
|
||||||
v4l2Options.grabberV4L2.fps = 15;
|
v4l2Options.grabberV4L2.fps = 15;
|
||||||
|
|
||||||
requestWriteConfig(v4l2Options);
|
requestWriteConfig(v4l2Options);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
//create introduction
|
//create introduction
|
||||||
if(window.showOptHelp) {
|
if(window.showOptHelp) {
|
||||||
createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg");
|
createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg");
|
||||||
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2");
|
if(V4L2_AVAIL){
|
||||||
|
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideEl(el) {
|
function hideEl(el) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user