---
name: "TranslateContext.startSpeak"
mode: "kit"
versionRequirements:
  - { name: "AIKit", version: "0.0.1" }
platform:
  - "iOS"
  - "Android"
---

## TranslateContext.startSpeak

> [VERSION] AIKit >= 0.0.1

> [PLATFORM] iOS, Android

### Description

Start speaking

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `channel` | `number` | Yes | - | `0.0.1` | Channel: 0 near-end, 1 far-end |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `() => void` | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### 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 |


### Examples

#### Demo

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

ai.startSpeak({
  contextId: "xx",
  channel: 1,
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
