forked from nstudio/nativescript-audio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
129 lines (113 loc) · 3.38 KB
/
index.d.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
export interface AudioPlayerOptions {
/**
* The audio file to play.
*/
audioFile: string;
/**
* Set true to loop audio playback.
*/
loop: boolean;
/**
* Instead of auto-playing, just init the player instance
*/
initOnly?: boolean;
/**
* Callback to execute when playback has completed.
* @returns {Object} An object containing the native values for the callback.
*/
completeCallback?: Function;
/**
* Callback to execute when playback has an error.
* @returns {Object} An object containing the native values for the error callback.
*/
errorCallback?: Function;
/**
* Callback to execute when info is emitted from the player.
* @returns {Object} An object containing the native values for the info callback.
*/
infoCallback?: Function;
}
export interface AudioRecorderOptions {
/**
* The name of the file recorded.
*/
filename: string;
/**
* The audio source to record *** ANDROID ONLY for now ***
* https://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html
*/
source?: any;
/**
* The max duration of the audio recording.
*/
maxDuration?: number;
/**
* Set true to enable audio metering.
*/
metering?: boolean;
/**
* The format of the audio recording.
*/
format?: any;
channels?: any;
sampleRate?: any;
bitRate?: any;
encoder?: any;
/**
* Callback to execute when playback has an error.
* @returns {Object} An object containing the native values for the error callback.
*/
errorCallback?: Function;
/**
* Callback to execute when info is emitted from the player.
* @returns {Object} An object containing the native values for the info callback.
*/
infoCallback?: Function;
}
export interface TNSPlayerI {
playFromFile(options: AudioPlayerOptions): Promise<any>;
playFromUrl(options: AudioPlayerOptions): Promise<any>;
play(): Promise<boolean>;
pause(): Promise<boolean>;
resume(): void;
seekTo(time: number): Promise<any>;
dispose(): Promise<boolean>;
isAudioPlaying(): boolean;
getAudioTrackDuration(): Promise<string>;
}
export interface TNSRecordI {
start(options: AudioRecorderOptions): Promise<any>;
stop(): Promise<any>;
dispose(): Promise<any>;
}
export declare class TNSPlayer {
static ObjCProtocols: any[];
private _player;
private _task;
private _completeCallback;
private _errorCallback;
private _infoCallback;
playFromFile(options: AudioPlayerOptions): Promise<any>;
playFromUrl(options: AudioPlayerOptions): Promise<any>;
pause(): Promise<any>;
resume(): void;
seekTo(time: number): Promise<any>;
play(): Promise<any>;
dispose(): Promise<any>;
isAudioPlaying(): boolean;
getAudioTrackDuration(): Promise<string>;
audioPlayerDidFinishPlayingSuccessfully(player?: any, flag?: boolean): void;
private reset();
}
export declare class TNSRecorder {
static ObjCProtocols: any[];
private _recorder;
private _recordingSession;
static CAN_RECORD(): boolean;
start(options: AudioRecorderOptions): Promise<any>;
stop(): Promise<any>;
dispose(): Promise<any>;
isRecording(): any;
getMeters(channel: number): any;
audioRecorderDidFinishRecording(recorder: any, success: boolean): void;
}