-
Torne seu app para iOS compatível com a câmera frontal Center Stage
Potencialize seu app de câmera para iOS com o Center Stage usando as APIs AVCapture com a câmera frontal do iPhone 17, iPhone 17 Pro e iPhone Air. Descubra como as APIs permitem usar as opções de zoom e rotação, oferecendo maneiras mais flexíveis de enquadrar selfies e vídeos e de não cortar ninguém em uma foto em grupo. Integre o Center Stage para ajuste automático do enquadramento em chamadas de vídeo, colocando você em destaque em reuniões virtuais e chamadas FaceTime. Por fim, saiba como estabilizar seu vídeo para videoconferências em tempo real.
Capítulos
- 0:00 - Introdução
- 1:07 - Câmera frontal Center Stage
- 2:09 - Center Stage para fotos
- 3:09 - Configuração da sessão de captura
- 3:56 - Proporção de aspecto dinâmica
- 6:47 - Monitor de enquadramento inteligente
- 9:24 - Compensação de orientação do sensor
- 11:53 - Center Stage para gravações de vídeo
- 13:16 - Center Stage para videoconferências
Recursos
- Supporting Center Stage front camera in your iOS app
- AVCam: Building a camera app
- AVFoundation
- Capture setup
Vídeos relacionados
WWDC26
WWDC23
WWDC21
-
Buscar neste vídeo...
-
-
5:29 - Support dynamic aspect ratio
// Select the Center Stage front camera import AVFoundation let deviceDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInUltraWideCamera], mediaType: .video, position: .front) guard let camera = deviceDiscoverySession.devices.first else { print("Failed to find the capture device") return } // Find a format that supports the 4x3 aspect ratio for format in camera.formats { if format.supportedDynamicAspectRatios.contains(.ratio4x3) { try! camera.lockForConfiguration() camera.activeFormat = format camera.unlockForConfiguration() break } } // Set dynamic aspect ratio try! camera.lockForConfiguration() let timestamp = try! await camera.setDynamicAspectRatio(.ratio4x3) print("Applied dynamic aspect ratio at timestamp: \(timestamp)") camera.unlockForConfiguration() -
7:39 - Support smart framing monitor
// Find a format that supports smart framing import AVFoundation for format in camera.formats { if format.isSmartFramingSupported { try! camera.lockForConfiguration() camera.activeFormat = format camera.unlockForConfiguration() break } } // Configure the smart framing monitor let monitor = camera.smartFramingMonitor! try! camera.lockForConfiguration() monitor.enabledFramings = monitor.supportedFramings camera.unlockForConfiguration() // Monitor framing recommendations observation = monitor.observe(\.recommendedFraming, options: [.new,]) { monitor, change in if let framing = monitor.recommendedFraming { Task { try! camera.lockForConfiguration() try! await camera.setDynamicAspectRatio(framing.aspectRatio) camera.videoZoomFactor = CGFloat(framing.zoomFactor) camera.unlockForConfiguration() } } } // Start the smart framing monitor try! monitor.startMonitoring() // Stop the smart framing monitor observation?.invalidate() observation = nil monitor.stopMonitoring() -
14:44 - Support Center Stage for video calls
// Find a format that supports Center Stage import AVFoundation for format in camera.formats { if format.isCenterStageSupported { try! camera.lockForConfiguration() camera.activeFormat = format camera.unlockForConfiguration() break } } // Turn on Center Stage AVCaptureDevice.centerStageControlMode = .cooperative AVCaptureDevice.isCenterStageEnabled = true
-