React Native Bindings¶
Native bridge modules over the cactus C API for iOS and Android.
Integration¶
- Add the bridge files from this folder to your React Native app
- Add the raw bindings they depend on:
bindings/kotlin/(Android),bindings/swift/(Apple) - Register the Android package in
MainApplication.kt:
Usage¶
import Cactus from './index';
const handle = await Cactus.init('/path/to/model', null, false);
const result = await Cactus.complete(handle, messagesJson, null, null, null, false);
await Cactus.destroy(handle);
Streaming transcription¶
Push 16 kHz mono PCM16 (base64) as it arrives; each call returns {"success":true,"confirmed":...,"pending":...} (confirmed is final, pending is the volatile tail).
const stream = await Cactus.streamTranscribeStart(handle, '{"language":"en"}');
for (const chunkBase64 of pcmChunks) {
const json = await Cactus.streamTranscribeProcess(stream, chunkBase64);
// parse json -> append "confirmed", show "pending" as a live preview
}
const tail = await Cactus.streamTranscribeStop(stream);