API reference

Stream Class

Extends Sendable
Modifiers: const
A class for managing media streaming capabilities with Meta Wearables devices. Handles video streaming, photo capture, and provides real-time state updates.
In Swift, create a Stream by first creating and starting a DeviceSession, then calling DeviceSession/addStream(config:). The returned stream is attached to that device session and stops automatically when the parent device session stops.

Signature

class Stream: Sendable

Properties

errorPublisher : any Announcer<StreamError>
[Get]
Publisher for errors that occur during the streaming session.
photoDataPublisher : any Announcer<PhotoData>
[Get]
Publisher for photo data captured during the streaming session.
state : StreamState
[Get]
The current state of the streaming session.
statePublisher : any Announcer<StreamState>
[Get]
Publisher for streaming session state changes.
streamConfiguration : StreamConfiguration
The configuration used for this streaming session.
videoFramePublisher : any Announcer<VideoFrame>
[Get]
Publisher for video frames received from the streaming session.

Functions

capturePhoto ( format )
Captures a still photo during streaming.
Triggers a photo capture while video streaming is active. The captured photo is delivered through photoDataPublisher. Video streaming is temporarily paused during capture and automatically resumes after photo delivery.
Signature
public func capturePhoto( format: PhotoCaptureFormat) -> Bool
Parameters
format: PhotoCaptureFormat  The desired image format.
Returns
Bool true if the capture request was accepted, false if no device session is active, a capture is already in progress, or the underlying capture request fails.
start ()
Starts video streaming from the device.
Begins streaming video frames from the currently available device. If no device is currently available, the session enters .waitingForDevice state and automatically connects when a device becomes available. Video frames are delivered through videoFramePublisher.
State transitions: .stopped -> .waitingForDevice (no device) or .stopped -> .starting -> .streaming (with device).
The session monitors for device availability and automatically connects when a device becomes available and publishes errors if the device is invalid. The session automatically stops when an error occurs or when the device session ends externally (e.g., device powered off).
Signature
public func start()
stop ()
Stops video streaming and releases all resources.
Shuts down the streaming pipeline and transitions to .stopped state.
State transitions: Any state -> .stopping -> .stopped
Signature
public func stop()