react-native-audio-api
Version:
react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification
47 lines (37 loc) • 1.23 kB
text/typescript
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable no-useless-constructor */
/* eslint-disable @typescript-eslint/require-await */
import type { AudioEventSubscription } from '../../events';
import type {
NotificationEvents,
NotificationManager,
RecordingNotificationEventName,
RecordingNotificationInfo,
} from '../../system';
/// Mock Manager for playback notifications. Does nothing.
class RecordingNotificationManager implements NotificationManager<
RecordingNotificationInfo,
RecordingNotificationEventName
> {
private isRegistered_ = false;
private isShown_ = false;
constructor() {}
async show(info: RecordingNotificationInfo): Promise<void> {}
async hide(): Promise<void> {}
async isActive(): Promise<boolean> {
return this.isShown_;
}
isRegistered(): boolean {
return this.isRegistered_;
}
addEventListener<T extends RecordingNotificationEventName>(
eventName: T,
callback: (event: NotificationEvents[T]) => void
): AudioEventSubscription {
// dummy subscription object with a no-op remove method
return {
remove: () => {},
} as unknown as AudioEventSubscription;
}
}
export default new RecordingNotificationManager();