---
name: "createVideoContext"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "ty.createVideoContext - 创建 video 上下文 VideoContext 对象"
---

## createVideoContext

> [VERSION] Base Library >= 2.21.8

> 💡 The returned VideoContext is bound to a video component via the ID and operates that video component.

### Description

Create a video context (VideoContext) object

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | ID of the video component |

### Return Value

Type: `VideoContext`

VideoContext instance

### Examples

#### Create video context

```ts
Page({
  onReady() {
    const videoCtx = ty.createVideoContext('myVideo');
    videoCtx.play();
  },
});
```
