Add oxlint-tsgolint and configure typescript/no-unnecessary-type-assertion to flag redundant `!` and `as Foo` casts. Type-aware mode is left off by default to keep `npm run lint` fast; the rule sits configured for when we turn type-aware on intentionally. Auto-fix removed ~283 redundant casts; two manual touch-ups: a real tsgolint false positive in split-container.tsx and a stale ChildProcess import after a double-cast collapsed.
Expo Two-Way-Audio Using Flow API
This example shows how expo-two-way-audio can be used to communicate with Speechmatics Flow API
Flow is a conversational AI API and therefore, we need to send audio data in real time and play back the audio responses that we'll get from the API.
Requirements
- Node.js
- Expo CLI
- iOS and/or Android dev environment setup.
- Speechmatics Flow Client (React)
event-target-polyfillpackage, or any other polyfill for theEventTargetclass
A Speechmatics API key is also needed in order to run the example. The key is injected into the app via environment variable. It can be passed by creating a .env file in the same directory as the example with the following content:
EXPO_PUBLIC_SPEECHMATICS_API_KEY='YOUR-API-KEY-HERE'
An API key can be obtained from the Speechmatics Portal
Warning
The example uses the API key to request a temporary token (needed for communicating with flow). In a real-world scenario, you should not expose your API key in your client-side code. Instead, you should create a server-side endpoint that generates the temporary token (JWT) for you.
Run the app
In the examples/flow-api directory:
-
Install dependencies:
npm install -
Run the app:
# Run iOS npm run ios # Run Android npm run android
Notes
Some audio features of expo-two-way-audio like Acoustic Echo Cancelling, noise reduction or microphone modes (iOS) don't work on simulator. Run the example on a real device to test these features.
# iOS
npx expo run:ios --device --configuration Release
# Android
npx expo run:android --device --variant release