UNPKG

react-native-audio-api

Version:

react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification

59 lines (45 loc) 1.49 kB
/* 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, PlaybackControlName, PlaybackNotificationEventName, PlaybackNotificationInfo, } from '../../system'; /// Mock Manager for playback notifications. Does nothing. class PlaybackNotificationManager implements NotificationManager< PlaybackNotificationInfo, PlaybackNotificationEventName > { private isRegistered_ = false; private isShown_ = false; constructor() {} async register(): Promise<void> {} async show(info: PlaybackNotificationInfo): Promise<void> {} async update(info: PlaybackNotificationInfo): Promise<void> {} async hide(): Promise<void> {} async unregister(): Promise<void> {} async enableControl( control: PlaybackControlName, enabled: boolean ): Promise<void> {} async isActive(): Promise<boolean> { return this.isShown_; } isRegistered(): boolean { return this.isRegistered_; } addEventListener<T extends PlaybackNotificationEventName>( 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 PlaybackNotificationManager();