Fix player brightness controls on iPhone Duo

Brightness controls used UIScreen.main, which on iPhone Duo can be a
different display than the one hosting the player. Route all brightness
reads and writes through PlayerBrightness, which targets the screen of
the window hosting the controls.
This commit is contained in:
Arkadiusz Fal
2026-10-22 23:16:11 +02:00
parent 52774fc7cc
commit fb4da41877
4 changed files with 52 additions and 9 deletions

View File

@@ -460,7 +460,7 @@ struct ControlsSectionRenderer: View {
/// Brightness icon image using variable value SF Symbol.
private var brightnessImage: Image {
Image(systemName: "sun.max.fill", variableValue: UIScreen.main.brightness)
Image(systemName: "sun.max.fill", variableValue: PlayerBrightness.value(for: actions.screen))
}
/// Panel toggle button content with glass background support.
@@ -796,9 +796,9 @@ struct ControlsSectionRenderer: View {
if effectiveBehavior == .alwaysVisible || isBrightnessExpanded {
Slider(
value: Binding(
get: { UIScreen.main.brightness },
get: { PlayerBrightness.value(for: actions.screen) },
set: { newValue in
UIScreen.main.brightness = newValue
PlayerBrightness.set(newValue, for: actions.screen)
}
),
in: 0...1,