SDK Callback Overview
Cloud Phone Callbacks (SessionObserver)
| Interface Name | Description |
|---|---|
| onConnected | Network connection successful |
| onDisconnected | Network disconnected |
| onClose | Remote end closed connection |
| onScreenChange | Received cloud phone width, height, rotation change |
| onClipboardMessage | Received clipboard data from cloud phone instance |
| onFirstVideoFrame | First video frame after subscribing to stream |
| onLocalScreenshot | Video frame callback after screenshot(true) |
| onNetworkQuality | Current network quality callback |
| onIdeTimeout | Idle timeout for current cloud phone instance |
| onError | Cloud phone error callback |
| onCameraChanged | Cloud phone camera state change callback |
Video Frame Callbacks (VideoRenderSink)
| Interface Name | Description |
|---|---|
| onFrame | Video frame callback |
Batch Streaming Callbacks (BatchControlObserver)
| Interface Name | Description |
|---|---|
| onBatchPodStartResult | Batch streaming result callback |
| onError | Batch streaming error callback |
Video Frame (VideoFrame)
| Interface Name | Description |
|---|---|
| width | Video frame width in pixels |
| height | Video frame height in pixels |
| rotation | Video frame rotation (0°, 90°, 180°, 270°) |
| buffer | Video frame raw data pointer |
| size | Video frame data size in bytes |
Cloud Phone Callbacks (SessionObserver)
| Interface Name | Description |
|---|---|
| onConnected | Network connection successful |
| onDisconnected | Network disconnected |
| onClose | Remote end closed connection |
| onScreenChange | Received cloud phone width, height, rotation change |
| onClipboardMessage | Received clipboard data from cloud phone instance |
| onFirstVideoFrame | First video frame after subscribing to stream |
| onLocalScreenshot | Video frame callback after screenshot(true) |
| onNetworkQuality | Current network quality callback |
| onIdeTimeout | Idle timeout for current cloud phone instance |
| onError | Cloud phone error callback |
| onCameraChanged | Cloud phone camera state change callback |
Video Frame Callbacks (VideoRenderSink)
| Interface Name | Description |
|---|---|
| onFrame | Video frame callback |
Batch Streaming Callbacks (BatchControlObserver)
| Interface Name | Description |
|---|---|
| onBatchPodStartResult | Batch streaming result callback |
| onError | Batch streaming error callback |
Video Frame (VideoFrame)
| Interface Name | Description |
|---|---|
| width | Video frame width in pixels |
| height | Video frame height in pixels |
| rotation | Video frame rotation (0°, 90°, 180°, 270°) |
| buffer | Video frame raw data pointer |
| size | Video frame data size in bytes |
SDK Callback Details
Connection Success Callback
Description: Network connection successful
Signature:
void onConnected();
Disconnection Callback
Description: Network disconnected
Signature:
void onDisconnected();
Connection Close Callback
Description: Remote end closed connection
Signature:
void onClose();
Resolution Change Callback
Description: Received cloud phone width/height change
Signature:
void onScreenChange(int width, int height, int rotation);
Parameters:
| Parameter | Type | Description |
|---|---|---|
| width | int | Cloud phone width |
| height | int | Cloud phone height |
| rotation | int | Cloud phone rotation angle |
Clipboard Callback
Description: Received clipboard data from cloud phone instance
Signature:
void onClipboardMessage(const std::string& text);
Parameters:
| Parameter | Type | Description |
|---|---|---|
| text | string | Cloud phone clipboard text (UTF-8 encoded) |
First Video Frame Callback
Description: First frame callback after starting cloud phone instance and subscribing to video stream
Signature:
void onFirstVideoFrame();
Local Screenshot Callback
Description: Video frame callback after calling screenshot(true)
Signature:
void onLocalScreenshot(std::shared_ptr<VideoFrame>& frame);
Parameters:
| Parameter | Type | Description |
|---|---|---|
| frame | std::shared_ptr<VideoFrame> | Video frame data (see VideoFrame) |
Network Quality Callback
Description: Current network quality callback
Signature:
void onNetworkQuality(int rtt);
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rtt | int | Network latency (ms) |
Idle Timeout Callback
Description: Idle timeout for current cloud phone instance
Signature:
void onIdeTimeout();
Cloud Phone Error Callback
Description: Cloud phone instance error callback
Signature:
void onError(int error, const std::string& msg);
Parameters:
| Parameter | Type | Description |
|---|---|---|
| error | int | Error code |
| msg | string | Error description |
Camera State Callback
Description: Cloud phone camera state change callback
Signature:
void onCameraChanged(bool isFront, bool isOpen);
Parameters:
| Parameter | Type | Description |
|---|---|---|
| isFront | bool | Whether front camera |
| isOpen | bool | Whether open |
Video Frame Callback
Description: Real-time video frame callback
Signature:
void onFrame(std::shared_ptr<VideoFrame>& frame);
Parameters:
| Parameter | Type | Description |
|---|---|---|
| frame | std::shared_ptr<VideoFrame> | Video frame data (see VideoFrame) |
Batch Streaming Result Callback
Description: Batch streaming start result callback
Signature:
void onBatchPodStartResult(int error, const std::string& msg, const std::vector<std::string>& podList);
Parameters:
| Parameter | Type | Description |
|---|---|---|
| error | int | Batch streaming result |
| msg | string | Batch streaming error message |
| podList | std::vectorstd::string | List of cloud phones in batch |
Batch Streaming Error Callback
Description: Error callback during batch streaming
Signature:
void onError(int error, const std::string& msg);
Parameters:
| Parameter | Type | Description |
|---|---|---|
| error | int | Batch streaming result |
| msg | string | Batch streaming error message |
VideoFrame Interface
Video Frame Width
Description: Get video frame width (pixels)
Signature:
uint32_t width();
Video Frame Height
Description: Get video frame height (pixels)
Signature:
uint32_t height();
Video Frame Rotation
Description: Get video frame rotation angle (0°, 90°, 180°, 270°)
Signature:
uint32_t rotation();
Video Frame Buffer
Description: Get raw video frame data pointer
Signature:
uint8_t* buffer();
Video Frame Size
Description: Get video frame data size (bytes)
Signature:
uint32_t size();