react-native-audio-api
Version:
react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification
36 lines • 1.98 kB
TypeScript
import { SessionOptions, LockScreenInfo, PermissionStatus, AudioDevicesInfo } from './types';
import { SystemEventName, SystemEventCallback, RemoteCommandEventName } from '../events/types';
import { AudioEventSubscription } from '../events';
declare class AudioManager {
private readonly audioEventEmitter;
constructor();
getDevicePreferredSampleRate(): number;
setAudioSessionActivity(enabled: boolean): Promise<boolean>;
setAudioSessionOptions(options: SessionOptions): void;
setLockScreenInfo(info: LockScreenInfo): void;
resetLockScreenInfo(): void;
observeAudioInterruptions(enabled: boolean): void;
/**
* @param enabled - Whether to actively reclaim the session or not
* @experimental more aggressively try to reactivate the audio session during interruptions.
* It is subject to change in the future and might be removed.
*
* In some cases (depends on app session settings and other apps using audio) system may never
* send the `interruption ended` event. This method will check if any other audio is playing
* and try to reactivate the audio session, as soon as there is "silence".
* Although this might change the expected behavior.
*
* Internally method uses `AVAudioSessionSilenceSecondaryAudioHintNotification` as well as
* interval polling to check if other audio is playing.
*/
activelyReclaimSession(enabled: boolean): void;
observeVolumeChanges(enabled: boolean): void;
enableRemoteCommand(name: RemoteCommandEventName, enabled: boolean): void;
addSystemEventListener<Name extends SystemEventName>(name: Name, callback: SystemEventCallback<Name>): AudioEventSubscription;
requestRecordingPermissions(): Promise<PermissionStatus>;
checkRecordingPermissions(): Promise<PermissionStatus>;
getDevicesInfo(): Promise<AudioDevicesInfo>;
}
declare const _default: AudioManager;
export default _default;
//# sourceMappingURL=AudioManager.d.ts.map