startVideoStreaming(videoformat:audioFormat:onVideoData:onAudioData:onStreamingEvent:)
Starts streaming video with audio using the specified settings, including video and audio format.
func startVideoStreaming(
videoFormat: ViveGlass.VideoStreamingFormat ,
audioFormat: ViveGlass.AudioStreamingFormat,
onVideoData: @escaping (_ sampleBuffer: CMSampleBuffer) -> Void,
onAudioData: @escaping (_ sampleBuffer: CMSampleBuffer) -> Void,
onStreamingEvent: @escaping @Sendable (_ event: ViveGlass.StreamingEvent) -> Void
) async throws -> Int async throws -> Int
Parameters
videoFormat
This specifies the video format used for video streaming.
audioFormat
This specifies the audio format used for video streaming.
onVideoData
This is the function that receives the video data.
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.
Struct
public struct VideoStreamingFormat {
bitrate: Int
frameRate: FrameRate
videoQuality: VideoQuality
highEfficiency: Bool
compressed: Bool
}
Parameters
bitrate
This determines the amount of data processed per unit of time, affecting the overall video quality and file size. The range must be between 200K and 800K.
frameRate
This specifies the frame rate (FPS) for video streaming.
videoQuality
This specifies the resolution of the video taken using the VIVE AI Glasses camera.
highEfficency
Reserved for future used. This specifies whether a high-efficiency video encoder should be used or not.
compressed
This specifies whether the video buffer is compressed.
Struct
public struct AudioStreamingFormat{
audioChannel: AudioChannel
microphone: Microphone
bitRate: Int
sampleRate: 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.
Permissions
Camera and microphone permissions are required before calling startVideoStreaming().
See also
Video streaming
func startVideoStreaming (videoquality:, onVideoData: (_ sampleBuffer: CMSampleBuffer) -> Void, onAudioData: (_ sampleBuffer: CMSampleBuffer) -> Void, onStreamingEvent: (_ event: StreamingEvent) -> Void) async throws
Starts streaming video with audio using the specified basic settings.
func startVideoStreaming (videoquality: audioFormat, onVideoData: (_ sampleBuffer: CMSampleBuffer) -> Void, onAudioData: (_ sampleBuffer: CMSampleBuffer) -> Void, onStreamingEvent: (_ event: StreamingEvent) -> Void) async throws
Starts streaming video with audio using the specified settings, including audio format.
func stopVideoStreaming ()
Stops the video session and releases all associated resources.
func isVideoStreaming () -> Bool
Checks if there is an ongoing video 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 VideoQuality
This defines the resolution for videos taken using the VIVE AI Glasses camera.
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.
enum Framerate
This defines the framerate for videos taken using the VIVE AI Glasses camera.
Error handling and exceptions
enum ViveGlassError
This represents an error thrown by the VIVE AI Glasses SDK.