Start a camera stream

Updated: Nov 13, 2026

Overview

You can create a stream by adding it to an existing DeviceSession (iOS, Android), and observe its state and display frames.

Framerate and resolution

You can request resolution and frame rate control using StreamConfiguration (iOS, Android). Valid frameRate values are 2, 7, 15, 24, or 30 FPS.
For iOS, resolution can be set to:
  • high: 720 x 1280 pixels
  • medium: 504 x 896 pixels
  • low: 360 x 640 pixels
For Android, videoQuality can be set to:
  • HIGH: 720 x 1280 pixels
  • MEDIUM: 504 x 896 pixels
  • LOW: 360 x 640 pixels
Resolution and frame rate are constrained by the Bluetooth Classic connection between the user’s phone and their AI glasses. To manage limited bandwidth, an automatic ladder reduces quality as needed. It first lowers the resolution by one step (for example, from high to medium for iOS, or from HIGH to MEDIUM for Android). If bandwidth remains constrained, it then reduces the frame rate (for example, 30 to 24), but never below 15 fps.
The image delivered to your app may appear lower quality than expected, even when the resolution reports high/HIGH or medium/MEDIUM. This is due to per‑frame compression that adapts to available Bluetooth Classic bandwidth. Requesting a lower resolution, a lower frame rate, or both can yield higher visual quality with less compression loss.
See Camera stream processing for how the glasses process each frame and how that affects field of view, frame size, camera calibration, and alignment with motion data.

iOS

StreamState transitions through stopping, stopped, waitingForDevice, starting, streaming, and paused.
Register callbacks to collect frames and state events.
let config = StreamConfiguration(
  videoCodec: VideoCodec.raw,
  resolution: StreamingResolution.low,
  frameRate: 24)
guard let camera = try session.addCamera(config: config) else { return }
let stream = camera.stream

let stateToken = stream.statePublisher.listen { state in
  Task { @MainActor in
    // Update your streaming UI state
  }
}

let frameToken = stream.videoFramePublisher.listen { frame in
  guard let image = frame.makeUIImage() else { return }
  Task { @MainActor in
    // Render the frame in your preview surface
  }
}

stream.start()

Capture and share photos from streaming for iOS

Listen for photoDataPublisher events, store the token in the tokenBag, and handle the returned PhotoData. Then, while the stream is active, call capturePhoto.
stream.photoDataPublisher.listen { [weak self] photoData in
  Task { @MainActor in
    // Convert to UIImage or hand off to your storage layer
    self?.handlePhotoData(photoData)
  }
}.store(in: tokenBag)

stream.capturePhoto(format: .jpeg)
Note: Camera permissions are required for streaming. See Manage camera permissions for details. See details on permission flows in Permissions and registration.

Android

StreamState transitions through STARTING, STARTED, STREAMING, PAUSED, STOPPING, STOPPED, and CLOSED.
Register callbacks to collect frames and state events.
fun start(deviceId: DeviceIdentifier) {
    val config = StreamConfiguration(videoQuality = VideoQuality.MEDIUM, frameRate = 24)
    session.addCamera(config).fold(
        onSuccess = { camera ->
            val stream = camera.stream
            scope.launch {
                stream.videoStream.collect { frame ->
                    displayFrame(frame)
                }
            }

            scope.launch {
                stream.state.collect { state ->
                    updateStreamUi(state)
                    if (state == StreamState.STOPPED) {
                        stopStream()
                    }
                }
            }

            stream.start()
        },
        onFailure = { error, _ ->
            showError(error.description)
        },
    )
}

Capture and share photos from streaming for Android

While the stream is active, call capturePhoto from a coroutine and handle the returned PhotoData.
scope.launch {
    stream.capturePhoto()
        .onSuccess { data ->
            ...
        }
        .onFailure(onError)
}
To share cached images with other apps, declare a FileProvider in your app’s AndroidManifest.xml:
<application ...>
    <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="${applicationId}.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths" />
    </provider>
</application>
Then list the shared directory in app/src/main/res/xml/file_paths.xml:
<paths>
    <cache-path name="shared_images" path="images/" />
</paths>
Save each photo under cacheDir/images/, then get a shareable URI with FileProvider.getUriForFile(context, "${context.packageName}.fileprovider", file).
Note: Camera permissions are required for streaming. See Manage camera permissions for details. See details on permission flows in Permissions and registration.