On this page

## Type Definitions

### ConnectionState

Connection State

Type:

- 'new' | 'connecting' | 'connected' | 'failed' | 'disconnected' | 'reconnecting' | 'not_support' | 'limit_exceeded'

### CloudMode

Cloud Mode public - Public cloud public_intl - Public cloud (international) private - Private cloud

Type:

- 'public' | 'public_intl' | 'private'

### SDKMode

Service Mode server - Dedicated acceleration mode server2 - Standard acceleration mode

Type:

- 'server' | 'server2'

### MediaType

Media Type

Type:

- 'video' | 'audio'

### RoomState

Room State

Type:

- 'joining' | 'joined' | 'unjoined'

### SignalingState

Signaling State

Type:

- 'new' | 'scheduling' | 'scheduled' | 'connecting' | 'connected' | 'disconnected' | 'closed' | 'reconnecting'

### MqttConnectionState

MQTT Connection State

Type:

- 'new' | 'connecting' | 'connected' | 'reconnecting' | 'error' | 'closed'

### PermissionState

Gateway Device Permission

Type:

- 'master' | 'guest'

### Gateway

Gateway Information

Type:

- object

Properties

Name | Type | Attributes | Description
--- | --- | --- | ---
`deviceId` | string |  | Field device ID. In public cloud mode, format is `${projectId}/${fieldDeviceId}`
`deviceName` | string |  |
`deviceType` | string |  |
`streamCount` | number |  |
`status` | string |  |
`version` | string |  | Gateway SDK version
`licenseExpire` | number | <optional> | License expiration timestamp (seconds)

### OnEventAutoplayResponse

Autoplay Response Type

Type:

- object

Properties

Name | Type | Description
--- | --- | ---
`type` | 'autoplay' |
`data` | object | ###### Properties
Name | Type | Attributes | Description
--- | --- | --- | ---
`code` | number |  | 0 - Success -1 - Failed 20 - MQTT client not found (public cloud only) 21 - MQTT client not connected (public cloud only) 22 - MQTT publish failed (public cloud only) 25 - MQTT sessionId not found (public cloud only)
`message` | string |  |
`fieldDeviceId` | string |  |
`srcUserId` | string |  |
`streamId` | number |  |
`trackId` | string |  |
`mediaType` | MediaType |  |
`videoWidth` | number | <optional> |
`videoHeight` | number | <optional> |

### WebRTCStats

Media Stream Statistics

Type:

- object

Properties

Name | Type | Attributes | Description
--- | --- | --- | ---
`srcUserId` | string |  | Media stream source user ID
`trackId` | string |  | Media stream track ID
`streamId` | number |  | Media stream ID
`mediaType` | MediaType |  | Media type
`bitrate` | number |  | Current bitrate in Mbps
`packetsReceived` | number |  | Total received RTP packets (cumulative)
`packetsLost` | number |  | Total lost RTP packets (cumulative)
`lost` | number |  | Current packet loss rate in %
`lostAvg` | number |  | Average packet loss rate in %
`rtt` | number |  | RTT (Round Trip Time) in ms
`rttAvg` | number |  | Average RTT in ms
`codec` | string |  | Media codec MIME type
`decoderImplementation` | string |  | Decoder identifier
`decoderType` | 'hardware' | 'software' | 'unknown' |  | Decoder type: hardware: Hardware decoder software: Software decoder unknown: Unknown type
`nack` | number |  | Total NACK packets sent (cumulative)
`firCount` | number |  | FIR count
`pliCount` | number |  | PLI count (video only)
`framesReceived` | number |  | Total frames received (cumulative, video only)
`framesDecoded` | number |  | Total frames decoded (cumulative, video only)
`keyFramesDecoded` | number |  | Total key frames decoded (cumulative, video only)
`resolution` | string |  | Resolution in format `${width}x${height}` (video only)
`fps` | number |  | Frame rate (video only)
`decodeTime` | number |  | Current decode time in ms (video only)
`decodeTimeAvg` | number |  | Average decode time in ms (video only)
`processingDelay` | number |  | Current processing delay in ms (video only)
`processingDelayAvg` | number |  | Average processing delay in ms (video only)
`audioLevel` | number |  | Current audio level (0-1, audio only)
`jitter` | number |  | Jitter in seconds
`jitterBuffer` | number |  | Current jitter buffer delay in ms
`jitterBufferAvg` | number |  | Average jitter buffer delay in ms
`jitterBufferTarget` | number |  | Current target jitter buffer delay in ms
`jitterBufferTargetAvg` | number |  | Average target jitter buffer delay in ms
`latency` | number |  | Video latency in ms
`latency1` | number | <optional> |
`latency2` | number | <optional> |
`lag100` | number |  | Video freeze rate at 100ms
`lag150` | number |  | Video freeze rate at 150ms
`nackDelta` | number |  | Period delta: NACK count in current collection period
`firCountDelta` | number |  | Period delta: FIR count in current collection period
`pliCountDelta` | number |  | Period delta: PLI count in current collection period
`framesReceivedDelta` | number |  | Period delta: frames received in current collection period
`framesDecodedDelta` | number |  | Period delta: frames decoded in current collection period
`packetsReceivedDelta` | number |  | Period delta: packets received in current collection period
`packetsLostDelta` | number |  | Period delta: packets lost in current collection period
`stableFps` | number |  | Stable FPS: 10s sliding window average, excluding 0 values (video only)

