Anleitungen erstellt und Bildrate einstellbar

This commit is contained in:
2026-05-25 17:09:31 +02:00
parent 3207b58772
commit 023017d1fb
10 changed files with 663 additions and 36 deletions
+39 -9
View File
@@ -235,20 +235,35 @@
<div class="panel">
<div class="p-hdr">
<div class="p-dot"></div>
<span class="p-lbl">Stream-Aufl&ouml;sung</span>
<span class="p-lbl">Kamera-Stream</span>
<span class="p-tag">Konfiguration</span>
</div>
<div class="dropdown-row">
<label>Profil</label>
<select id="camera_profile_select" class="ctrl-select" onchange="setCameraProfile(this.value)">
<option value="640x480">640 x 480 &middot; 4:3 &middot; gr&ouml;&szlig;tes Sichtfeld</option>
<option value="1024x768">1024 x 768 &middot; 4:3 &middot; mehr Details</option>
<option value="1296x972">1296 x 972 &middot; 4:3 &middot; noch mehr Details</option>
<option value="640x480">640 x 480</option>
<option value="1024x768">1024 x 768</option>
<option value="1296x972">1296 x 972</option>
</select>
<span id="camera_profile_status" class="ctrl-status"></span>
</div>
<div class="dropdown-row">
<label>Bildrate</label>
<select id="camera_fps_select" class="ctrl-select" onchange="setCameraFps(this.value)">
<option value="1">1 fps</option>
<option value="2">2 fps</option>
<option value="3">3 fps</option>
<option value="4">4 fps</option>
<option value="5">5 fps</option>
<option value="7">7 fps</option>
<option value="10">10 fps</option>
<option value="20">20 fps</option>
</select>
</div>
<div class="dropdown-status-row">
<span id="camera_profile_status" class="ctrl-status ctrl-status_block"></span>
</div>
<div class="copy-text camera-copy">
Die neue Aufl&ouml;sung wird gespeichert und der Kameradienst automatisch neu gestartet. Der Videostream ist dabei f&uuml;r einen kurzen Moment unterbrochen.
Aufl&ouml;sung und Bildrate werden gespeichert. Danach startet der Kameradienst automatisch neu. Der Videostream ist dabei f&uuml;r einen kurzen Moment unterbrochen.
</div>
<div class="act-grid act-grid_single">
<button class="act-btn subtle full" onclick="refreshCameraPreview()">Vorschau neu laden</button>
@@ -2353,8 +2368,15 @@
function renderCameraConfig(data) {
var camera = data && data.camera ? data.camera : {};
var selectedProfile = camera.selected_profile || '';
var select = document.getElementById('camera_profile_select');
if (select && selectedProfile) select.value = selectedProfile;
var profileSelect = document.getElementById('camera_profile_select');
var fpsSelect = document.getElementById('camera_fps_select');
if (profileSelect && selectedProfile) profileSelect.value = selectedProfile;
if (fpsSelect && Array.isArray(camera.fps_options) && camera.fps_options.length) {
fpsSelect.innerHTML = camera.fps_options.map(function(option) {
return '<option value="' + option + '">' + option + ' fps</option>';
}).join('');
}
if (fpsSelect && camera.fps) fpsSelect.value = String(camera.fps);
setText('camera_profile_label', selectedProfile || '--');
setText('camera_resolution_label', (camera.width && camera.height) ? (camera.width + ' x ' + camera.height) : '--');
setText('camera_fps_label', camera.fps ? (camera.fps + ' fps') : '--');
@@ -2369,13 +2391,15 @@
}
async function setCameraProfile(profileId) {
var fpsSelect = document.getElementById('camera_fps_select');
var fps = fpsSelect ? Number(fpsSelect.value || 10) : 10;
var statusEl = document.getElementById('camera_profile_status');
if (statusEl) statusEl.textContent = 'Speichere…';
try {
var response = await fetch(adminApiBase + '/api/camera-config', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({profile: profileId})
body: JSON.stringify({profile: profileId, fps: fps})
});
var data = await response.json();
if (!response.ok) throw new Error(data.status || 'Fehler');
@@ -2390,6 +2414,12 @@
}
}
function setCameraFps(fps) {
var profileSelect = document.getElementById('camera_profile_select');
var profileId = profileSelect ? profileSelect.value : '1296x972';
setCameraProfile(profileId);
}
async function runRumble() {
try {
var response = await fetch(adminApiBase + '/api/rumble', { method: 'POST' });