mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 15:00:26 +00:00
add types: react-native-audio (#35466)
* wxapp: add FileSystemManager * fix: add interface * uppercase interface name * add types react-native-audio
This commit is contained in:
committed by
Nathan Shively-Sanders
parent
5f983eff84
commit
a85998b8f2
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
// Type definitions for react-native-audio 4.3
|
||||
// Project: https://github.com/jsierles/react-native-audio#readme
|
||||
// Definitions by: taoqf <https://github.com/taoqf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export type AudioEncodingAndroidType = 'aac_eld' | 'amr_nb' | 'amr_wb' | 'he_aac' | 'vorbis';
|
||||
|
||||
export type AudioEncodingIOSType = 'lpcm' | 'ima4' | 'MAC3' | 'MAC6' | 'ulaw' | 'alaw' | 'mp1' | 'mp2' | 'alac' | 'amr';
|
||||
|
||||
export type AudioEncodingType = 'aac' | AudioEncodingAndroidType | AudioEncodingAndroidType;
|
||||
|
||||
export interface RecordingOptions {
|
||||
SampleRate?: number;
|
||||
Channels?: number;
|
||||
AudioQuality?: 'Low' | 'Medium' | 'High';
|
||||
AudioEncoding?: AudioEncodingType;
|
||||
OutputFormat?: string;
|
||||
MeteringEnabled?: boolean;
|
||||
MeasurementMode?: boolean;
|
||||
AudioEncodingBitRate?: number;
|
||||
IncludeBase64?: boolean;
|
||||
AudioSource?: number;
|
||||
}
|
||||
|
||||
export const AudioRecorder: {
|
||||
requestAuthorization(): Promise<boolean>;
|
||||
prepareRecordingAtPath(path: string, options: RecordingOptions): Promise<string>;
|
||||
startRecording(): Promise<string>;
|
||||
stopRecording(): Promise<string>;
|
||||
resumeRecording(): Promise<string>;
|
||||
pauseRecording(): Promise<string>;
|
||||
checkAuthorizationStatus(): Promise<boolean>;
|
||||
onProgress(res: { currentTime: number; }): void;
|
||||
onFinished(res: { audioFileURL: string; base64: string; status: string; }): void;
|
||||
};
|
||||
|
||||
export const AudioUtils: {
|
||||
CachesDirectoryPath: string;
|
||||
DocumentDirectoryPath: string;
|
||||
DownloadsDirectoryPath: string;
|
||||
LibraryDirectoryPath: string;
|
||||
MainBundlePath: string;
|
||||
MusicDirectoryPath: string;
|
||||
PicturesDirectoryPath: string;
|
||||
};
|
||||
|
||||
export const AudioSource: {
|
||||
CAMCORDER: number;
|
||||
DEFAULT: number;
|
||||
MIC: number;
|
||||
REMOTE_SUBMIX: number;
|
||||
UNPROCESSED: number;
|
||||
VOICE_CALL: number;
|
||||
VOICE_COMMUNICATION: number;
|
||||
VOICE_DOWNLINK: number;
|
||||
VOICE_RECOGNITION: number;
|
||||
VOICE_UPLINK: number;
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import { AudioRecorder, AudioUtils } from 'react-native-audio';
|
||||
const audioPath = AudioUtils.DocumentDirectoryPath + '/test.aac';
|
||||
|
||||
AudioRecorder.prepareRecordingAtPath(audioPath, {
|
||||
SampleRate: 22050,
|
||||
Channels: 1,
|
||||
AudioQuality: "Low",
|
||||
AudioEncoding: "aac"
|
||||
});
|
||||
|
||||
AudioRecorder.onProgress = (data) => {
|
||||
// todo
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-audio-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user