forked from 2fps/recorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
94 lines (82 loc) · 2.56 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
interface recorderConfig {
sampleBits?: number, // 采样位数
sampleRate?: number, // 采样率
numChannels?: number, // 声道数
compiling?: boolean, // 是否边录边播
}
interface dataview {
byteLength: number,
buffer: {
byteLength: number,
},
getUint8: any,
}
declare class Recorder {
private isrecording: boolean;
private isplaying: boolean;
private ispause: boolean;
private context: any;
protected config: recorderConfig;
private size: number;
private lBuffer: Array<Float32Array>;
private rBuffer: Array<Float32Array>;
private PCM: any;
private tempPCM: Array<DataView>;
private audioInput: any;
private inputSampleRate: number;
private inputSampleBits: number;
private outputSampleRate: number;
private oututSampleBits: number;
private analyser: any;
private source: any;
private recorder: any;
private stream: any;
private littleEdian: boolean;
private prevDomainData: any;
private playStamp: number;
private playTime: number;
private offset: number;
private needRecord: boolean;
public fileSize: number;
public duration: number;
public onprocess: (duration: number) => void;
public onprogress: (payload: {
duration: number,
fileSize: number,
vol: number,
data: Array<DataView>,
}) => void;
public onplay: () => void;
public onpauseplay: () => void;
public onresumeplay: () => void;
public onstopplay: () => void;
public onplayend: () => void;
constructor(options?: recorderConfig);
public setOption: (options?: recorderConfig) => void
initRecorder(): void;
start(): Promise<{}>;
pause(): void;
resume(): void;
stop(): void;
play(): void;
getPlayTime(): number;
pausePlay(): void;
resumePlay(): void;
stopPlay(): void;
destroy(): Promise<{}>;
getWholeData(): any;
getNextData(): any;
getRecordAnalyseData(): any;
getPlayAnalyseData(): any;
getPCMBlob(): any;
downloadPCM(name: string): void;
getWAVBlob(): any;
downloadWAV(name: string): void;
static playAudio(blob): void;
static compress(data, inputSampleRate: number, outputSampleRate: number);
static encodePCM(bytes, sampleBits: number, littleEdian: boolean);
static encodeWAV(bytes: dataview, inputSampleRate: number, outputSampleRate: number, numChannels: number, oututSampleBits: number, littleEdian: boolean);
static throwError(message: string)
}
type UserName = string
export default Recorder