aliyun-rtc-sdk 6.11.3 → 6.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,208 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ import { LocalStream, IProfile } from 'aliyun-rts-sdk';
3
+ import { IVideoConstraints, IAudioConstraints } from 'media-device';
4
+ import { QueenEngineWorker } from 'aliyun-queen-engine';
5
+ import { BeautyParams } from 'aliyun-queen-engine/dist/QueenTypes';
6
+
7
+ declare enum VideoStreamSource {
8
+ Camera = 0,
9
+ Screen = 1,
10
+ Image = 2
11
+ }
12
+ declare enum AudioStreamSource {
13
+ Microphone = 0,
14
+ Screen = 1,
15
+ Mixed = 2
16
+ }
17
+ /**
18
+ * ------------------ 模式 ----- 采样率 ----- 声道 ----- 码率(kbps) -----
19
+ *
20
+ * standard: 标准音质 48000 单声道 64
21
+ *
22
+ * high: 高音质 48000 单声道 128
23
+ *
24
+ * standard-stereo: 立体声音质 48000 双声道 80
25
+ *
26
+ * high-stereo: 立体声高音质 48000 双声道 192
27
+ */
28
+ type AudioProfileKey = 'standard' | 'high' | 'standard-stereo' | 'high-stereo';
29
+
30
+ declare enum AliRtcRawDataStreamType {
31
+ /** 相机流 */
32
+ AliRtcSdkStreamTypeCapture = 0,
33
+ /** 屏幕共享流 */
34
+ AliRtcSdkStreamTypeScreen = 1
35
+ }
36
+
37
+ interface AliRtcLocalStreamListener {
38
+ videotrackended: () => void;
39
+ audiotrackended: () => void;
40
+ }
41
+ declare class AliRtcLocalStreamInfo extends EventEmitter<AliRtcLocalStreamListener> {
42
+ type: AliRtcRawDataStreamType;
43
+ originVideoTrack?: MediaStreamTrack;
44
+ videoSource?: VideoStreamSource;
45
+ private _videoMuted;
46
+ originAudioTrack?: MediaStreamTrack;
47
+ audioSource?: AudioStreamSource;
48
+ private _audioMuted;
49
+ private _targetVideoTrack?;
50
+ private _targetDualVideoTrack?;
51
+ private _targetAudioTrack?;
52
+ private _publishVideoStream?;
53
+ private _publishDualVideoStream?;
54
+ private _publishAudioStream?;
55
+ private _previewStream?;
56
+ plugins: AliRtcPlugin[];
57
+ private _profileManager?;
58
+ cameraVideoConstraints?: IVideoConstraints;
59
+ micAudioConstraints?: IAudioConstraints;
60
+ private get profileManager();
61
+ get audioProfile(): AudioProfileKey | undefined;
62
+ constructor(type: AliRtcRawDataStreamType);
63
+ private onVideoTrackEnded;
64
+ private onAudioTrackEnded;
65
+ updateSource(newStream: LocalStream, newVideoSource?: VideoStreamSource, newAudioSource?: AudioStreamSource): Promise<void>;
66
+ get currentProfile(): string | undefined;
67
+ get currentVideoTrack(): MediaStreamTrack | undefined;
68
+ get currentDualVideoTrack(): MediaStreamTrack | undefined;
69
+ get publishVideoStream(): LocalStream | undefined;
70
+ get publishDualVideoStream(): LocalStream | undefined;
71
+ get currentAudioTrack(): MediaStreamTrack | undefined;
72
+ get publishAudioStream(): LocalStream | undefined;
73
+ get previewStream(): LocalStream | undefined;
74
+ /**
75
+ * 更新 VideoTrack
76
+ * @param videoTrack
77
+ */
78
+ updateVideoTrack(videoTrack?: MediaStreamTrack, force?: boolean): Promise<void>;
79
+ /**
80
+ * 更新 DualVideoTrack
81
+ * @param videoTrack
82
+ * @param force
83
+ */
84
+ updateDualVideoTrack(videoTrack?: MediaStreamTrack, force?: boolean): Promise<void>;
85
+ /**
86
+ * 更新 AudioTrack
87
+ * @param audioTrack
88
+ */
89
+ updateAudioTrack(audioTrack?: MediaStreamTrack, force?: boolean): Promise<void>;
90
+ /**
91
+ * 设置音频流静音
92
+ * @param muted
93
+ */
94
+ setAudioMuted(muted: boolean): void;
95
+ get isAudioMuted(): boolean;
96
+ /**
97
+ * 设置视频流静音
98
+ * @param muted
99
+ */
100
+ setVideoMuted(muted: boolean): void;
101
+ get isVideoMuted(): boolean;
102
+ process(localStreamInfos: AliRtcLocalStreamInfo[]): Promise<void>;
103
+ /**
104
+ * 停止视频流
105
+ */
106
+ stopVideo(): void;
107
+ /**
108
+ * 停止音频流
109
+ */
110
+ stopAudio(): void;
111
+ /**
112
+ * 停止视频流和音频流
113
+ */
114
+ stop(): void;
115
+ /**
116
+ * 应该在执行完 plugin 后调用
117
+ * @param profileName
118
+ * @param profileValue
119
+ */
120
+ updateVideoProfile(profileName?: string, profileValue?: IProfile): Promise<void>;
121
+ get videoProfile(): string | undefined;
122
+ setVideoContentHint(hint?: string): void;
123
+ /**
124
+ * 应该在执行完 plugin 后调用
125
+ * @param profileName
126
+ */
127
+ updateAudioProfile(profileKey: AudioProfileKey): Promise<void>;
128
+ /**
129
+ * 复制视频 profile 到指定 LocalStream
130
+ * @param publishStream
131
+ */
132
+ cloneVideoProfile(publishStream: LocalStream): Promise<void>;
133
+ addPlugin(plugin: AliRtcPlugin): void;
134
+ removePlugin(plugin: AliRtcPlugin): boolean;
135
+ }
136
+
137
+ declare enum AliRtcPluginType {
138
+ PRE_PROCESSOR = 0,
139
+ POST_PROCESSOR = 1
140
+ }
141
+ declare enum AliRtcPluginTrackType {
142
+ AUDIO = 0,
143
+ VIDEO = 1,
144
+ BOTH = 2
145
+ }
146
+ interface AliRtcPluginListener {
147
+ enabled: () => void;
148
+ disabled: () => void;
149
+ updated: () => void;
150
+ ready: () => void;
151
+ overload: (info: any) => void;
152
+ error: (error: any) => void;
153
+ unsupported: () => void;
154
+ }
155
+ declare abstract class AliRtcPlugin extends EventEmitter<AliRtcPluginListener> {
156
+ name: string;
157
+ options: any;
158
+ type: AliRtcPluginType;
159
+ streamType: AliRtcRawDataStreamType;
160
+ trackType: AliRtcPluginTrackType;
161
+ zIndex: number;
162
+ private _isEnable;
163
+ lastInputAudioTrack?: MediaStreamTrack;
164
+ lastOutputAudioTrack?: MediaStreamTrack;
165
+ lastInputVideoTrack?: MediaStreamTrack;
166
+ lastOutputVideoTrack?: MediaStreamTrack;
167
+ constructor(name: string, streamType?: AliRtcRawDataStreamType, trackType?: AliRtcPluginTrackType);
168
+ get initOptions(): {};
169
+ getOptions(): any;
170
+ abstract setOptions(options: any): void;
171
+ abstract isSupported(version: string): boolean;
172
+ init(): Promise<void>;
173
+ enable(): void;
174
+ disable(): void;
175
+ get isEnable(): boolean;
176
+ protected audioUpdated(streamInfo: AliRtcLocalStreamInfo): boolean;
177
+ protected videoUpdated(streamInfo: AliRtcLocalStreamInfo): boolean;
178
+ execute(streamInfo: AliRtcLocalStreamInfo, streamInfos: AliRtcLocalStreamInfo[]): Promise<void>;
179
+ abstract shouldUpdate(streamInfo: AliRtcLocalStreamInfo, streamInfos: AliRtcLocalStreamInfo[]): boolean;
180
+ abstract process(streamInfo: AliRtcLocalStreamInfo, streamInfos: AliRtcLocalStreamInfo[]): Promise<void>;
181
+ clear(_streamInfo?: AliRtcLocalStreamInfo): void;
182
+ }
183
+
184
+ type AliRtcBeautyPluginOptions = {
185
+ licenseKey?: string;
186
+ } & BeautyParams;
187
+ declare class AliRtcBeautyPlugin extends AliRtcPlugin {
188
+ engineReady: boolean;
189
+ _queenEngine?: QueenEngineWorker;
190
+ canvas?: HTMLCanvasElement;
191
+ dirty: boolean;
192
+ lastFrameTimestamp: number;
193
+ continuousStuckCount: number;
194
+ get initOptions(): {
195
+ licenseKey: string;
196
+ };
197
+ setOptions(options: AliRtcBeautyPluginOptions): void;
198
+ constructor();
199
+ init(): Promise<void>;
200
+ isSupported(): boolean;
201
+ private initQueen;
202
+ shouldUpdate(streamInfo: AliRtcLocalStreamInfo): boolean;
203
+ process(streamInfo: AliRtcLocalStreamInfo): Promise<void>;
204
+ get queenEngine(): QueenEngineWorker | undefined;
205
+ clear(streamInfo?: AliRtcLocalStreamInfo): void;
206
+ }
207
+
208
+ export { AliRtcBeautyPlugin as default };