La regia remota non va più in 500 su basket/timed; iOS gestisce chiusura set, riconnessione RTMP e avanzamento quarti in modo affidabile. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
1.2 KiB
Swift
32 lines
1.2 KiB
Swift
import AVFoundation
|
|
import UIKit
|
|
|
|
/// Regole orientamento in diretta (allineate al debounce Android).
|
|
enum BroadcastOrientationPolicy {
|
|
/// Attesa prima di applicare rotazione al mixer (evita burst da giro iPad).
|
|
static let debounceNanoseconds: UInt64 = 350_000_000
|
|
/// Finestra in cui ignorare `closed` RTMP dopo rotazione encoder.
|
|
static var suppressDisconnectSeconds: TimeInterval {
|
|
UIDevice.current.userInterfaceIdiom == .pad ? 2.5 : 1.0
|
|
}
|
|
|
|
static func shouldApplyMixerOrientation(
|
|
new: AVCaptureVideoOrientation,
|
|
previous: AVCaptureVideoOrientation?,
|
|
landscapeLocked: Bool
|
|
) -> Bool {
|
|
guard isApplicableForBroadcast(new, landscapeLocked: landscapeLocked) else { return false }
|
|
guard let previous else { return true }
|
|
return new != previous
|
|
}
|
|
|
|
/// In diretta landscape ignoriamo portrait/unknown: evita glitch quando il sensore passa da verticale.
|
|
static func isApplicableForBroadcast(
|
|
_ orientation: AVCaptureVideoOrientation,
|
|
landscapeLocked: Bool
|
|
) -> Bool {
|
|
guard landscapeLocked else { return true }
|
|
return orientation == .landscapeLeft || orientation == .landscapeRight
|
|
}
|
|
}
|