---
name: "createIpcPlayerContext"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "ty.createIpcPlayerContext - 创建 IPC 播放器上下文"
---

## createIpcPlayerContext

> [VERSION] Base Library >= 2.21.8

> 💡 The returned IpcContext is bound to an ipc-player component via the device ID, and supports preview, two-way talk, recording, snapshots, and more.

### Description

Create an IPC player context (IpcContext) object

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `deviceId` | `string` | Yes | IPC device ID |

### Return Value

Type: `IpcContext`

IpcContext instance

### Examples

#### Create IPC context

```ts
Page({
  onReady() {
    const ipcCtx = ty.createIpcPlayerContext('deviceId');
    ipcCtx.connect({
      success() {
        ipcCtx.startPreview();
      },
    });
  },
});
```
