---
name: "IpcPlayerContext.getVideoInfo"
mode: "api"
versionRequirements:
  - { name: "基础库", version: "2.21.8" }
title: "IpcContext.getVideoInfo - 获取视频信息"
---

## IpcPlayerContext.getVideoInfo

> [VERSION] 基础库 >= 2.21.8

### 描述

获取视频信息

### 参数

`Params`

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `options` | `IpcGetVideoInfoOption` | 否 | 回调配置 |

### 返回值

无


### 引用对象

##### `interface` IpcGetVideoInfoOption

| 属性 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `success` | `(result: IpcVideoInfoResult) => void` | 否 | 接口调用成功的回调函数 |
| `fail` | `(result: IpcFailResult) => void` | 否 | 接口调用失败的回调函数 |
| `complete` | `() => void` | 否 | 接口调用结束的回调函数（调用成功、失败都会执行） |

##### `interface` IpcVideoInfoResult

| 属性 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `width` | `number` | 是 | 视频宽度 |
| `height` | `number` | 是 | 视频高度 |

##### `interface` IpcFailResult

| 属性 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `errorCode` | `string` | 是 | 错误码 |
| `errorMsg` | `string` | 是 | 错误信息 |


### 示例代码

#### 获取视频信息

```ts
const ipcCtx = ty.createIpcPlayerContext('deviceId');
ipcCtx.getVideoInfo({
  success(res) {
    console.log('视频宽度', res.width);
    console.log('视频高度', res.height);
  },
});
```
