
Camera Streaming
- 5 installs
- 500 repo stars
- Updated August 3, 2026
- facebook/meta-wearables-dat-ios
Implements camera streaming and photo capture on iOS with the DAT SDK using Stream, VideoFrame rendering, and resolution/frame-rate configuration.
About
Shows how to stream camera video and capture photos on iOS via the DAT SDK's Stream and VideoFrame APIs. iOS developers use it to render frames with makeUIImage() and configure resolution, frame rate, and codec.
- Stream, VideoFrame.makeUIImage(), and PhotoData
- StreamConfiguration for resolution/frame rate/codec
Camera Streaming by the numbers
- 5 all-time installs (skills.sh)
- Ranked #828 of 1,039 Mobile Development skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/facebook/meta-wearables-dat-ios --skill camera-streamingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 5 |
|---|---|
| repo stars | ★ 500 |
| Last updated | August 3, 2026 |
| Repository | facebook/meta-wearables-dat-ios ↗ |
What it does
Implements camera streaming and photo capture on iOS with the DAT SDK using Stream, VideoFrame rendering, and resolution/frame-rate configuration.
Files
Camera Streaming (iOS)
Guide for implementing camera streaming and photo capture with the DAT SDK.
Key concepts
- Stream: Main interface for camera streaming
- VideoFrame: Individual video frames — call
.makeUIImage()to render - StreamConfiguration: Configure resolution, frame rate, and codec
- PhotoData: Still image captured from glasses
Creating a DeviceSession
import MWDATCamera
import MWDATCore
let wearables = Wearables.shared
let deviceSelector = AutoDeviceSelector(wearables: wearables)
// Or for a specific device: SpecificDeviceSelector(device: deviceId)
let deviceSession = try wearables.createSession(deviceSelector: deviceSelector)
try deviceSession.start()
// Wait for the device session to reach the started state
for await state in deviceSession.stateStream() {
if state == .started { break }
}Adding a Stream
Once the DeviceSession is started, add a Stream capability:
let config = StreamConfiguration(
videoCodec: .raw,
resolution: .medium, // 504x896
frameRate: 24
)
guard let stream = try deviceSession.addStream(config: config) else {
// DeviceSession must be in the started state before adding a stream
return
}Resolution options
| Resolution | Size |
|---|---|
.high | 720 x 1280 |
.medium | 504 x 896 |
.low | 360 x 640 |
Frame rate options
Valid values: 2, 7, 15, 24, 30 FPS.
Lower resolution and frame rate yield higher visual quality due to less Bluetooth compression.
Observing stream state
StreamState transitions: stopping → stopped → waitingForDevice → starting → streaming → paused
let stateToken = stream.statePublisher.listen { state in
Task { @MainActor in
switch state {
case .streaming:
// Stream is active, frames are flowing
case .waitingForDevice:
// Waiting for glasses to connect
case .stopped:
// Stream ended — release resources
case .paused:
// Temporarily suspended — keep connection, wait
default:
break
}
}
}Receiving video frames
let frameToken = stream.videoFramePublisher.listen { frame in
guard let image = frame.makeUIImage() else { return }
Task { @MainActor in
self.previewImage = image
}
}Starting and stopping
// Start the stream capability
Task { await stream.start() }
// Stop streaming
Task { await stream.stop() }
// Stop the parent device session when you're done with all capabilities
deviceSession.stop()Photo capture
Capture a still photo while streaming:
// Listen for photo data
let photoToken = stream.photoDataPublisher.listen { photoData in
let imageData = photoData.data
// Convert to UIImage or save
}
// Trigger capture
stream.capturePhoto(format: .jpeg)Bandwidth and quality
Resolution and frame rate are constrained by Bluetooth Classic bandwidth. The SDK automatically reduces quality when bandwidth is limited: 1. First lowers resolution (e.g., High → Medium) 2. Then reduces frame rate (e.g., 30 → 24), never below 15 FPS
Request lower settings for higher visual quality per frame.