How donI verify an av composition?
Asked on 07/30/2024
1 search
To verify an AV composition, you can follow the steps outlined in the session "Build compelling spatial photo and video experiences" from WWDC 2024. Here is a brief overview of the process:
- Create an AV Capture Session: Start by creating an
AVCaptureSession
. - Add Device Input: Add an input to the session, which represents input from a capture device like a camera.
- Add Movie File Output: Add an output to the session, which manages the output and writes it to disk.
- Connect Input and Output: Connect the input and output with an
AVCaptureConnection
. - Start Running the Session: Commit the configuration and start running the session.
Here is a code snippet to illustrate these steps:
let captureSession = AVCaptureSession()
guard let captureDevice = AVCaptureDevice.default(for: .video) else { return }
let input = try AVCaptureDeviceInput(device: captureDevice)
captureSession.addInput(input)
let output = AVCaptureMovieFileOutput()
captureSession.addOutput(output)
captureSession.startRunning()
To extend this for spatial video recording, you need to:
- Change the AV Capture Device: Use a device that supports spatial video.
- Pick a Supported Video Format: Ensure the video format supports spatial video.
- Enable Spatial Video Recording: Enable spatial video recording on the output.
For more detailed information, you can refer to the session Build compelling spatial photo and video experiences (05:21).
Relevant Sessions

Build compelling spatial photo and video experiences
Learn how to adopt spatial photos and videos in your apps. Explore the different types of stereoscopic media and find out how to capture spatial videos in your iOS app on iPhone 15 Pro. Discover the various ways to detect and present spatial media, including the new QuickLook Preview Application API in visionOS. And take a deep dive into the metadata and stereo concepts that make a photo or video spatial.

Enhance the immersion of media viewing in custom environments
Extend your media viewing experience using Reality Composer Pro components like Docking Region, Reverb, and Virtual Environment Probe. Find out how to further enhance immersion using Reflections, Tint Surroundings Effect, SharePlay, and the Immersive Environment Picker.

Keep colors consistent across captures
Meet the Constant Color API and find out how it can help people use your app to determine precise colors. You’ll learn how to adopt the API, explore its scientific and marketing potential, and discover best practices for making the most of the technology.