Capacitor Plugin
Using our Capacitor plugin makes it easy to integrate Shen.AI into hybrid apps targeting Android and iOS.
The best way to get started is to download and build the example app - available here on GitHub .
Installing the plugin
Add the plugin as a dependency in package.json:
"dependencies": {
...
"capacitor-shenai-sdk": "file:./capacitor-shenai-sdk"
}WebView overlay (Android)
On Android, the SDK preview is rendered in a native view below the WebView, and the WebView background is made transparent so the camera feed stays visible. Touch events on the WebView are forwarded to the SDK view automatically.
You can reposition the preview and control whether it overlays the WebView with setViewRect and setOverlaysWebview (Android only). See configuration for usage.
Custom frame input
Capacitor exposes CameraMode.CUSTOM_FRAMES, so you can configure the SDK not to start a camera:
import { ShenaiSdkCapacitor, CameraMode } from "capacitor-shenai-sdk";
await ShenaiSdkCapacitor.initialize({
apiKey: API_KEY,
userId: USER_ID,
settings: {
cameraMode: CameraMode.CUSTOM_FRAMES,
},
});Further steps
Please see permissions, initialization, configuration and video measurement for further steps.