@irvingouj/expo-audio-stream
Version:
Expo Play Audio Stream module - Fork of expo-audio-stream with additional features and Expo SDK 52+ support
45 lines • 1.74 kB
TypeScript
import { EventSubscription } from 'expo-modules-core';
interface BaseAudioEventPayload {
type: 'recording' | 'microphone';
soundLevel: number;
}
export interface RecordingEventPayload extends BaseAudioEventPayload {
type: 'recording';
fileUri: string;
}
export interface MicrophoneEventPayload extends BaseAudioEventPayload {
type: 'microphone';
encoded: string;
buffer?: Float32Array;
fileUri: string;
lastEmittedSize?: number;
position?: number;
deltaSize: number;
totalSize: number;
mimeType?: string;
streamUuid?: string;
}
export type AudioEventPayload = RecordingEventPayload | MicrophoneEventPayload;
export type SoundChunkPlayedEventPayload = {
isFinal: boolean;
};
export declare const DeviceReconnectedReasons: {
readonly newDeviceAvailable: "newDeviceAvailable";
readonly oldDeviceUnavailable: "oldDeviceUnavailable";
readonly unknown: "unknown";
};
export type DeviceReconnectedReason = (typeof DeviceReconnectedReasons)[keyof typeof DeviceReconnectedReasons];
export type DeviceReconnectedEventPayload = {
reason: DeviceReconnectedReason;
};
export declare const AudioEvents: {
AudioData: string;
SoundChunkPlayed: string;
SoundStarted: string;
DeviceReconnected: string;
};
export declare function addAudioEventListener(listener: (event: AudioEventPayload) => Promise<void>): EventSubscription;
export declare function addSoundChunkPlayedListener(listener: (event: SoundChunkPlayedEventPayload) => Promise<void>): EventSubscription;
export declare function subscribeToEvent<T extends unknown>(eventName: string, listener: (event: T | undefined) => Promise<void>): EventSubscription;
export {};
//# sourceMappingURL=events.d.ts.map