Skip to content

Commit 6ea2b0c

Browse files
committed
feat: enhance night vision mode handling and optimize overlay settings in StreamPreview component
1 parent c411737 commit 6ea2b0c

3 files changed

Lines changed: 9 additions & 40 deletions

File tree

app/src/main/java/com/raulshma/lenscast/camera/CameraService.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,12 @@ class CameraService(private val context: Context) {
880880
Log.d(TAG, "Night vision AUTO: scene=NIGHT_PORTRAIT, auto flash")
881881
}
882882
NightVisionMode.OFF -> {
883+
// Reset scene mode, AE mode, and AE lock when disabling night vision
884+
// (only if not overridden by HDR or manual scene mode)
885+
if (settings.hdrMode != HdrMode.ON && settings.sceneMode == null) {
886+
builder.setCaptureRequestOption(CaptureRequest.CONTROL_SCENE_MODE, CaptureRequest.CONTROL_SCENE_MODE_DISABLED)
887+
}
888+
builder.setCaptureRequestOption(CaptureRequest.CONTROL_AE_LOCK, false)
883889
}
884890
}
885891

app/src/main/java/com/raulshma/lenscast/streaming/StreamingManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class StreamingManager(private val context: Context) {
3434
private var currentAuthSettings = StreamAuthSettings()
3535
@Volatile
3636
private var currentOverlaySettings = OverlaySettings()
37+
val networkQualityMonitor = NetworkQualityMonitor()
38+
private val adaptiveBitrateController = AdaptiveBitrateController(networkQualityMonitor)
3739
private var server: StreamingServer = createServer(DEFAULT_PORT)
3840
private val streamingActive = AtomicBoolean(false)
3941
private val jpegQuality = AtomicInteger(DEFAULT_JPEG_QUALITY)
@@ -60,8 +62,6 @@ class StreamingManager(private val context: Context) {
6062
private var lastReportedClientCount = -1
6163

6264
var thermalMonitor: ThermalMonitor? = null
63-
val networkQualityMonitor = NetworkQualityMonitor()
64-
private val adaptiveBitrateController = AdaptiveBitrateController(networkQualityMonitor)
6565

6666
private val _isStreaming = MutableStateFlow(false)
6767
val isStreaming: StateFlow<Boolean> = _isStreaming

web/src/components/StreamPreview.tsx

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default function StreamPreview(props: Props) {
6060
const overlayBgColor = () => overlay()?.overlayBackgroundColor ?? '#80000000'
6161
const overlayFontSize = () => overlay()?.overlayFontSize ?? 28
6262
const overlayPadding = () => overlay()?.overlayPadding ?? 8
63+
const overlayLineHeight = () => overlay()?.overlayLineHeight ?? 4
6364

6465
const positionStyles: Record<string, { top?: string; right?: string; bottom?: string; left?: string }> = {
6566
TOP_LEFT: { top: '12px', left: '12px' },
@@ -148,44 +149,6 @@ export default function StreamPreview(props: Props) {
148149
</div>
149150
)}
150151

151-
{/* Client-side overlay preview */}
152-
<Show when={overlayEnabled() && isActive() && props.previewVisible() && buildOverlayLines().length > 0}>
153-
<div
154-
class="stream-overlay-preview"
155-
style={{
156-
position: 'absolute',
157-
...(positionStyles[overlayPosition()] || positionStyles.TOP_LEFT),
158-
'background-color': overlayBgColor(),
159-
color: overlayTextColor(),
160-
'font-size': `${overlayFontSize() * 0.4}px`,
161-
padding: `${overlayPadding() * 0.4}px`,
162-
'border-radius': '4px',
163-
'font-family': 'monospace',
164-
'z-index': '5',
165-
'pointer-events': 'none',
166-
'line-height': '1.4',
167-
}}
168-
>
169-
{buildOverlayLines().map((line) => (
170-
<div>{line}</div>
171-
))}
172-
</div>
173-
</Show>
174-
175-
{/* Reset zoom button */}
176-
<Show when={zoom.isZoomed()}>
177-
<div class="zoom-indicator">
178-
<span class="zoom-percent">{zoom.zoomPercent()}%</span>
179-
<button class="reset-zoom-btn" onClick={zoom.resetZoom} title="Reset zoom">
180-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
181-
<circle cx="11" cy="11" r="8" />
182-
<path d="M21 21l-4.35-4.35" />
183-
<path d="M11 8v6M8 11h6" />
184-
</svg>
185-
</button>
186-
</div>
187-
</Show>
188-
189152
{/* Recording overlay */}
190153
<Show when={props.isRecording()}>
191154
<div class="recording-timer-overlay">

0 commit comments

Comments
 (0)