UNPKG

@irvingouj/expo-audio-stream

Version:

Expo Play Audio Stream module - Fork of expo-audio-stream with additional features and Expo SDK 52+ support

29 lines 1.08 kB
// packages/expo-audio-stream/src/events.ts import ExpoPlayAudioStreamModule from './ExpoPlayAudioStreamModule'; // As of Expo SDK 52, the module is already an EventEmitter const emitter = ExpoPlayAudioStreamModule; // Create a simple addListener function using Expo's EventSubscription function addListener(eventType, listener) { return emitter.addListener(eventType, listener); } export const DeviceReconnectedReasons = { newDeviceAvailable: 'newDeviceAvailable', oldDeviceUnavailable: 'oldDeviceUnavailable', unknown: 'unknown', }; export const AudioEvents = { AudioData: 'AudioData', SoundChunkPlayed: 'SoundChunkPlayed', SoundStarted: 'SoundStarted', DeviceReconnected: 'DeviceReconnected', }; export function addAudioEventListener(listener) { return addListener('AudioData', listener); } export function addSoundChunkPlayedListener(listener) { return addListener('SoundChunkPlayed', listener); } export function subscribeToEvent(eventName, listener) { return addListener(eventName, listener); } //# sourceMappingURL=events.js.map