
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@speechmatics/expo-two-way-audio
Advanced tools
Expo module for capturing and playing pcm audio data in react-native apps (iOS and Android).
The aim of the module is to facilitate creating real-time conversational apps. The following features are provided:
Check out our examples/ to see the module in action.
npm i @speechmatics/expo-two-way-audio
Please check out our examples/ to get full sample code.
Request permissions for recording audio
import {useMicrophonePermissions} from "@speechmatics/expo-two-way-audio";
const [micPermission, requestMicPermission] = useMicrophonePermissions();
console.log(micPermission);
Initialize the module before calling any audio functionality.
useEffect(() => {
const initializeAudio = async () => {
await initialize();
};
initializeAudio();
}, []);
Play audio
[!NOTE] The sample below uses the
buffer
module:npm install buffer
import { Buffer } from "buffer";
// As an example, let's play pcm data hardcoded in a variable.
// The examples/basic-usage does this. Check it out for real base64 data.
const audioChunk = "SOME PCM DATA BASE64 ENCODED HERE"
const buffer = Buffer.from(audioChunk, "base64");
const pcmData = new Uint8Array(buffer);
playPCMData(pcmData);
Get microphone samples
// Set up a function to deal with microphone sample events.
// In this case just print the data in the console.
useExpoTwoWayAudioEventListener(
"onMicrophoneData",
useCallback<MicrophoneDataCallback>((event) => {
console.log(`MIC DATA: ${event.data}`);
}, []),
);
// Unmute the microphone to get microphone data events
toggleRecording(true);
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
For Android, the following permissions are needed: RECORD_AUDIO
, MODIFY_AUDIO_SETTINGS
. In Expo apps they can bee added in your app.json
file:
expo.android.permissions: ["RECORD_AUDIO", "MODIFY_AUDIO_SETTINGS"]
FAQs
Native module for two way audio streaming
We found that @speechmatics/expo-two-way-audio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.