This topic describes the TypeScript APIs, events, and data types of AOQ Client SDK for Electron. The SDK supports macOS x64/arm64 and Windows x64 and requires Node.js 16 or later.
aoq-electron-sdk (npm). Supported platforms: macOS (x64 / arm64) and Windows x64. Node.js >= 16.API index
Engine entry points and lifecycle
| API | Description |
|---|---|
| createAoqClientEngine | Get the engine wrapper instance (module-level lazy singleton) |
| createEngine | Create the native engine instance |
| destroy | Destroy the engine instance |
| getVersion | Get the SDK version |
| connect | Connect to the Relay server |
| disconnect | Disconnect from the server |
Audio device management
| API | Description |
|---|---|
| startAudioCapture | Open the audio capture device (microphone) |
| stopAudioCapture | Close the audio capture device |
| muteAudioCapture | Mute or unmute audio capture |
| startAudioPlayer | Start audio rendering (remote audio playback) |
| stopAudioPlayer | Stop audio rendering |
| pauseAudioPlayer | Pause audio rendering, with optional fade-out |
| resumeAudioPlayer | Resume audio rendering, with optional fade-in |
| interruptAudioPlayer | Interrupt the current audio session |
Audio codec configuration
| API | Description |
|---|---|
| setAudioEncoderConfig | Set audio encoding parameters |
| setAudioDecoderConfig | Set audio decoding parameters |
Video device management
| API | Description |
|---|---|
| startVideoCapture | Open the video capture device (camera) |
| stopVideoCapture | Close the video capture device |
Video codec configuration and external input
| API | Description |
|---|---|
| setVideoEncoderConfig | Set video encoding parameters |
| setVideoDecoderConfig | Set video decoding parameters |
| pushExternalVideoCapturedFrame | Push externally captured video frames |
| pushExternalVideoEncodedFrame | Push externally encoded video frames |
Screen capture
| API | Description |
|---|---|
| getScreenSourceList | Get the list of shareable desktops and windows |
| startScreenCapture | Start screen capture |
| stopScreenCapture | Stop screen capture |
Media stream transmission control
| API | Description |
|---|---|
| enableSendMediaStream | Enable or disable local media stream transmission |
Audio file playback
| API | Description |
|---|---|
| startAudioFile | Start playing and publishing a local audio file |
| stopAudioFile | Stop audio file playback |
| pauseAudioFile | Pause audio file playback |
| resumeAudioFile | Resume audio file playback |
| getAudioFileDuration | Get the total duration of the audio file |
| getAudioFileCurrentPosition | Get the current playback position of the audio file |
| setAudioFilePositionMillis | Seek to a position in the audio file |
| setAudioFileVolume | Set the audio file volume |
| getAudioFileVolume | Get the current audio file volume |
External audio streams
| API | Description |
|---|---|
| addAudioExternalStream | Add an external audio stream |
| removeAudioExternalStream | Remove an external audio stream |
| pushAudioExternalStreamData | Push external PCM audio data |
| setAudioExternalStreamVolume | Set the external audio stream volume |
| getAudioExternalStreamVolume | Get the external audio stream volume |
| clearAudioExternalStreamBuffer | Clear the external audio stream buffer |
Real-time messages
| API | Description |
|---|---|
| sendDataMsg | Send a real-time data message |
Audio frame callbacks
| API | Description |
|---|---|
| setAudioFrameObserver | Enable or disable the audio frame observer |
| enableAudioFrameObserver | Enable or disable audio frame callbacks at a specified stage |
Local audio volume indication
| API | Description |
|---|---|
| enableLocalAudioVolumeIndication | Enable or disable local capture volume indication callbacks |
Video frame callbacks
| API | Description |
|---|---|
| setVideoFrameObserver | Enable or disable the video frame observer |
| enableVideoFrameObserver | Enable or disable video frame callbacks at a specified stage |
Video rendering (YUVCanvasRenderer)
| API | Description |
|---|---|
| bind | Bind a canvas element |
| unbind | Unbind the canvas and clear its contents |
| bound | Check whether a canvas is bound |
| drawFrame | Render an I420 video frame |
Engine events (IAoqEngineEvents)
| API | Description |
|---|---|
| onError | Engine error callback |
| onWarning | Engine warning callback |
| onConnectionStatusChange | Connection status change callback |
| onStats | Engine statistics callback |
| onAudioDeviceStateChanged | Audio device operation status change callback |
| onAudioDeviceRouteChanged | Audio output route change callback |
| onAudioFileState | Audio file playback status callback |
| onLocalAudioVolumeIndication | Local capture volume indication callback |
| onVideoDeviceStateChanged | Video device operation status change callback |
| onDataMsg | Received real-time data message callback |
Audio frame events
| API | Description |
|---|---|
| onCapturedAudioFrame | Called when a raw audio frame is captured. The frame contains unprocessed PCM data. |
| onProcessCapturedAudioFrame | Called for an audio frame after 3A processing: acoustic echo cancellation, noise suppression, and automatic gain control. |
| onPublishAudioFrame | Called for an audio frame before publishing. The frame will be encoded and sent to the Relay server. |
| onPlaybackAudioFrame | Called for a remote audio frame before playback. The frame has been decoded but not yet mixed. |
Video frame events
| API | Description |
|---|---|
| onCapturedVideoFrame | Called when a raw video frame is captured, before preprocessing. The frame comes from camera or screen capture and has not been preprocessed. |
| onPreEncodeVideoFrame | Called for a video frame after preprocessing and before encoding. |
| onRemoteVideoFrame | Called for a remote video frame after decoding and before rendering. |
API details
Engine entry points and lifecycle
createAoqClientEngine
Gets the engine wrapper instance. It is a module-level lazily initialized singleton. Calling this method again returns the same instance, which aligns with the singleton semantics of the native engine. It is also the default export of the package.
IAoqClientEngine engine instance. Note that this method creates only the JS wrapper layer and the native bridge. To actually create the engine, you must also call createEngine().
createEngine
Creates the native engine instance. The engine is a global singleton, so calling this method again returns success directly.
Parameters | Type | Description |
|---|---|---|
config | AoqCreateConfig | Engine creation configuration |
0 on success; -1 indicates that the creation failed or that the parameter is not valid JSON.
createEngine() attaches a 16 ms Win32 message pump to the libuv loop of the current JS thread (required for camera capture), and stops it on destroy(). Therefore, do not synchronously block the JS thread for a long time after createEngine().destroy
Destroys the engine instance and releases all resources.
0 indicates success; non-0 indicates a failure. If the engine is not created, 0 is returned.
getVersion
Gets the current SDK version. You do not need to call createEngine() first.
connect
Connects to the relay server. The application server obtains temporary AOQ connection parameters based on the protocol in use and sends them to the client. For more information, see Token authentication.
Parameters | Type | Description |
|---|---|---|
config | AoqConnectConfig | Connection configuration, which includes the token, SID, the list of relay access points, and the lists of publishing and subscribing tracks |
0 indicates that the call is dispatched and runs asynchronously; non-0 indicates that parameter validation failed. The connection result is notified by the onConnectionStatusChange event.
disconnect
Disconnects from the server and releases the resources associated with the connection.
0 indicates that the call is dispatched and runs asynchronously; non-0 indicates a failure.
Audio device management
startAudioCapture
NSMicrophoneUsageDescription in the Info.plist file of the application.
stopAudioCapture
muteAudioCapture
mute=true mutes, and false unmutes.
startAudioPlayer
stopAudioPlayer / pauseAudioPlayer / resumeAudioPlayer
fadeMs: the fade-out or fade-in duration, in milliseconds. 0 indicates immediate execution.
interruptAudioPlayer
Parameters | Type | Description |
|---|---|---|
trackType | AoqTrackType | Track type |
fadeMs | number | Fade-out duration, in milliseconds |
Audio codec configuration
connect(). To use Opus (AoqEncoderTypeAudioOpus), the PluginOpus plug-in must be built into the SDK or distributed with the package.
Video device management
NSCameraUsageDescription in Info.plist. When config.isExternal=true, the camera is not opened, and frames are delivered by pushExternalVideoCapturedFrame.
setLocalView / setRemoteView / switchCamera are not provided. For preview, use the frame observer with YUVCanvasRenderer (see 2.13).Video codec configuration and external input
Parameters | Type | Description |
|---|---|---|
meta | AoqExternalVideoFrameMeta / AoqExternalVideoEncodedFrameMeta | Frame metadata (dimensions, format, and timestamp) |
buffer | Uint8Array | Frame data (pixel data or encoded data) |
pushExternalVideoCapturedFrameconsumes Video frames afterstartVideoCapture({ isExternal: true })and Screen frames afterstartScreenCapture({ isExternal: true }). It returns211when external capture is not enabled and210when the buffer is full.AoqVideoPixelFormatI420and packed formats (NV12 / NV21 / BGRA / RGBA) are supported. For I420,buffermust use a compact layout (stride = width), with the Y / U / V planes concatenated in order.pushExternalVideoEncodedFramerequiressetVideoEncoderConfig({ isExternal: true })first. It returns212when it is not enabled. Only JPEG is currently supported.- When
meta.timeStampis0, the SDK fills it in with the local time.
Screen capture
config specifies screen capture settings. Screen content is sent on the AoqTrackTypeScreen track.
Returns 0 on success or a nonzero value on failure.
Call getScreenSourceList to enumerate screens and windows, then pass the selected sourceId and sourceType in the capture configuration.
For external raw frames, set isExternal=true and supply raw Screen frames through pushExternalVideoCapturedFrame for SDK encoding. For external encoded frames, configure the Screen track for external encoding with setVideoEncoderConfig, then call pushExternalVideoEncodedFrame.
getScreenSourceList
Media stream transmission control
trackType supports AoqTrackTypeAudio, AoqTrackTypeVideo, and AoqTrackTypeScreen.
Specifies whether to send a specific local media stream. We recommend that you call enableSendMediaStream(trackType, false) after initialization and enable sending only after onConnectionStatusChange reports AoqConnectionStatusConnected.
Audio file playback
Parameters | Type | Description |
|---|---|---|
config | AoqAudioFileMixConfig | File mixing configuration. |
fileId | string | File identifier, which is defined by the caller. Subsequent API calls use it to locate the file. |
positionMs | number | Target playback position, in milliseconds |
type | AoqAudioStreamDirection | Publishing volume or local playback volume |
volume | number | Volume. Valid values: 0 to 100. |
getAudioFileDuration/getAudioFileCurrentPositionreturn the number of milliseconds;getAudioFileVolumereturns the current volume;- The getters above return
-1when the engine is not created.
onAudioFileState event.
External audio streams
Parameters | Type | Description |
|---|---|---|
config | AoqAudioExternalStreamConfig | External audio stream configuration. |
streamId | string | Stream identifier, which is defined by the caller |
meta | AoqAudioExternalFrameMeta | PCM frame metadata. |
buffer | Uint8Array | PCM data |
fadeoutMs | number | Fade-out duration when the buffer is cleared, in milliseconds |
pushAudioExternalStreamDatareturns110(external audio buffer is full) when the buffered duration exceedsmaxBufferDuration.getAudioExternalStreamVolumereturns the current volume. It returns-1when the engine is not created.clearAudioExternalStreamBufferhas no return value on the native side and always returns0on a successful call.
Real-time messages
string, it is encoded in UTF-8 into a Buffer internally before it is sent. Messages from the peer are reported through the onDataMsg event callback.
Audio frame callbacks
Parameters | Type | Description |
|---|---|---|
enable | boolean |
|
params | AoqAudioObserverParams | Specify the callback position, on/off state, and callback format |
setAudioFrameObserver(true) to register the observer. Then, call enableAudioFrameObserver for each position that you need. The data is delivered through the corresponding events.
ReadOnly).Local audio volume indication
config.interval <= 0, the callback is disabled. After it is enabled, onLocalAudioVolumeIndication is triggered at the interval specified by config.interval. You must call this method after startAudioCapture() to obtain volume data.
Video frame callbacks
Parameters | Type | Description |
|---|---|---|
enable | boolean |
|
params | AoqVideoObserverParams | Specify the callback position, on/off state, pixel format, and alignment policy |
AoqVideoFrameEvent through onCapturedVideoFrame / onPreEncodeVideoFrame / onRemoteVideoFrame. For I420, buffer is the Y / U / V planes concatenated based on stride. Other packed formats are passed through as the original data. Only read-only mode is supported as well.
Video rendering (YUVCanvasRenderer)
The software renderer built into the SDK.
API | Description |
|---|---|
bind | Bind a canvas (binding again replaces the sink) |
unbind | Unbind and clear the image |
bound | Specifies whether a binding is established |
drawFrame | Draw one frame; only I420 is supported, and the method returns silently for non-I420 formats or when the size or buffer length is insufficient |
object-fit property to control the canvas.
Engine events (IAoqEngineEvents)
The engine inherits from EventEmitter<IAoqEngineEvents>. Events are the unified exit for all asynchronous notifications from the SDK and map one-to-one to the native AoqEngineEventListener callbacks. You do not need to register the events that you do not care about.
onError
code corresponds to an AoqErrorCode value (see 3.3).
onWarning
code corresponds to an AoqWarningCode value (see 3.3).
onConnectionStatusChange
onStats
Parameters | Type | Description |
|---|---|---|
stats | AoqStats | Publishing and subscribing statistics and network statistics for audio, video, and data messages |
onAudioDeviceStateChanged
onAudioDeviceRouteChanged
routeType corresponds to an AoqAudioDeviceRouteType value (see 3.4).
onAudioFileState
onLocalAudioVolumeIndication
enableLocalAudioVolumeIndication.
onVideoDeviceStateChanged
onDataMsg
data is a Buffer copied on the native side and can be safely held asynchronously. For text messages, use Buffer.from(data).toString() to convert the data to a string.
Audio frame events
setAudioFrameObserver(true) and enableAudioFrameObserver to enable it.
onCapturedAudioFrame
Called when a raw audio frame is captured. The frame contains unprocessed PCM data.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameEvent | Captured audio frame data. PCM data is in frame.buffer. |
onProcessCapturedAudioFrame
Called for an audio frame after 3A processing: acoustic echo cancellation, noise suppression, and automatic gain control.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameEvent | Audio frame data after 3A processing. PCM data is in frame.buffer. |
onPublishAudioFrame
Called for an audio frame before publishing. The frame will be encoded and sent to the Relay server.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameEvent | Audio frame data before publishing. PCM data is in frame.buffer. |
onPlaybackAudioFrame
Called for a remote audio frame before playback. The frame has been decoded but not yet mixed.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqAudioFrameEvent | Remote audio frame data before playback. PCM data is in frame.buffer. |
Video frame events
setVideoFrameObserver(true) and enableVideoFrameObserver to enable it. Frame events are read-only. Modifications to buffer in the callback are not written back to the SDK.
onCapturedVideoFrame
Called when a raw video frame is captured, before preprocessing. The frame comes from camera or screen capture and has not been preprocessed.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqVideoFrameEvent | Captured video frame data |
onPreEncodeVideoFrame
Called for a video frame after preprocessing and before encoding.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqVideoFrameEvent | Video frame data before encoding |
onRemoteVideoFrame
Called for a remote video frame after decoding and before rendering.
| Parameter | Type | Description |
|---|---|---|
| frame | AoqVideoFrameEvent | Decoded remote video frame data |
Data types and enumerations
Common types
AoqCreateConfig
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
workDir | string | No | "" | SDK working directory (for logs and temporary files) |
enableDumpAudio | boolean | No | false | Specifies whether to save audio data (for debugging) |
extras | string | No | "" | Extended parameters (a JSON string) |
AoqConnectConfig
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
token | string | Yes | - | Connection authentication token |
sid | string | Yes | - | Session ID |
certFingerprint | string | No | "" | Server certificate fingerprint |
workspaceIdHash | string | No | None | Workspace ID hash. An empty string is equivalent to not passing the parameter. |
relayEndpoints | Array | Yes | - | List of relay access points |
publishTracks | Array | Yes | - | List of local published tracks |
subscribeTracks | Array | Yes | - | List of local subscribed tracks |
AoqRelayEndpoint
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
routeIndex | number | No | -1 | Route index |
endpoint | string | Yes | - | Domain name or IP address of the relay server |
port | number | Yes | - | Port of the relay server |
| tcpPort | number | No | 0 | TCP fallback port. A value of 0 uses the SDK default port, 443. |
AoqTrackParam
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
trackType | AoqTrackType | Yes | - | Track type |
trackMode | AoqTrackMode | No | AoqTrackModeSegment | Streaming or non-streaming mode. Effective only for the audio downlink. |
Statistics types
AoqStats
A summary of engine statistics, which is periodically reported through onStats. An array field is an empty array when it has no data, and networkStats is not delivered when it has no data.
Field | Type | Description |
|---|---|---|
audioPublishStats | Array | Publishing statistics for audio |
videoPublishStats | Array | Publishing statistics for video |
dataMsgPublishStats | Array | Publishing statistics for data messages |
audioSubscribeStats | Array | Subscribing statistics for audio |
videoSubscribeStats | Array | Subscribing statistics for video |
dataMsgSubscribeStats | Array | Subscribing statistics for data messages |
networkStats | AoqNetworkStats | Network statistics |
AoqAudioPublishStats
Field | Type | Description |
|---|---|---|
trackType | AoqTrackType | Track type |
bitrate | number | Bitrate, in bit/s |
bytes | number | Cumulative bytes sent |
encodeVolume | number | Encoding volume of the publishing stream |
AoqAudioSubscribeStats
Field | Type | Description |
|---|---|---|
trackType | AoqTrackType | Track type |
bitrate | number | Bitrate, in bit/s |
bytes | number | Cumulative bytes received |
playVolume | number | Playback volume |
AoqVideoPublishStats
Field | Type | Description |
|---|---|---|
trackType | AoqTrackType | Track type |
bitrate | number | Bitrate, in bit/s |
bytes | number | Cumulative bytes sent |
encodeFps | number | Encoding frame rate |
AoqVideoSubscribeStats
Field | Type | Description |
|---|---|---|
trackType | AoqTrackType | Track type |
bitrate | number | Bitrate, in bit/s |
bytes | number | Cumulative bytes received |
decodeFps | number | Decoding frame rate |
renderFps | number | Rendering frame rate |
AoqDataMsgPublishStats / AoqDataMsgSubscribeStats
Field | Type | Description |
|---|---|---|
trackType | AoqTrackType | Track type |
bitrate | number | Bitrate, in bit/s |
bytes | number | Cumulative bytes sent and received |
AoqNetworkStats
Field | Type | Description |
|---|---|---|
sendBitrate | number | Send bitrate, in bit/s |
sendBytes | number | Cumulative bytes sent |
recvBitrate | number | Receive bitrate, in bit/s |
recvBytes | number | Cumulative bytes received |
loss | number | Packet loss rate, from 0 to 100 |
rtt | number | Round-trip latency, in ms |
Enumerations
AoqTrackType
Enum value | Value | Description |
|---|---|---|
AoqTrackTypeAudio | 0 | Audio track |
AoqTrackTypeVideo | 1 | Video track |
AoqTrackTypeData | 2 | Data message track |
| AoqTrackTypeScreen | 3 | Screen sharing track. Uplink only. |
AoqTrackMode
Enum value | Value | Description |
|---|---|---|
AoqTrackModeSegment | 0 | Segmented: data is packaged and delivered in semantic segments, such as a sentence. |
AoqTrackModeStream | 1 | Streaming: data is delivered continuously. |
AoqEncoderType
Enum value | Value | Description |
|---|---|---|
AoqEncoderTypeUnknown | 0 | Unknown format |
AoqEncoderTypeAudioPCM | 1 | Audio PCM |
AoqEncoderTypeAudioOpus | 2 | Audio Opus (plug-in based; requires PluginOpus) |
AoqEncoderTypeVideoH264 | 3 | Video H.264 |
AoqEncoderTypeVideoJpeg | 4 | Video JPEG |
AoqEncoderTypeDataText | 5 | Message text |
AoqConnectionStatus
Enum value | Value | Description |
|---|---|---|
AoqConnectionStatusDisconnected | 0 | Disconnected |
AoqConnectionStatusConnecting | 1 | Connecting |
AoqConnectionStatusConnected | 2 | Connected |
AoqConnectionStatusFailed | 3 | Connection failed |
AoqMirrorMode
Enum value | Value | Description |
|---|---|---|
AoqMirrorModeDisabled | 0 | Disable mirroring |
AoqMirrorModeEnabled | 1 | Enable mirroring |
AoqOrientationMode
Enum value | Value | Description |
|---|---|---|
AoqOrientationModeAuto | 0 | Auto-fit |
AoqOrientationModePortrait | 1 | Portrait |
AoqOrientationModeLandscape | 2 | Landscape |
AoqErrorCode
The following names are error codes from the underlying C++ engine. The Electron TypeScript API does not export this enum. The code argument of onError is a number.
The error codes are defined at the native layer. The code parameter of onError and the API return values both use these values (the TS layer does not export them as an enum).
Enum value | Value | Description |
|---|---|---|
AoqECOK | 0 | Success |
AoqECParamInvalid | 1 | Invalid parameter |
AoqECStateInvalid | 2 | Invalid state |
AoqECUnSupport | 3 | Not supported on the current platform or in the current mode |
AoqECAudio | 100 | Generic audio error |
AoqECAudioExternalBufferFull | 110 | External audio buffer is full |
AoqECAudioDevice | 120 | Generic audio device error |
AoqECAudioDeviceRecordingAuthFailed | 121 | Recording permission not granted |
AoqECAudioDeviceRecordingOccupied | 122 | Recording device is in use |
AoqECAudioDeviceRecordingBackgroundStart | 123 | Failed to start recording in the background |
AoqECAudioDeviceRecordingStartFail | 124 | Failed to start recording |
AoqECAudioDevicePlayoutOccupied | 125 | Playback device is in use |
AoqECAudioDevicePlayoutBackgroundStart | 126 | Failed to start playback in the background |
AoqECAudioDevicePlayoutStartFail | 127 | Failed to start playback |
AoqECVideo | 200 | Generic video error |
AoqECVideoExternalBufferFull | 210 | External video buffer is full |
AoqECVideoExternalCaptureNotEnabled | 211 | External video capture is not enabled |
AoqECVideoExternalEncoderNotEnabled | 212 | External video encoding is not enabled |
AoqECVideoDevice | 220 | Generic video device error |
AoqECVideoDeviceCameraOpenFail | 221 | Failed to open the camera |
AoqECVideoDeviceCameraAuthFailed | 222 | Camera permission not granted |
AoqECVideoDeviceCameraOccupied | 223 | Camera is in use |
AoqECVideoDeviceCameraRunningError | 224 | Camera runtime exception |
AoqECVideoCodec | 230 | Generic video codec error |
AoqECVideoCodecEncoderInitFail | 231 | Failed to initialize the video encoder |
AoqECVideoRender | 240 | Generic video rendering error |
AoqECVideoRenderCreateFail | 241 | Failed to create video rendering |
AoqECVideoRenderDrawError | 242 | Video rendering drawing error |
| AoqECScreen | 300 | General screen sharing error |
| AoqECScreenAuthFailed | 310 | Screen sharing permission denied |
| AoqECScreenStartFailed | 311 | Failed to start screen sharing |
| AoqECAudioDeviceEarpieceRequiresVoipMode | 128 | The earpiece requires VoIP mode. Applies to mobile platforms and is generally not triggered in Electron. |
-1 when the engine is not created or has been destroyed, or when a parameter is not valid JSON.AoqWarningCode
Enum value | Value | Description |
|---|---|---|
AoqWCOK | 0 | No warning |
AoqWCAudio | 100 | Generic audio warning |
AoqWCAudioHowling | 101 | Audio howling detected |
AoqWCAudioDevice | 120 | Generic audio device warning |
AoqWCAudioDeviceMicEnumerateError | 121 | Microphone enumeration error |
AoqWCAudioDeviceMicStartTimeout | 122 | Microphone startup timed out |
AoqWCAudioDeviceRecordingError | 123 | Error during recording |
AoqWCAudioDeviceSpeakerEnumerateError | 124 | Speaker enumeration error |
AoqWCAudioDeviceSpeakerStartTimeout | 125 | Speaker startup timed out |
AoqWCAudioDevicePlayoutError | 126 | Error during playback |
AoqWCVideo | 200 | Generic video warning |
AoqWCVideoCameraEnumerateError | 201 | Camera enumeration error |
AoqWCVideoEncoderSwitched | 202 | Video encoder switched |
AoqWCVideoRenderDowngrade | 203 | Video rendering downgraded |
Audio types
AoqAudioCaptureConfig
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
isExternal | boolean | No | false | Specifies whether to use external capture mode |
channel | number | No | 1 | Number of audio capture channels. 1 and 2 are supported. |
AoqAudioPlaybackConfig
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
isExternal | boolean | No | false | Specifies whether to use external playback mode |
channel | number | No | 1 | Number of audio playback channels. 1 and 2 are supported. |
AoqAudioCodecConfig
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
trackType | AoqTrackType | No | AoqTrackTypeAudio | Track type |
codecType | AoqEncoderType | No | AoqEncoderTypeAudioOpus | Codec format |
sampleRate | number | No | 48000 | Sample rate, in Hz. For encoding, Opus 8/16/48K and PCM 8/16/32/48K are supported. For decoding, 24K is additionally supported, but only in Segment mode. |
channel | number | No | 1 | Number of channels. 1 and 2 are supported. |
bitrate | number | No | 32000 | Bitrate, in bit/s |
AoqAudioDeviceRouteType
The following table lists the valid routeType values for onAudioDeviceRouteChanged. These values are defined by the native layer and are not exported as an enum by the TypeScript layer.
Enum value | Value | Description |
|---|---|---|
AoqAudioDeviceRouteDefault | 0 | Default route |
AoqAudioDeviceRouteHeadset | 1 | Headphones with a microphone |
AoqAudioDeviceRouteEarpiece | 2 | Receiver |
AoqAudioDeviceRouteHeadsetNoMic | 3 | Headphones without a microphone |
AoqAudioDeviceRouteSpeakerPhone | 4 | Speaker |
AoqAudioDeviceRouteUsb | 5 | USB audio device |
AoqAudioDeviceRouteBluetooth | 6 | Bluetooth SCO mode |
AoqAudioDeviceRouteBluetoothA2dp | 7 | Bluetooth A2DP mode |
AoqAudioDeviceStateCode
Enum value | Value | Description |
|---|---|---|
AoqAudioDeviceNone | 0 | No state |
AoqAudioDeviceRecordStarting | 1 | Capture starting |
AoqAudioDeviceRecordStarted | 2 | Capture started |
AoqAudioDeviceRecordStopping | 3 | Capture stopping |
AoqAudioDeviceRecordStopped | 4 | Capture stopped |
AoqAudioDeviceRecordFail | 5 | Capture failed |
AoqAudioDevicePlayStarting | 6 | Playback starting |
AoqAudioDevicePlayStarted | 7 | Playback started |
AoqAudioDevicePlayStopping | 8 | Playback stopping |
AoqAudioDevicePlayStopped | 9 | Playback stopped |
AoqAudioDevicePlayFail | 10 | Playback failed |
AoqAudioDeviceState
Field | Type | Description |
|---|---|---|
state | AoqAudioDeviceStateCode | Device operation status |
reason | number | Error reason code. See AoqErrorCode. |
Audio file types
AoqAudioFileMixConfig
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
fileId | string | Yes | - | File identifier. Subsequent API calls use it to locate the file. |
fileName | string | Yes | - | File name (including the path) |
cycles | number | No | -1 | Number of loops. -1 indicates unlimited looping. |
startPosMs | number | No | 0 | Start playback position, in milliseconds |
publishVolume | number | No | 100 | Publishing volume. Valid values: 0 to 100. |
playoutVolume | number | No | 100 | Playback volume. Valid values: 0 to 100. |
AoqAudioFileStateCode
Enum value | Value | Description |
|---|---|---|
AoqAudioFileNone | 0 | No state |
AoqAudioFileStarted | 1 | Playback started |
AoqAudioFileStopped | 2 | Playback stopped |
AoqAudioFilePaused | 3 | Playback paused |
AoqAudioFileResumed | 4 | Playback resumed |
AoqAudioFileEnded | 5 | Playback ended |
AoqAudioFileBuffering | 6 | Playback buffering |
AoqAudioFileBufferingEnd | 7 | Buffering ended |
AoqAudioFileFailed | 8 | Playback failed |
AoqAudioFileErrorCode
The following table lists the valid AoqAudioFileState.errorCode values. These values are defined by the native layer and are delivered as number values by the TypeScript layer.
Enum value | Value | Description |
|---|---|---|
AoqAudioFileNoError | 0 | No error |
AoqAudioFileOpenFailed | 1 | Failed to open the file |
AoqAudioFileDecodeFailed | 2 | Failed to decode the file |
AoqAudioFileState
Field | Type | Description |
|---|---|---|
fileId | string | File identifier |
stateCode | AoqAudioFileStateCode | File playback status code |
errorCode | number | File error code. See AoqAudioFileErrorCode. |
External audio stream types
AoqAudioStreamDirection
Enum value | Value | Description |
|---|---|---|
AoqAudioStreamPublish | 0 | Publishing stream |
AoqAudioStreamPlayout | 1 | Playback stream (local playback) |
AoqAudioExternalStreamConfig
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
streamId | string | Yes | - | Stream identifier |
trackType | AoqTrackType | No | AoqTrackTypeAudio | Audio track type |
codecType | AoqEncoderType | No | AoqEncoderTypeAudioPCM | Audio stream format. PCM is currently supported. |
channels | number | No | 1 | Number of channels. It is limited by the codec of the publishing stream. 1 and 2 are supported. |
sampleRate | number | No | 48000 | Sample rate, in Hz. 8, 12, 16, 24, 32, 44.1, 48, 64, 88.2, 96, 176.4, and 192K are supported. |
playoutVolume | number | No | 100 | Playback volume. Valid values: 0 to 100. |
publishVolume | number | No | 100 | Publishing volume. Valid values: 0 to 100. |
maxBufferDuration | number | No | 600000 | Maximum buffer duration, in milliseconds. Valid values: 100 and above. If the duration exceeds this value, push fails. |
enable3A | boolean | No | false | Specifies whether to apply 3A processing to the input PCM |
AoqAudioExternalFrameMeta
Metadata of an external audio frame. The PCM data is passed separately through the buffer parameter.
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
streamId | string | Yes | - | Identifier of the target external audio stream |
numOfSamples | number | Yes | 0 | Number of samples (per channel) |
bytesPerSample | number | Yes | 2 | Bytes per sample |
numOfChannels | number | Yes | 1 | Number of channels |
samplesPerSec | number | Yes | 48000 | Number of samples per second (sample rate) |
pushSequence | number | No | 0 | PCM input round |
timeStamp | number | No | 0 | Timestamp |
AoqAudioFrameEvent
Event data of the audio frame observer.
Field | Type | Description |
|---|---|---|
trackType | AoqTrackType | Track type |
numOfSamples | number | Number of samples (per channel) |
bytesPerSample | number | Bytes per sample |
numOfChannels | number | Number of channels |
samplesPerSec | number | Number of samples per second (sample rate) |
timeStamp | number | Timestamp |
autoGenMute | boolean | true indicates silent data generated by the SDK |
buffer | Uint8Array | Audio PCM data (already copied on the native side) |
AoqAudioSource
Enum value | Value | Description |
|---|---|---|
AoqAudioSourceCaptured | 0 | Captured audio data |
AoqAudioSourceProcessCaptured | 1 | Audio data after 3A processing |
AoqAudioSourcePublish | 2 | Audio data to be published (requires a successful connect) |
AoqAudioSourcePlayback | 3 | Audio data to be played |
AoqAudioObserverParams
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
enabled | boolean | Yes | false | Enable or disable the callback at this position |
audioSource | AoqAudioSource | Yes | AoqAudioSourceCaptured | Callback position |
sampleRate | number | No | 48000 | Sample rate of the callback audio, in Hz. Resampling is performed if the rates do not match. |
channels | number | No | 1 | Number of audio channels in the callback. 1 and 2 are supported. |
AoqAudioVolumeIndicationConfig
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
interval | number | No | 0 | Callback interval, in milliseconds. A value less than or equal to 0 disables the callback. A value greater than 0 and less than 10 is treated as 10. |
smooth | number | No | 3 | Volume smoothing coefficient. A larger value results in smoother output. Valid values: 0 to 10. |
AoqAudioVolume
Field | Type | Description |
|---|---|---|
volume | number | Smoothed instantaneous volume. Valid values: 0 to 255. |
Video types
AoqVideoCaptureConfig
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
width | number | No | 1280 | Capture width, in pixels. This parameter is ineffective when isExternal=true. |
height | number | No | 720 | Capture height, in pixels. This parameter is ineffective when isExternal=true. |
fps | number | No | 15 | Capture frame rate. This parameter is ineffective when isExternal=true (the pace is determined by frame delivery). |
isExternal | boolean | No | false | Specifies whether to use external capture. If it is true, the camera is not opened. |
AoqVideoCodecConfig
Encoding and decoding share the same structure (setVideoEncoderConfig / setVideoDecoderConfig).
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
isExternal | boolean | No | false | When this parameter is true, the SDK does not perform capture or encoding, and frames are pushed directly by pushExternalVideoEncodedFrame. |
trackType | AoqTrackType | No | AoqTrackTypeVideo | Track type |
codecType | AoqEncoderType | No | AoqEncoderTypeVideoH264 | Codec format |
width | number | No | 540 | Encoding width, in pixels |
height | number | No | 960 | Encoding height, in pixels |
fps | number | No | 5 | Encoding frame rate |
bitrate | number | No | 500000 | Initial bitrate, in bit/s |
minBitrate | number | No | 128000 | Minimum bitrate, in bit/s |
keyframeInterval | number | No | 2 | Keyframe interval, in seconds |
mirrorMode | AoqMirrorMode | No | AoqMirrorModeDisabled | Mirror mode |
orientationMode | AoqOrientationMode | No | AoqOrientationModeAuto | Video orientation mode |
AoqVideoPixelFormat
Pixel formats supported by Electron.
Enum value | Value | Description |
|---|---|---|
AoqVideoPixelFormatUnknown | 0 | Unknown format |
AoqVideoPixelFormatI420 | 1 | I420 (YUV planar format) |
AoqVideoPixelFormatNV12 | 2 | NV12 (YUV semi-planar format) |
AoqVideoPixelFormatNV21 | 3 | NV21 (YUV semi-planar format) |
AoqVideoPixelFormatBGRA | 4 | BGRA (32-bit) |
AoqVideoPixelFormatRGBA | 5 | RGBA (32-bit) |
AoqExternalVideoFrameMeta
Metadata of an external raw video frame. The pixel data is passed separately through the buffer parameter.
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
trackType | AoqTrackType | No | AoqTrackTypeVideo | Track type ; supports Video / Screen routing |
format | AoqVideoPixelFormat | Yes | - | Pixel format |
width | number | Yes | - | Video width, in pixels |
height | number | Yes | - | Video height, in pixels |
timeStamp | number | No | 0 | Timestamp, in milliseconds. If it is 0, the SDK fills it in with the local time. |
format = I420, buffer must use a compact layout (stride = width), with the Y / U / V planes concatenated in order. For other packed formats, pass the entire frame bytes directly.AoqVideoCodecType
Enum value | Value | Description |
|---|---|---|
AoqVideoCodecTypeJPEG | 0 | JPEG encoding |
AoqExternalVideoEncodedFrameMeta
Metadata of an externally encoded video frame. The encoded data is passed separately through the buffer parameter.
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
trackType | AoqTrackType | No | AoqTrackTypeVideo | Track type ; supports Video / Screen routing |
codec | AoqVideoCodecType | No | AoqVideoCodecTypeJPEG | Codec format |
width | number | Yes | - | Width, in pixels |
height | number | Yes | - | Height, in pixels |
timeStamp | number | No | 0 | Timestamp, in milliseconds. If it is 0, the SDK fills it in with the local time. |
AoqVideoDeviceStateCode
Enum value | Value | Description |
|---|---|---|
AoqVideoDeviceNone | 0 | No state |
AoqVideoDeviceCaptureStarting | 1 | Capture starting |
AoqVideoDeviceCaptureStarted | 2 | Capture started |
AoqVideoDeviceCaptureStopping | 3 | Capture stopping |
AoqVideoDeviceCaptureStopped | 4 | Capture stopped |
AoqVideoDeviceCaptureFail | 5 | Capture failed (for example, permission denied or the device is unavailable) |
AoqVideoDeviceState
Field | Type | Description |
|---|---|---|
state | AoqVideoDeviceStateCode | Device capture operation status |
reason | number | Error reason code. See AoqErrorCode. |
AoqScreenShareSourceType
| Value | Number | Description |
|---|---|---|
| AoqScreenShareSourceTypeDesktop | 0 | Entire desktop |
| AoqScreenShareSourceTypeWindow | 1 | A specific window |
AoqScreenSourceInfo
| Field | Type | Description |
|---|---|---|
| sourceType | AoqScreenShareSourceType | Source type |
| sourceId | string | Source ID; returned as a string to preserve int64 precision. |
| sourceName | string | Source name |
| sourceIsSelf | boolean | Whether the window belongs to the current process |
AoqScreenCaptureConfig
All fields are optional. isExternal defaults to false.
| Field | Type | Default | Description |
|---|---|---|---|
| isExternal | boolean | false | Whether the application supplies raw screen frames. |
| sourceId | string | number | — | Screen source ID. Optional. Use a string; numbers must be safe integers. |
| sourceType | AoqScreenShareSourceType | — | Screen source type. |
AoqErrorCode, which is a native error-code reference and is not exported by TypeScript, the types in this section are exported from the package root, so you can directly use import { ... } from 'aoq-electron-sdk'. Exported enumerations are TypeScript enum types and are available at runtime, whereas interfaces (interface) are type constraints only. If a field marked as optional is not specified, the default value in the table is used.
Video frame callback types
AoqVideoSource
Enum value | Value | Description |
|---|---|---|
AoqVideoSourceCaptured | 0 | Captured video data before preprocessing |
AoqVideoSourcePreEncode | 1 | Video data before encoding, after preprocessing |
AoqVideoSourceRemote | 2 | Remote video data after decoding and before rendering |
AoqVideoObserverAlignment
Enum value | Value | Description |
|---|---|---|
AoqVideoObserverAlignmentDefault | 0 | Default alignment |
AoqVideoObserverAlignmentEven | 1 | Even-number alignment |
AoqVideoObserverAlignment4 | 2 | 4-byte alignment |
AoqVideoObserverAlignment8 | 3 | 8-byte alignment |
AoqVideoObserverAlignment16 | 4 | 16-byte alignment |
AoqVideoObserverParams
Field | Type | Required | Default value | Description |
|---|---|---|---|---|
enabled | boolean | Yes | false | Enable or disable the callback at this position |
videoSource | AoqVideoSource | Yes | AoqVideoSourceCaptured | Callback position |
format | AoqVideoPixelFormat | No | AoqVideoPixelFormatI420 | Expected pixel format of the callback data |
alignment | AoqVideoObserverAlignment | No | AoqVideoObserverAlignmentDefault | Width alignment policy |
mirrorApplied | boolean | No | false | Specifies whether to mirror the callback data |
| trackType | AoqTrackType | No | AoqTrackTypeVideo | Video track to observe. Supports Video and Screen only. |
YUVCanvasRenderer for rendering.AoqVideoFrameEvent
Event data of the video frame observer.
Field | Type | Description |
|---|---|---|
trackType | AoqTrackType | Track type |
format | AoqVideoPixelFormat | Pixel format |
width | number | Width, in pixels |
height | number | Height, in pixels |
strideY | number | Stride of the Y plane (effective only for I420) |
strideU | number | Stride of the U plane (effective only for I420) |
strideV | number | Stride of the V plane (effective only for I420) |
timeStamp | number | Timestamp, in milliseconds |
buffer | Uint8Array | Frame data. For I420, it is the Y / U / V planes concatenated based on stride. Other packed formats are passed through as the original data. |
Data message types
Electron does not use the AoqDataMsg wrapper type. Data messages are sent and received directly as binary data:
Direction | Type | Description |
|---|---|---|
Send | Uint8Array or string |
|
Receive | Uint8Array |
|