---
name: "VideoContext"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "VideoContext"
---

## VideoContext

> [VERSION] Base Library >= 2.21.8

> 💡 NativeVideoContext is bound by id to a native video component and operates that video component. It uses separate-layer rendering for better performance on native.

### Description

NativeVideoContext instance, obtainable via ty.createNativeVideoContext

### Parameters

None


### Return Value

Type: `VideoContext`

VideoContext instance

#### Methods

| Method | Description |
| --- | --- |
| `play` | Play video |
| `pause` | Pause video |
| `stop` | Stop video |
| `playbackRate` | Set playback speed |
| `seek` | Seek to a specified position |
| `sendDanmu` | Send bullet comments |

### Examples

#### Basic usage

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