API reference

Display Class

Extends Sendable
Modifiers: const
Manages rendering content on a Meta Wearables display.
A Display handles the connection to the glasses' display service and provides methods to send views and video to the screen. Create one via DeviceSession/addDisplay(), which targets the device session's device.

Signature

class Display: Sendable

Properties

onPlaybackEvent : (@Sendable (VideoPlaybackEvent) -> Void)?
[Get][Set]
Called when a video playback event is received from the glasses.
state : DisplayState
[Get]
The current session state.
statePublisher : any Announcer<DisplayState>
[Get]
Publishes state changes for this display.

Functions

clearDisplay ()
Clears content currently rendered on the wearable display.
This removes the current display content without stopping the display capability or detaching it from the device session. After a successful clear, the same Display can render new content by calling send(_:).
The clear operation uses the same acknowledgement and error path as normal display content.
Signature
public func clearDisplay()
Throws
send ( view )
Sends a displayable view or video to the connected device.
Signature
public func send(_ view: some DisplayableView)
Parameters
_ view: some DisplayableView  The view or VideoPlayer to display on the glasses.
Throws
sendVideoStop ()
Stops any active video playback on the glasses.
Call this after all video data has been sent but the glasses are still playing, to end playback early and free display resources.
Signature
public func sendVideoStop()
start ()
Starts the display capability, connecting to the device's display service.
Monitors for device availability and automatically connects when a device becomes available. Observe statePublisher for the transition to DisplayState.started, which indicates the display is ready to receive content via send(_:).
Signature
public func start()
stop ()
Requests to stop the display session and release all resources. Observe statePublisher for the transition to DisplayState.stopped.
Closes the display channel and transitions to DisplayState.stopped. After stopping, the display detaches itself from its DeviceSession; call DeviceSession/addDisplay() for a new instance to display again.
Signature
public func stop()