---
name: "getTranslateRealTimeResult"
mode: "kit"
versionRequirements:
  - { name: "AIKit", version: "0.0.1" }
  - { name: "@ray-js/ray", version: "1.6.29" }
platform:
  - "iOS"
  - "Android"
async: true
title: "getTranslateRealTimeResult"
---

## getTranslateRealTimeResult

> [VERSION] AIKit >= 0.0.1 | @ray-js/ray >= 1.6.29

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Get real-time translation data

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `translateId` | `string` | Yes | - | `0.0.1` | Translation record ID |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `list` | `TranslateRealTimeResult[]` | `0.0.1` | Real-time transcription data list |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Referenced Types

##### `interface` TranslateRealTimeResult

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `asrId` | `number` | `0.0.1` | Speech recognition unique identifier |
| `translateId` | `number` | `0.0.1` | Translation record ID |
| `requestId` | `string` | `0.0.1` | Unique identifier for this recording |
| `recordId` | `string` | `0.0.1` | Translation AI recognition unique identifier ID |
| `beginTime` | `number` | `0.0.1` | Audio start time, in milliseconds |
| `endTime` | `number` | `0.0.1` | Audio end time, in milliseconds |
| `text` | `string` | `0.0.1` | Translated text |
| `asr` | `string` | `0.0.1` | Recognized text |
| `channel` | `number` | `0.0.1` | Channel |


### Examples

#### Basic usage

```tsx
import { ai } from '@ray-js/ray'

const { getTranslateRealTimeResult } = ai;

getTranslateRealTimeResult({
  translateId: 'example',
  success: (result) => {
    console.log('getTranslateRealTimeResult success', result);
  },
  fail: (error) => {
    console.log('getTranslateRealTimeResult fail', error.errorMsg);
  },
});
```
