Auto-on live preview when recount starts (all recounting templates)
This commit is contained in:
1 parent
6043197d72
commit
6be017c4f0
5 files changed
+82
-20
No files matched your search
@@ -405,6 +405,7 @@ function applyState(data) {
|
||||
document.getElementById('video-status').innerHTML =
|
||||
'<span style="width:5px;height:5px;background:var(--success);display:inline-block;"></span> streaming ' + (data.file_name || '');
|
||||
document.getElementById('video-status').className = 'video-status connected';
|
||||
enablePreview();
|
||||
|
||||
loadBatchResult(data.file);
|
||||
} else if (data.file && selectedFile === data.file) {
|
||||
@@ -595,6 +596,7 @@ async function startRecount() {
|
||||
document.getElementById('video-status').innerHTML =
|
||||
'<span style="width:5px;height:5px;background:var(--success);display:inline-block;"></span> streaming ' + data.file;
|
||||
document.getElementById('video-status').className = 'video-status connected';
|
||||
enablePreview();
|
||||
} catch (err) {
|
||||
alert('Error: ' + err.message);
|
||||
btnStart.disabled = false;
|
||||
@@ -655,11 +657,7 @@ function togglePreview() {
|
||||
btn.textContent = 'STREAM OFF';
|
||||
btn.classList.remove('active');
|
||||
} else {
|
||||
img.src = streamUrl + '?' + Date.now();
|
||||
img.style.display = 'block';
|
||||
if (placeholder) placeholder.style.display = 'none';
|
||||
btn.textContent = 'STREAM ON';
|
||||
btn.classList.add('active');
|
||||
enablePreview();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,6 +672,23 @@ function resetVideoToggle() {
|
||||
btn.classList.remove('active');
|
||||
}
|
||||
|
||||
function enablePreview() {
|
||||
const btn = document.getElementById('videoToggle');
|
||||
const img = document.getElementById('stream-img');
|
||||
const placeholder = document.getElementById('video-placeholder');
|
||||
if (!streamUrl) return;
|
||||
img.onerror = function() {
|
||||
if (streaming && streamUrl) {
|
||||
img.src = streamUrl + '?' + Date.now();
|
||||
}
|
||||
};
|
||||
img.src = streamUrl + '?' + Date.now();
|
||||
img.style.display = 'block';
|
||||
if (placeholder) placeholder.style.display = 'none';
|
||||
btn.textContent = 'STREAM ON';
|
||||
btn.classList.add('active');
|
||||
}
|
||||
|
||||
// --- Recount counter ---
|
||||
|
||||
let lastRecountCount = null;
|
||||
|
||||
Reference in new issue
Block a user