ViveGlass
This object provides a unified interface for managing connections and interactions with VIVE AI Glasses.
Overview
You can use the object for any of the following:
•
Device connection
: Register and establish a secure connection with VIVE AI Glasses.
•
Voice interaction
: Interact with users though text-to-speech (TTS) or transcribe user speech into text through speech-to-text (STT).
•
Audio input:
Record high-quality audio directly from the VIVE AI Glasses microphones.
•
Image input
: Capture high-resolution images and videos using the VIVE AI Glasses camera.
Topics
Connectivity and authentication
func connect () throws
Initiates a connection with VIVE AI Glasses.
func disconnect ()
Requests to disconnect from VIVE AI Glasses.
func isConnected () -> Bool
Checks the current connection status.
Text to speech (TTS)
func speakText (text: String, locale: Locale) async throws -> Int
Converts provided text into spoken audio output.
Speech to text (STT)
func startTranscription (bContinuous: Bool) async throws -> Int
Converts spoken audio input into text.
func stopTranscription ()
Ends the active speech-to-text session.
Audio streaming
func startAudioStreaming (microphone: Microphone, bitrate: Int, sampleRate: Int, channelCount: AudioChannel, onAudioData: (_ sampleBuffer: CMSampleBuffer) -> Void, onStreamingEvent: (_ event: StreamingEvent) -> Void) async throws ->Int
Starts streaming audio using the specified settings.
func stopAudioStreaming ()
Stops the audio session and releases all associated resources.
func isAudioStreaming () -> Bool
Checks if there is an ongoing audio session.
Image capture
func captureImage (quality: ImageQuality) async throws ->Int
Captures a single image with the specified quality settings.
Video streaming
func startVideoStreaming (videoquality: VideoQuality, onVideoData: (_ sampleBuffer: CMSampleBuffer) -> Void, onAudioData: (_ sampleBuffer: CMSampleBuffer) -> Void, onStreamingEvent: (_ event: StreamingEvent) -> Void) async throws ->Int
Starts streaming video with audio using the specified settings.
func stopVideoStreaming ()
Stops the video session and releases all associated resources.
func isVideoStreaming () -> Bool
Checks if there is an ongoing video session.
Query info
func getUserPreferredLocale () async throws -> Locale
Retrieves the language settings from VIVE Connect.
Error handling and exceptions
enum ViveGlassError
This represents an error thrown by the VIVE AI Glasses SDK.