Initializing and Registering the Touch Engine API
Application Scenario
Initialize and register the touch engine API.
Prerequisites
A video stream engine object has been created.
Development Process
- Create the DataPipe class to implement the TOUCHSENDHOOK interface function.
- Encapsulate the registration interface function of the DataPipe class and register the touch engine.
- Call the touch data sending function of the video stream engine in the TOUCHSENDHOOK implementation.
Encoding Instance
public class Activity implements BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
// Set the video stream engine object.
DataPipe.setVideoEngine(engine);
// Register the touch engine.
DataPipe.registerHookToTouch();
// Register the audio engine.
DataPipe.registerAudioSendHook();
}
}
public class DataPipe extends BaseDataPipe implements TOUCHSENDHOOK, AUDIOSENDHOOK {
// Register the touch engine API.
public static void registerHookToTouch() {
// Call the touch engine registration interface function.
int ret = VmiTouch.getInstance().registerTouchSendHook(DataPipe.getInstance());
if (ret == VmiTouch.VMI_SUCCESS) {
// The touch engine is successfully registered.
}
}
@Override
public void touchSendData(byte[] data, int length) {
// Call the touch data sending function of the video stream engine.
VideoEngine.sendTouchEventArray(data, length);
}
}
Parent topic: Development Process of the Video Stream Engine Client