-
-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathindex.d.ts
More file actions
110 lines (98 loc) · 2.7 KB
/
Copy pathindex.d.ts
File metadata and controls
110 lines (98 loc) · 2.7 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import type {
AudioDataEvent,
AudioErrorEvent,
AudioFinishedEvent,
AudioInputOptions,
AudioInputPlugin,
AudioStateEvent,
PluginListenerHandle,
} from './src/definitions';
export type {
AudioDataEvent,
AudioErrorEvent,
AudioFinishedEvent,
AudioInputOptions,
AudioInputPlugin,
AudioStateEvent,
PluginListenerHandle,
} from './src/definitions';
export { AudioSourceType, SampleRate } from './src/definitions';
/**
* Capacitor/Cordova plugin runtime value.
*/
export declare const AudioInput: AudioInputPlugin;
/**
* Legacy callback-oriented Cordova configuration.
* @deprecated Prefer AudioInputOptions with the Promise API.
*/
export interface AudioInputConfiguration extends AudioInputOptions {
streamToWebAudio?: boolean;
audioContext?: AudioContext;
concatenateMaxChunks?: number;
onError?: (message: string) => void;
debug?: boolean;
}
/**
* Legacy callback-oriented Cordova interface.
* @deprecated Prefer the `AudioInput` exported value and Promise API.
*/
export interface AudioInputLegacy {
FORMAT: {
PCM_16BIT: string;
PCM_8BIT: string;
};
CHANNELS: {
MONO: number;
STEREO: number;
};
SAMPLERATE: {
TELEPHONE_8000Hz: number;
CD_QUARTER_11025Hz: number;
VOIP_16000Hz: number;
CD_HALF_22050Hz: number;
MINI_DV_32000Hz: number;
CD_XA_37800Hz: number;
NTSC_44056Hz: number;
CD_AUDIO_44100Hz: number;
};
AUDIOSOURCE_TYPE: {
DEFAULT: number;
CAMCORDER: number;
MIC: number;
UNPROCESSED: number;
VOICE_COMMUNICATION: number;
VOICE_RECOGNITION: number;
};
initialize(cfg: AudioInputConfiguration, onComplete: (result?: unknown) => void): void;
checkMicrophonePermission(onComplete: (granted: boolean) => void): void;
getMicrophonePermission(onComplete: (granted: boolean) => void): void;
start(cfg: AudioInputConfiguration): void;
stop(onStopped: (result?: unknown) => void): void;
connect(audioNode: AudioNode): void;
disconnect(): void;
getAudioContext(): AudioContext;
getCfg(): AudioInputConfiguration;
isCapturing(): boolean | unknown[];
addListener(
eventName: 'audioData',
listenerFunc: (event: AudioDataEvent) => void,
): Promise<PluginListenerHandle>;
addListener(
eventName: 'audioError',
listenerFunc: (event: AudioErrorEvent) => void,
): Promise<PluginListenerHandle>;
addListener(
eventName: 'audioInputFinished',
listenerFunc: (event: AudioFinishedEvent) => void,
): Promise<PluginListenerHandle>;
addListener(
eventName: 'stateChange',
listenerFunc: (event: AudioStateEvent) => void,
): Promise<PluginListenerHandle>;
}
declare global {
interface Window {
audioinput: AudioInputLegacy;
}
const audioinput: AudioInputLegacy;
}