react-native-audio-api
Version:
react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification
70 lines (59 loc) • 1.5 kB
text/typescript
export type IOSCategory =
| 'record'
| 'ambient'
| 'playback'
| 'multiRoute'
| 'soloAmbient'
| 'playAndRecord';
export type IOSMode =
| 'default'
| 'gameChat'
| 'videoChat'
| 'voiceChat'
| 'measurement'
| 'voicePrompt'
| 'spokenAudio'
| 'moviePlayback'
| 'videoRecording';
export type IOSOption =
| 'duckOthers'
| 'allowAirPlay'
| 'mixWithOthers'
| 'allowBluetooth'
| 'defaultToSpeaker'
| 'allowBluetoothA2DP'
| 'overrideMutedMicrophoneInterruption'
| 'interruptSpokenAudioAndMixWithOthers';
export interface SessionOptions {
iosMode?: IOSMode;
iosOptions?: IOSOption[];
iosCategory?: IOSCategory;
iosAllowHaptics?: boolean;
}
export type MediaState = 'state_playing' | 'state_paused';
interface BaseLockScreenInfo {
[key: string]: string | boolean | number | undefined;
}
export interface LockScreenInfo extends BaseLockScreenInfo {
title?: string;
artwork?: string;
artist?: string;
album?: string;
duration?: number;
description?: string; // android only
state?: MediaState;
speed?: number;
elapsedTime?: number;
}
export type PermissionStatus = 'Undetermined' | 'Denied' | 'Granted';
export interface AudioDeviceInfo {
name: string;
category: string;
}
export type AudioDeviceList = AudioDeviceInfo[];
export interface AudioDevicesInfo {
availableInputs: AudioDeviceList;
availableOutputs: AudioDeviceList;
currentInputs: AudioDeviceList; // iOS only
currentOutputs: AudioDeviceList; // iOS only
}