---
title: 初始化并注册触控引擎接口
description: "初始化并注册触控引擎接口。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/armnative/kunpengcpsvideo_16_0017.html
sourcePath: /source/zh/kunpengboostkithistory/2300/armnative/kunpengcpsvideo_16_0017.html
indexId: 061e718ad125c8b463078c315ef969b23d671791ddf345f3cd27fba740d8dbfb77
---
# 初始化并注册触控引擎接口

#### 场景介绍

初始化并注册触控引擎接口。


#### 前提条件

视频流引擎对象已创建。


#### 开发流程

1. 创建DataPipe类实现TOUCHSENDHOOK接口。
2. 封装DataPipe的注册接口，注册触控引擎。
3. 在TOUCHSENDHOOK接口实现中调用视频流引擎的触控发送接口。


#### 编码实例

```
public class Activity implements BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
// 设置视频流引擎对象
DataPipe.setVideoEngine(engine);
// 注册触控引擎
DataPipe.registerHookToTouch();
// 注册音频引擎
DataPipe.registerAudioSendHook();
}
}
public class DataPipe extends BaseDataPipe implements TOUCHSENDHOOK, AUDIOSENDHOOK {
// 注册触控引擎接口
public static void registerHookToTouch() {
// 调用触控引擎注册
int ret = VmiTouch.getInstance().registerTouchSendHook(DataPipe.getInstance());
if (ret == VmiTouch.VMI_SUCCESS) {
// 注册触控引擎成功
}
}
@Override
public void touchSendData(byte[] data, int length) {
// 调用视频流引擎触控发送接口
VideoEngine.sendTouchEventArray(data, length);
}
}
```
