Skip to content

Commit 4cb0e27

Browse files
committed
persist camera selection on test page
1 parent 96fb519 commit 4cb0e27

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/perceptor-host-test/index.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ <h2>Active Connections</h2>
137137
// Preserve existing autoUpload checkbox state if it exists, default to true
138138
const existingCheckbox = document.getElementById(`autoUpload-${conn.id}`);
139139
const isChecked = existingCheckbox ? existingCheckbox.checked : true;
140+
141+
// Preserve existing camera selection if it exists, default to front
142+
let currentCamera = "front";
143+
const existingRadios = document.getElementsByName(`camera-${conn.id}`);
144+
for (const radio of existingRadios) {
145+
if (radio.checked) {
146+
currentCamera = radio.value;
147+
break;
148+
}
149+
}
150+
140151
return `
141152
<div class="connection-item">
142153
<div class="connection-id">${conn.clientName || 'Unknown Device'} <span style="color: #999; font-size: 0.85em;">(${conn.id})</span></div>
@@ -154,10 +165,10 @@ <h2>Active Connections</h2>
154165
<div style="display: inline-block; margin-left: 10px; margin-right: 10px; border-left: 1px solid #ddd; padding-left: 10px;">
155166
<span style="margin-right: 5px;">Camera:</span>
156167
<label style="margin-right: 8px; cursor: pointer;">
157-
<input type="radio" name="camera-${conn.id}" value="front" checked> Front
168+
<input type="radio" name="camera-${conn.id}" value="front" ${currentCamera === 'front' ? 'checked' : ''}> Front
158169
</label>
159170
<label style="cursor: pointer;">
160-
<input type="radio" name="camera-${conn.id}" value="back"> Back
171+
<input type="radio" name="camera-${conn.id}" value="back" ${currentCamera === 'back' ? 'checked' : ''}> Back
161172
</label>
162173
</div>
163174
<button onclick="sendRecordCommand('${conn.id}')" style="margin-left: 10px; padding: 8px 12px; font-size: 14px; cursor: pointer; background-color: #2196f3; color: white; border: none; border-radius: 4px;">

0 commit comments

Comments
 (0)