-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem.record.d.ts
83 lines (77 loc) · 2.42 KB
/
system.record.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
/// <reference path="./types.d.ts"/>
/**
* 录音 record
* @后台运行限制 manifest 中申请后可用。后台运行详细用法参见后台运行 脚本。
* @see https://doc.quickapp.cn/features/system/record.html
*/
declare module '@system.record' {
interface Record {
/**
* 开始录音。
* @example
* ```js
* record.start({
* duration: 10000,
* sampleRate: 8000,
* numberOfChannels: 1,
* encodeBitRate: 16000,
* format: 'aac',
* success: function(data) {
* console.log(`handling success: ${data.uri}`)
* },
* fail: function(data, code) {
* console.log(`handling fail, code = ${code}`)
* }
* })
* ```
*/
start(OBJECT: StartOBJECT): any;
/**
* 停止录音。
* @example
* ```js
* record.stop()
* ```
*/
stop(): any;
}
/**
*
* @param duration 录音时长,单位为 ms。如果 duration 为有效值将在达到指定值时停止录音[可选] 1010+
* @param sampleRate 采样率。不同的音频格式所支持的采样率范围不同。对于 aac 格式,默认设置为 8000,建议使用 8000/16000/44100[可选] 1010+
* @param numberOfChannels 录音通道数,有效值 1/2[可选] 1010+
* @param encodeBitRate 编码码率。编码码率的取值与采样率和音频格式有关。对 aac 格式,建议按照下表中取值范围来选择编码码率[可选] 1010+
* @param format 音频格式,有效值 3gpp/amr_nb/aac。缺省为 3gpp[可选] 1010+
* @param success 成功回调[可选]
* @param fail 失败回调[可选]
* @param complete 执行结束后的回调[可选]
*/
interface StartOBJECT {
duration?: Number;
sampleRate?: Number;
numberOfChannels?: Number;
encodeBitRate?: Number;
format?: String;
success?: StartOBJECTSuccessCB;
fail?: Function;
complete?: Function;
}
/**
* 成功回调
*/
type StartOBJECTSuccessCB = (successArg: StartSuccessSuccessArg) => any;
/**
* 成功回调
* @param uri 录音文件的存储路径,在应用的缓存目录中[可选]
*/
interface StartSuccessSuccessArg {
uri?: String;
}
/**
* 录音 record
* @后台运行限制 manifest 中申请后可用。后台运行详细用法参见后台运行 脚本。
* @see https://doc.quickapp.cn/features/system/record.html
*/
const record: Record;
export default record;
}