forked from react-native-oh-library/react-native-audio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NativeAudio.ts
37 lines (32 loc) · 1.18 KB
/
NativeAudio.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
import { TurboModuleRegistry } from "react-native";
import type { Int32, Double } from 'react-native/Libraries/Types/CodegenTypes';
type AudioQualityType = 'Low' | 'Medium' | 'High';
export interface RecordingOptions {
SampleRate: Double,
Channels: Int32,
AudioQuality?: AudioQualityType,
AudioEncoding: string,
MeteringEnabled?: boolean,
MeasurementMode?: boolean,
AudioEncodingBitRate: Double,
IncludeBase64: boolean,
OutputFormat: string,
AudioSource: Int32
}
export interface PathMap {
FilesDirectoryPath: string,
CacheDirectoryPath: string,
TempsDirectoryPath: string,
}
export interface Spec extends TurboModule {
prepareRecordingAtPath: (path: string, options: RecordingOptions) => Promise<void>;
requestAuthorization: () => Promise<boolean>;
startRecording: () => Promise<void>;
pauseRecording: () => Promise<void>;
resumeRecording: () => Promise<void>;
stopRecording: () => Promise<void>;
getAllPath: () => PathMap;
checkAuthorizationStatus: () => Promise<boolean>;
}
export default TurboModuleRegistry.getEnforcing<Spec>("RTNAudio");