Please Select Your Location
Australia
Österreich
België
Canada
Canada - Français
中国
Česká republika
Denmark
Deutschland
France
HongKong
Iceland
Ireland
Italia
日本
Korea
Latvija
Lietuva
Lëtzebuerg
Malta
المملكة العربية السعودية (Arabic)
Nederland
New Zealand
Norge
Polska
Portugal
Russia
Saudi Arabia
Southeast Asia
España
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
Please Select Your Location
België
Česká republika
Denmark
Iceland
Ireland
Italia
Latvija
Lietuva
Lëtzebuerg
Malta
Nederland
Norge
Polska
Portugal
España
Suisse
Suomi
Sverige

startAudioStreaming(microphone:bitrate:sampleRate:channelCount:onAudioData:onStreamingEvent:)

Starts streaming audio using the specified settings.

func startAudioStreaming(

microphone: Microphone,
bitrate: Int,
sampleRate: Int,
channelCount: AudioChannel,
onAudioData: @escaping (_ sampleBuffer: CMSampleBuffer) -> Void,
onStreamingEvent: @escaping (_ event: StreamingEvent) -> Void

) async throws -> Int


Parameters

microphone

This specifies the directional pickup pattern of the microphone.

bitrate

This determines the amount of data processed per unit of time, affecting the overall audio quality and file size.

sampleRate

This specifies the number of audio samples captured per second.

channelCount

This specifies the number of audio channels.

onAudioData

This is the function that receives the audio data.

onStreamingEvent

This is the function that receives the streaming event.

Return value

0 if function calling is successful; otherwise, -1 .

Exception

The following exceptions may be thrown: ViveGlassError.UnregisteredAppException, ViveGlassError.GlassesPermissionDeniedException.


Permissions

Microphone permission is required before calling startAudioStreaming().


See also

Audio streaming

func stopAudioStreaming ()

Stops the audio session and releases all associated resources.

func isAudioStreaming () -> Bool

Checks if there is an ongoing audio session.

Permissions

func requestPermission()

Requests permission to access VIVE AI Glasses resources.

func checkPermission()

Checks if the app has been granted the required permissions.

Enumerations

enum AudioChannel

This defines the number of audio channels.

enum Microphone

This defines the directional pickup pattern of the microphone.

enum StreamingEvent

This defines the lifecycle state of a media stream.

enum Permission

This defines the permission that the app is requesting.

enum PermissionResult

This indicates the result of the permission request.

Error handling and exceptions

enum ViveGlassError

This represents an error thrown by the VIVE AI Glasses SDK.