### DiagnosisReport

Diagnosis Report

Type:

- object

Properties

Name | Type | Attributes | Description
--- | --- | --- | ---
`diag_error` | string |  | Diagnosis error message, returns 'ok' if no error, otherwise error message
`device_id` | string |  | Field device ID
`field_pid` | string | <optional> | Field device process ID
`license_check` | string | <optional> | Field device license check, returns 'ok' if passed, otherwise error message
`field_mqtt_connect` | string | <optional> | Field device MQTT connection status, returns 'ok' if connected, otherwise error message
`remote_mqtt_connect` | string |  | Remote device MQTT connection status, returns 'ok' if connected, otherwise error message
`result` | Array |  | Video stream diagnosis reports
`result[].stream_id` | number |  | Video stream ID
`result[].field` | object | <optional> | Field device video stream diagnosis report ###### Properties
Name | Type | Description
--- | --- | ---
`field_mode` | string | Field device service mode
`signal_connect` | string | Field device signaling connection status, returns 'ok' if connected, otherwise error message
`media_connect` | string | Field device media connection status, returns 'ok' if connected, otherwise error message
`video_transfer` | string | Field device video transfer status, returns 'ok' if normal, otherwise error message
`video_capture` | string | Field device video capture status, returns 'ok' if normal, otherwise error message
`video_encode` | string | Field device video encode status, returns 'ok' if normal, otherwise error message
`rtt` | Array.<number> | Field device RTT statistics in ms, 2-second interval
`lost` | Array.<number> | Field device packet loss rate statistics, 2-second interval
`bps` | Array.<number> | Field device bitrate statistics in kbps, 2-second interval
`fps` | Array.<number> | Field device frame rate statistics, 2-second interval
`result[].remote` | object | <optional> | Remote device video stream diagnosis report ###### Properties
Name | Type | Description
--- | --- | ---
`remote_mode` | string | Remote device service mode
`signal_connect` | string | Remote device signaling connection status, returns 'ok' if connected, otherwise error message
`media_connect` | string | Remote device media connection status, returns 'ok' if connected, otherwise error message
`video_transfer` | string | Remote device video transfer status, returns 'ok' if normal, otherwise error message
`video_decode` | string | Remote device video decode status, returns 'ok' if normal, otherwise error message
`lag_k100` | number | Remote device 100ms freeze rate
`lag_k150` | number | Remote device 150ms freeze rate
`rtt` | Array.<number> | Remote device RTT statistics in ms, 2-second interval
`lost` | Array.<number> | Remote device packet loss rate statistics, 2-second interval
`bps` | Array.<number> | Remote device bitrate statistics in kbps, 2-second interval
`fps` | Array.<number> | Remote device frame rate statistics, 2-second interval
`latency` | Array.<number> | Remote device latency statistics in ms, 2-second interval
`webrtc_stats` | Array.<WebRTCStats> | Remote device complete statistics, 2-second interval

### OnEventWebRTCStatsResponse

WebRTC Stats Callback

Type:

- object

Properties

Name | Type | Description
--- | --- | ---
`type` | 'webrtcStats' |
`data` | Array.<WebRTCStats> |

### OnEventGatewayStatsResponse

Gateway Stats Callback

Each element in the stats array may contain the following fields (subject to change across gateway versions):

- stream: number // Stream ID
- fps: number // Frame rate (fps)
- bps: number // Bitrate (bps)
- rtt: number // RTT (ms)
- jitter: number // Jitter (ms)
- lost: number // Lost packet count
- w: number // Encode width (px)
- h: number // Encode height (px)
- encode_cost: number // Encode cost (ms)

Type:

- object

Properties

Name | Type | Description
--- | --- | ---
`type` | 'gatewayStats' |
`data` | object | ###### Properties
Name | Type | Description
--- | --- | ---
`fieldDeviceId` | string |
`stats` | any |

### OnEventLocalTrackUnpublishedResponse

Local Audio Track Unpublish Callback

Type:

- object

Properties

Name | Type | Description
--- | --- | ---
`type` | 'localTrackUnpublished' |
`data` | Object |

### OnEventResponse

OnEvent Response

Type:

- OnEventAutoplayResponse | OnEventWebRTCStatsResponse | OnEventGatewayStatsResponse | OnEventLocalTrackUnpublishedResponse

Type anything to view search result