feat: add expo-two-way-audio module to workspace

This commit is contained in:
Mohamed Boudra
2026-03-14 16:46:35 +07:00
parent fc7369384b
commit cad4110e24
74 changed files with 48803 additions and 354 deletions
+38
View File
@@ -0,0 +1,38 @@
import ExpoTwoWayAudioModule from "./ExpoTwoWayAudioModule";
export type MicrophoneDataEvent = {
data: Uint8Array;
};
export type VolumeLevelEvent = {
data: number;
};
export type RecordingChangeEvent = {
data: boolean;
};
export type AudioInterruptionEvent = {
data: string;
};
export interface ExpoTwoWayAudioEventMap {
onMicrophoneData: MicrophoneDataEvent;
onInputVolumeLevelData: VolumeLevelEvent;
onOutputVolumeLevelData: VolumeLevelEvent;
onRecordingChange: RecordingChangeEvent;
onAudioInterruption: AudioInterruptionEvent;
}
// These are useful for defining `useCallback` types inline
export type MicrophoneDataCallback = (event: MicrophoneDataEvent) => void;
export type VolumeLevelCallback = (event: VolumeLevelEvent) => void;
export type RecordingChangeCallback = (event: RecordingChangeEvent) => void;
export type AudioInterruptionCallback = (event: AudioInterruptionEvent) => void;
export function addExpoTwoWayAudioEventListener<K extends keyof ExpoTwoWayAudioEventMap>(
eventName: K,
handler: (ev: ExpoTwoWayAudioEventMap[K]) => void,
) {
return ExpoTwoWayAudioModule.addListener(eventName, handler);
}