Browse Source

Merge pull request #70 from syanbo/fix/rn-compatible

compatible 0.55.1 and support typescript  typing
matrixbirds 5 years ago
parent
commit
7376d0f1f3
No account linked to committer's email address
8 changed files with 1007 additions and 10195 deletions
  1. 2
    0
      .gitignore
  2. 1
    0
      .npmignore
  3. 23
    0
      lib/AgoraView.native.d.ts
  4. 970
    0
      lib/RtcEngine.native.d.ts
  5. 2
    0
      lib/index.d.ts
  6. 0
    10188
      package-lock.json
  7. 7
    7
      package.json
  8. 2
    0
      tsconfig.json

+ 2
- 0
.gitignore View File

@@ -73,4 +73,6 @@ xcuserdata*
73 73
 samples/**/package-lock.json
74 74
 *.iml
75 75
 android/bin
76
+yarn.lock
77
+package-lock.json
76 78
 lib

+ 1
- 0
.npmignore View File

@@ -37,3 +37,4 @@ proguard-rules.pro
37 37
 .vscode
38 38
 package-lock.json
39 39
 android/bin
40
+lib/**/*.ts.map

+ 23
- 0
lib/AgoraView.native.d.ts View File

@@ -0,0 +1,23 @@
1
+import React from 'react';
2
+import { AgoraViewProps } from "./types.d";
3
+/**
4
+ * AgoraView is the render layer for rendering video stream
5
+ *
6
+ * This class is used to rendering native sdk stream
7
+ *
8
+ * @props {@link AgoraViewProps}
9
+ */
10
+export default class AgoraView extends React.Component<AgoraViewProps> {
11
+    /**
12
+     * render
13
+     *
14
+     * It would render view for VideoStream
15
+     */
16
+    render(): JSX.Element;
17
+    /**
18
+     * getHTMLProps
19
+     *
20
+     * get agora view props
21
+     */
22
+    private getHTMLProps;
23
+}

+ 970
- 0
lib/RtcEngine.native.d.ts View File

@@ -0,0 +1,970 @@
1
+import { Option, Callback, VideoOption, AudioMixingOption, DataStreamOption, PlayEffectOption, AudioRecordingOption, AudioFrameOption, MixedAudioFrameOption, ImageOption, VideoStreamOption, DefaultVideoStreamOption, InjectStreamOption, RemoveInjectStreamOption, PublishStreamOption, RemovePublishStreamOption, LiveTranscodingOption, PositionOption, BeautyOption, LastmileProbeConfig, CameraCapturerConfiguration } from "./types.d";
2
+/**
3
+ * RtcEngine is the javascript object for control agora native sdk through react native bridge.
4
+ *
5
+ * You can use the RtcEngine methods to create {@link init}
6
+ *
7
+ * Other methods of the RtcEngine object serve for agora native sdk and set up error logging.
8
+ */
9
+declare class RtcEngine {
10
+    private static eventTypes;
11
+    /**
12
+     * Creates a RtcEngine Object internal.
13
+     *
14
+     * This method creates and start event observer. You should call this method once.
15
+     * @example `RtcEngine.init(option)`
16
+     * @param options Defines the property of the client, see {@link Option} for details.
17
+     */
18
+    static init(options: Option): void;
19
+    /**
20
+     * join specified channel
21
+     *
22
+     * This method joins and begin rendering the video stream. when join succeeds.
23
+     * Otherwise, it will invoke error by the event
24
+     * @param channelName
25
+     * @param uid
26
+     * @param token
27
+     * @param info
28
+     */
29
+    static joinChannel(channelName: string, uid?: number, token?: string, info?: Object): void;
30
+    /**
31
+     * add event listener
32
+     *
33
+     * This method subscribes specified eventType and run listener. You should call this method at first.
34
+     * @param eventType
35
+     * @param listener
36
+     */
37
+    static on(eventType: string, listener: (...args: any[]) => any): void;
38
+    /**
39
+     * remove event listeners
40
+     *
41
+     * This method unsubscribes specified eventType related all listeners. You should call this method when you want to unsubscribe some eventType.
42
+     * @param eventType
43
+     */
44
+    static off(eventType: string): void;
45
+    /**
46
+     * remove all events listeners
47
+     *
48
+     * This method unsubscribes all eventTypes related listeners.
49
+     *
50
+     * @param token
51
+     */
52
+    static removeAllListeners(): void;
53
+    /**
54
+     * renew token
55
+     *
56
+     * This method renews a new token.
57
+     * @param token
58
+     */
59
+    static renewToken(token: string): any;
60
+    /**
61
+     * enable websdk interoperability
62
+     *
63
+     * This method used to enable websdk interoperability, so that it can connect with agora websdk apps.
64
+     *
65
+     * @param enabled
66
+     * @returns Promise<{success, value}>
67
+     */
68
+    static enableWebSdkInteroperability(enabled: boolean): Promise<any>;
69
+    /**
70
+     * get agora native sdk connection state
71
+     *
72
+     * This method gets agora native sdk connection state
73
+     * @returns Promise<{success: true, state: (connection state)}>
74
+     */
75
+    static getConnectionState(): any;
76
+    /**
77
+     * change the client role
78
+     *
79
+     * This method changes the client of role.
80
+     * @param role (audience: 0, host: 1)
81
+     */
82
+    static setClientRole(role: number): void;
83
+    /**
84
+     * leave channel
85
+     *
86
+     * This method leaves the joined channel, then your video view will not render ever.
87
+     * You should call it, when you dont need render video stream.
88
+     *
89
+     * @returns Promise<{success, value}>
90
+     */
91
+    static leaveChannel(): Promise<any>;
92
+    /**
93
+     * destroy
94
+     *
95
+     * This method stops event subscribe and destroy the RtcEngine instance's.
96
+     * You should call it, when you want to destroy the engine.
97
+     *
98
+     * @returns Promise<{success, value}>
99
+     */
100
+    static destroy(): Promise<any>;
101
+    /**
102
+     * show local video
103
+     *
104
+     * This method calls native sdk render canvas for local video.
105
+     * @param options {@link VideoOption}
106
+     */
107
+    static setupLocalVideo(options: VideoOption): void;
108
+    /**
109
+     * show remote video
110
+     *
111
+     * This method calls native sdk render canvas for remote video.
112
+     * @param options {@link VideoOption}
113
+     */
114
+    static setupRemoteVideo(options: VideoOption): void;
115
+    /**
116
+     * set local video render mode
117
+     *
118
+     * This method calls native sdk render mode for local video.
119
+     * @param mode
120
+     */
121
+    static setLocalRenderMode(mode: number): void;
122
+    /**
123
+     * set the specified remote video render mode
124
+     *
125
+     * This method calls native sdk render mode for the specified remote video.
126
+     *
127
+     * @param uid
128
+     * @param mode
129
+     */
130
+    static setRemoteRenderMode(uid: number, mode: number): void;
131
+    /**
132
+     * start video preview
133
+     *
134
+     * This method start video preview for video.
135
+     */
136
+    static startPreview(): void;
137
+    /**
138
+     * stop video preview
139
+     *
140
+     * This method stops video preview for video.
141
+     */
142
+    static stopPreview(): void;
143
+    /**
144
+     * set enable speaker phone
145
+     *
146
+     * This method set the speaker phone enable or disable by pass boolean parameter.
147
+     * @param enabled
148
+     */
149
+    static setEnableSpeakerphone(enabled: boolean): void;
150
+    /**
151
+     * set default audio speaker
152
+     *
153
+     * This method set the default audio speaker enable or disable by pass boolean parameter.
154
+     * @param enabled
155
+     */
156
+    static setDefaultAudioRouteToSpeakerphone(enabled: boolean): void;
157
+    /**
158
+     * set default mute all remote audio streams
159
+     *
160
+     * This method set default mute all remote audio streams enable or not by pass boolean parameter.
161
+     * @param enabled
162
+     */
163
+    static setDefaultMuteAllRemoteAudioStreams(enabled: boolean): void;
164
+    /**
165
+     * enable video
166
+     *
167
+     * This method enables video.
168
+     */
169
+    static enableVideo(): void;
170
+    /**
171
+     * disable video
172
+     *
173
+     * This method disables video.
174
+     */
175
+    static disableVideo(): void;
176
+    /**
177
+     * enable local video
178
+     *
179
+     * This method enables the local video by the boolean parameter.
180
+     * @param enabled
181
+     */
182
+    static enableLocalVideo(enabled: boolean): void;
183
+    /**
184
+     * mute local video stream
185
+     *
186
+     * This method mutes video stream by the boolean parameter.
187
+     * @param muted
188
+     */
189
+    static muteLocalVideoStream(muted: boolean): void;
190
+    /**
191
+     * mute all remote video streams
192
+     *
193
+     * This method mutes all remote streams by the boolean parameter.
194
+     * @param muted
195
+     */
196
+    static muteAllRemoteVideoStreams(muted: boolean): void;
197
+    /**
198
+     * mute specified remote video stream.
199
+     *
200
+     * This method mutes remote video stream by the number of uid and boolean parameter.
201
+     * @param uid
202
+     * @param muted
203
+     */
204
+    static muteRemoteVideoStream(uid: number, muted: boolean): void;
205
+    /**
206
+     * set default mute all remote video stream
207
+     *
208
+     * This method mutes all remote video stream default by the boolean parameter.
209
+     * @param muted
210
+     */
211
+    static setDefaultMuteAllRemoteVideoStreams(muted: boolean): void;
212
+    /**
213
+     * enable audio
214
+     *
215
+     * This method enables audio
216
+     */
217
+    static enableAudio(): void;
218
+    /**
219
+     * disable audio
220
+     *
221
+     * This method disables audio
222
+     */
223
+    static disableAudio(): void;
224
+    /**
225
+     * enable local audio
226
+     *
227
+     * This method enables local audio by the boolean parameter.
228
+     * @param enabled
229
+     */
230
+    static enableLocalAudio(enabled: boolean): void;
231
+    /**
232
+     * mute local audio stream
233
+     *
234
+     * This method mutes the local audio stream by muted.
235
+     * @param muted
236
+     */
237
+    static disableLocalAudio(muted: boolean): void;
238
+    /**
239
+     * mute all remote audio streams
240
+     *
241
+     * This method mutes all remote audio streams by muted
242
+     */
243
+    static muteAllRemoteAudioStreams(muted: boolean): void;
244
+    /**
245
+     * mute specified remote audio stream by muted
246
+     *
247
+     * This method mutes specified remote audio stream by number uid and boolean muted.
248
+     * @param uid
249
+     * @param muted
250
+     */
251
+    static muteRemoteAudioStream(uid: number, muted: boolean): void;
252
+    /**
253
+     * adjust recording signal volume
254
+     *
255
+     * This method adjusts recording your signal by volume.
256
+     * @param volume
257
+     */
258
+    static adjustRecordingSignalVolume(volume: number): void;
259
+    /**
260
+     * adjust playback signal volume
261
+     *
262
+     * This method adjusts playback signal by volume.
263
+     * @param volume
264
+     */
265
+    static adjustPlaybackSignalVolume(volume: number): void;
266
+    /**
267
+     * enable audio volume indication
268
+     *
269
+     * This method enables audio volume by interval and smooth
270
+     * @param interval
271
+     * @param smooth
272
+     */
273
+    static enableAudioVolumeIndication(interval: number, smooth: number): void;
274
+    /**
275
+     * create data stream
276
+     *
277
+     * This method creates data stream with options
278
+     *
279
+     * @param options {@link DataStreamOption}
280
+     */
281
+    static createDataStream(options: DataStreamOption): any;
282
+    /**
283
+     * check for mobile phone speaker enabled
284
+     *
285
+     * This method checks the phone speaker is enabled
286
+     * @param callback
287
+     */
288
+    static methodisSpeakerphoneEnabled(callback: Callback<any>): void;
289
+    /**
290
+     * enable in-ear monitor
291
+     *
292
+     * This method enables in-ear monitoring by boolean parameter enabled
293
+     *
294
+     * @param enabled
295
+     */
296
+    static enableInEarMonitoring(enabled: boolean): void;
297
+    /**
298
+     * set in-ear monitoring volume
299
+     *
300
+     * This method sets the in-ear-monitoring volume by number parameter volume
301
+     *
302
+     * @param volume
303
+     */
304
+    static setInEarMonitoringVolume(volume: number): void;
305
+    /**
306
+     * set local voice pitch
307
+     *
308
+     * This method sets the local voice pitch by float parameter pitch
309
+     *
310
+     * @param pitch
311
+     */
312
+    static setLocalVoicePitch(pitch: number): void;
313
+    /**
314
+     * set local voice equalization
315
+     *
316
+     * This method set local video equalization of band frequency by enum band number and number of gain
317
+     *
318
+     * @param band
319
+     * @param gain
320
+     */
321
+    static setLocalVoiceEqualization(band: number, gain: number): void;
322
+    /**
323
+     * set local voice reverb
324
+     *
325
+     * This method sets local voice by reverb and value
326
+     * @param reverb
327
+     * @param value
328
+     */
329
+    static setLocalVoiceReverb(reverb: number, value: number): void;
330
+    /**
331
+     * start audio mixing
332
+     *
333
+     * This method will start audio mixing by option config
334
+     *
335
+     * @param options {@link AudioMixingOption}
336
+     */
337
+    static startAudioMixing(options: AudioMixingOption): void;
338
+    /**
339
+     * stop audio mixing
340
+     *
341
+     * This methods stops for audio mixing.
342
+     */
343
+    static stopAudioMixing(): void;
344
+    /**
345
+     * pause audio mixing
346
+     *
347
+     * This method pauses for audio mixing.
348
+     */
349
+    static pauseAudioMixing(): void;
350
+    /**
351
+     * resume audio mixing
352
+     *
353
+     * This method resumes for audio mixing.
354
+     */
355
+    static resumeAudioMixing(): void;
356
+    /**
357
+     * adjust audio mixing volume
358
+     *
359
+     * This method adjusts audio mixing volume by the volume number parameter
360
+     * @param volume
361
+     */
362
+    static adjustAudioMixingVolume(volume: number): void;
363
+    /**
364
+     * adjust audio mixing playout volume
365
+     *
366
+     * This method adjusts audio mixing playout by the volume parameter
367
+     * @param volume
368
+     */
369
+    static adjustAudioMixingPlayoutVolume(volume: number): void;
370
+    /**
371
+     * adjust audio mixing publish volume
372
+     *
373
+     * This method adjusts audio mixing publish by the volume paraemter
374
+     * @param volume
375
+     */
376
+    static adjustAudioMixingPublishVolume(volume: number): void;
377
+    /**
378
+     * get audio mixing duration
379
+     *
380
+     * This method gets the audio mixing duration
381
+     * @returns Promise<{success, value}>
382
+     */
383
+    static getAudioMixingDuration(): Promise<any>;
384
+    /**
385
+     * get audio mixing current position
386
+     *
387
+     * This method gets audio mixing current position value.
388
+     * @returns Promise<{success, value}>
389
+     */
390
+    static getAudioMixingCurrentPosition(): Promise<any>;
391
+    /**
392
+     * set audio mixing position
393
+     *
394
+     * This method sets audio mixing position by the parameter pos
395
+     * @param pos
396
+     */
397
+    static setAudioMixingPosition(pos: number): Promise<any>;
398
+    /**
399
+     * get effects of volume
400
+     *
401
+     * This methods get audio mixing effects volume value.
402
+     * @returns Promise<{success, value}>
403
+     */
404
+    static getEffectsVolume(): Promise<any>;
405
+    /**
406
+     * set effects volume
407
+     *
408
+     * This methods set audio mixing effects volume by float parameter.
409
+     * @param volume
410
+     * @returns Promise<{success, value}>
411
+     */
412
+    static setEffectsVolume(volume: number): Promise<any>;
413
+    /**
414
+     * set volume for playing effects.
415
+     *
416
+     * This methods set for playing audio mixing effects
417
+     * @returns Promise<{success, value}>
418
+     */
419
+    static setVolumeOfEffect(volume: number): Promise<any>;
420
+    /**
421
+     * play specified effect for audio mixing
422
+     *
423
+     * This methos plays the specified effect of audio mixing file by option config.
424
+     * @param options {@link PlayEffectOption}
425
+     * @returns Promise<{success, value}>
426
+     */
427
+    static playEffect(options: PlayEffectOption): Promise<any>;
428
+    /**
429
+     * stop play effect for audio mixing
430
+     *
431
+     * This methods stops the specified effect for audio mixing file by soundid.
432
+     * @param sounid
433
+     * @returns Promise<{success, value}>
434
+     */
435
+    static stopEffect(soundId: number): Promise<any>;
436
+    /**
437
+     * stop play all for effect audio mixing.
438
+     *
439
+     * This methods stops all effect audio mixing.
440
+     * @returns Promise<{success, value}>
441
+     */
442
+    static stopAllEffects(): Promise<any>;
443
+    /**
444
+     * preload effect for audio mixing file.
445
+     *
446
+     * This methods preloads the specified audio mixing file to memory by the soundid
447
+     * @param soundid
448
+     * @param filepath
449
+     * @returns Promise<{success, value}>
450
+     */
451
+    static preloadEffect(soundId: number, filepath: string): Promise<any>;
452
+    /**
453
+     * unload effect
454
+     *
455
+     * This methods unload the already loaded audio mixing file from memory by the soundid.
456
+     * @param soundid
457
+     * @returns Promise<{success, value}>
458
+     */
459
+    static unloadEffect(soundId: number): Promise<any>;
460
+    /**
461
+     * pause the specified effect for audio mixing by soundid
462
+     *
463
+     * This method pauses the specified effect for audio mixing by soundid.
464
+     * @param soundid
465
+     * @returns Promise<{success, value}>
466
+     */
467
+    static pauseEffect(soundId: number): Promise<any>;
468
+    /**
469
+     * pause all effects for audio mixing
470
+     *
471
+     * This method pause all effects for audio mixing.
472
+     * @param soundid
473
+     * @returns Promise<{success, value}>
474
+     */
475
+    static pauseAllEffects(): Promise<any>;
476
+    /**
477
+     * resume audio mixing effect by the specified soundid
478
+     *
479
+     * This method resumes audio mixing effect by the specified soundid
480
+     * @param soundid
481
+     * @returns Promise<{success, value}>
482
+     */
483
+    static resumeEffect(soundId: number): Promise<any>;
484
+    /**
485
+     * resume all audio mixing effects.
486
+     *
487
+     * This method resumes all audio mixing effects.
488
+     * @returns Promise<{success, value}>
489
+     */
490
+    static resumeAllEffects(): Promise<any>;
491
+    /**
492
+     * start audio recording by quality
493
+     *
494
+     * This method start audio recording by quality config
495
+     * @param options {@link AudioRecordingOption}
496
+     * @returns Promise<{success, value}>
497
+     */
498
+    static startAudioRecording(options: AudioRecordingOption): Promise<any>;
499
+    /**
500
+     * stop audio recording
501
+     *
502
+     * This method stops audio recording.
503
+     * @returns Promise<{success, value}>
504
+     */
505
+    static stopAudioRecording(): Promise<any>;
506
+    /**
507
+     * set audio session operation restriction
508
+     *
509
+     * The SDK and the app can both configure the audio session by default. The app may occasionally use other apps or third-party components to manipulate the audio session and restrict the SDK from doing so. This method allows the app to restrict the SDK’s manipulation of the audio session.
510
+     * You can call this method at any time to return the control of the audio sessions to the SDK.
511
+     * This method restricts the SDK’s manipulation of the audio session. Any operation to the audio session relies solely on the app, other apps, or third-party components.
512
+     * @notice iOS support only
513
+     */
514
+    static setAudioSessionOperationRestriction(): void;
515
+    /**
516
+     * @deprecated
517
+     * start echo test
518
+     *
519
+     * This method launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
520
+     * @returns Promise<{success, value}>
521
+     */
522
+    /**
523
+     * stop echo test
524
+     *
525
+     * This method stop launched an audio call test.
526
+     * @returns Promise<{success, value}>
527
+     */
528
+    static stopEchoTest(): Promise<any>;
529
+    /**
530
+     * enable lastmile test
531
+     *
532
+     * This method enables the network connection qualit test.
533
+     *
534
+     * @returns Promise<{success, value}>
535
+     */
536
+    static enableLastmileTest(): Promise<any>;
537
+    /**
538
+     * disable lastmile test
539
+     *
540
+     * This method disable the network connection qualit test.
541
+     *
542
+     * @returns Promise<{success, value}>
543
+     */
544
+    static disableLastmileTest(): Promise<any>;
545
+    /**
546
+     * set recording audio frame parameters
547
+     *
548
+     * This method Sets the audio recording format for the audioFrame callback.
549
+     *
550
+     * @param options {@link RecordingAudioFrameOption}
551
+     * @returns Promise<{success, value}>
552
+     */
553
+    static setRecordingAudioFrameParameters(options: AudioFrameOption): Promise<any>;
554
+    /**
555
+     * set playback audio frame parameters
556
+     *
557
+     * This method Sets the audio frame format for the playbackFrame callback.
558
+     *
559
+     * @param options {@link AudioFrameOption}
560
+     * @returns Promise<{success, value}>
561
+     */
562
+    static setPlaybackAudioFrameParameters(options: AudioFrameOption): Promise<any>;
563
+    /**
564
+     * set mixed audio frame parameters
565
+     *
566
+     * This method Sets the audio frame format for the mixedAudioFrame callback.
567
+     *
568
+     * @param options {@link MixedAudioFrameOption}
569
+     * @returns Promise<{success, value}>
570
+     */
571
+    static setMixedAudioFrameParameters(options: MixedAudioFrameOption): Promise<any>;
572
+    /**
573
+     * add video watermark
574
+     *
575
+     * This method adds video watermark to the local video.
576
+     *
577
+     * @param options {@link ImageOption}
578
+     * @returns Promise<{success, value}>
579
+     */
580
+    static addVideoWatermark(options: ImageOption): Promise<any>;
581
+    /**
582
+     * clear video watermarks
583
+     *
584
+     * This method removes the watermark image from the video stream added by addVideoWatermark.
585
+     *
586
+     * @returns Promise<{success, value}>
587
+     */
588
+    static removclearVideoWatermarkse(): Promise<any>;
589
+    /**
590
+     * set local publish fallback
591
+     *
592
+     * This method sets the fallback option for the locally published video stream based on the network conditions.
593
+     *
594
+     * @param option {0, 1, 2}  [more details](https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_constants.html#a3e453c93766e783a7e5eca05b1776238)
595
+     * @returns Promise<{success, value}>
596
+     */
597
+    static setLocalPublishFallbackOption(option: number): Promise<any>;
598
+    /**
599
+     * set remote publish fallback
600
+     *
601
+     * This method sets the fallback option for the remotely subscribed video stream based on the network conditions.
602
+     *
603
+     * @param option {0, 1, 2} [more details](https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_constants.html#a3e453c93766e783a7e5eca05b1776238)
604
+     * @returns Promise<{success, value}>
605
+     */
606
+    static setRemoteSubscribeFallbackOption(option: number): Promise<any>;
607
+    /**
608
+     * enable dual stream mode
609
+     *
610
+     * This method enables the dual stream by parameter mode.
611
+     *
612
+     * @param enabled
613
+     * @returns Promise<{success, value}>
614
+     */
615
+    static enableDualStreamMode(enabled: boolean): Promise<any>;
616
+    /**
617
+     * set remote video stream type
618
+     *
619
+     * This method sets the remote video stream type by uid and streamType.
620
+     *
621
+     * @param options {@link VideoStreamOption}
622
+     * @returns Promise<{success, value}>
623
+     */
624
+    static setRemoteVideoStreamType(options: VideoStreamOption): Promise<any>;
625
+    /**
626
+     * set remote default video stream type
627
+     *
628
+     * This method sets the default video stream type.
629
+     *
630
+     * @param options {@link DefaultVideoStreamOption}
631
+     * @returns Promise<{success, value}>
632
+     */
633
+    static setRemoteDefaultVideoStreamType(options: DefaultVideoStreamOption): Promise<any>;
634
+    /**
635
+     * add inject stream url
636
+     *
637
+     * This method injects an online media stream to a live broadcast.
638
+     *
639
+     * @param options {@link InjectStreamOption}
640
+     * @returns Promise<{success, value}>
641
+     */
642
+    static addInjectStreamUrl(options: InjectStreamOption): Promise<any>;
643
+    /**
644
+     * remove inject stream url
645
+     *
646
+     * This method removes stream by addInjectsStreamUrl.
647
+     *
648
+     * @param options {@link RemoveInjectStreamOption}
649
+     * @returns Promise<{success, value}>
650
+     */
651
+    static removeInjectStreamUrl(options: RemoveInjectStreamOption): Promise<any>;
652
+    /**
653
+     * @deprecated
654
+     * set video quality
655
+     *
656
+     * This method sets the preferences for the video quality. (Live broadcast only).
657
+     *
658
+     * @param quality boolean
659
+     * @returns Promise<{success, value}>
660
+     */
661
+    /**
662
+     * set local video mirror mode
663
+     *
664
+     * This method sets local video mirror mode
665
+     *
666
+     * @param mode
667
+     * @returns Promise<{success, value}>
668
+     */
669
+    static setLocalVideoMirrorMode(mode: number): Promise<any>;
670
+    /**
671
+     * switch camera
672
+     *
673
+     * This method switches camera between front and rear.
674
+     *
675
+     * @returns Promise<{success, value}>
676
+     */
677
+    static switchCamera(): Promise<any>;
678
+    /**
679
+     * is camera zoom supported
680
+     *
681
+     * This method checks whether the camera zoom function is supported.
682
+     *
683
+     * @returns Promise<{success, value}>
684
+     */
685
+    static isCameraZoomSupported(): Promise<any>;
686
+    /**
687
+     * is camera torch supported
688
+     *
689
+     * This method checks whether the camera flash function is supported.
690
+     *
691
+     * @returns Promise<{success, value}>
692
+     */
693
+    static isCameraTorchSupported(): Promise<any>;
694
+    /**
695
+     * is camera focus supported
696
+     *
697
+     * This method checks whether the camera mannual focus function is supported.
698
+     *
699
+     * @returns Promise<{success, value}>
700
+     */
701
+    static isCameraFocusSupported(): Promise<any>;
702
+    /**
703
+     * is camera exposure position supported
704
+     *
705
+     * This method checks whether the camera mannual exposure function is supported.
706
+     *
707
+     * @returns Promise<{success, value}>
708
+     */
709
+    static isCameraExposurePositionSupported(): Promise<any>;
710
+    /**
711
+     * is camera auto focus face mode supported
712
+     *
713
+     * This method checks whether the camera mannual auto-face focus function is supported.
714
+     *
715
+     * @returns Promise<{success, value}>
716
+     */
717
+    static isCameraAutoFocusFaceModeSupported(): Promise<any>;
718
+    /**
719
+     * set camera zoom ratio
720
+     *
721
+     * This method sets the camera zoom ratio.
722
+     *
723
+     * @param zoomFactor
724
+     * @returns Promise<{success, value}>
725
+     */
726
+    static setCameraZoomFactor(zoomFactor: number): Promise<any>;
727
+    /**
728
+     * get camera max zoom ratio
729
+     *
730
+     * This method gets the camera maximum zoom ratio.
731
+     *
732
+     * @notice Android Only
733
+     * @returns Promise<{success, value}>
734
+     */
735
+    static getCameraMaxZoomFactor(): Promise<any>;
736
+    /**
737
+     * set camera focus position in preview
738
+     *
739
+     * This method sets the mannual focus position.
740
+     *
741
+     * @param options {@link PositionOption}
742
+     * @returns Promise<{success, value}>
743
+     */
744
+    static setCameraFocusPositionInPreview(options: PositionOption): Promise<any>;
745
+    /**
746
+     * set camera exposure position
747
+     *
748
+     * This method sets the mannual exposure position.
749
+     *
750
+     * @param options {@link PositionOption}
751
+     * @returns Promise<{success, value}>
752
+     */
753
+    static setCameraExposurePosition(options: PositionOption): Promise<any>;
754
+    /**
755
+     * set camera torch on
756
+     *
757
+     * This method enables the camera flash function.
758
+     *
759
+     * @param enabled
760
+     * @returns Promise<{success, value}>
761
+     */
762
+    static setCameraTorchOn(enabled: boolean): Promise<any>;
763
+    /**
764
+     * set enable auto focus face mode
765
+     *
766
+     * This method enables auto-focus face mode function.
767
+     *
768
+     * @param enabled boolean
769
+     * @returns Promise<{success, value}>
770
+     */
771
+    static setCameraAutoFocusFaceModeEnabled(enabled: boolean): Promise<any>;
772
+    /**
773
+     * get call id
774
+     *
775
+     * This method is used to get call id.
776
+     *
777
+     * @returns Promise<{success, value}>
778
+     */
779
+    static getCallId(): Promise<any>;
780
+    /**
781
+     * set log file and log filter
782
+     *
783
+     * This method sets the log file generated path and specified the log level.
784
+     *
785
+     * @param filepath string
786
+     * @param level enum
787
+     * @param maxfileSize integer (KB)
788
+     * @returns Promise<{success, value}>
789
+     */
790
+    static setLog(filepath: string, level: number, maxfileSize: number): Promise<any>;
791
+    /**
792
+     * send stream message
793
+     *
794
+     * This method sends stream message by specified uid
795
+     *
796
+     * @param uid
797
+     * @param data
798
+     * @returns Promise<{success, value}>
799
+     */
800
+    static sendMessage(streamID: number, data: any, reliable: boolean, ordered: boolean): Promise<any>;
801
+    /**
802
+     * add publish stream url
803
+     *
804
+     * This method add publish stream by option.
805
+     *
806
+     * @param options {@link PublishStreamOption}
807
+     * @returns Promise<{success, value}>
808
+     */
809
+    static addPublishStreamUrl(options: PublishStreamOption): Promise<any>;
810
+    /**
811
+     * remove publish stream url
812
+     *
813
+     * This method remove publish stream by options.
814
+     *
815
+     * @param options {@link RemovePublishStreamOption}
816
+     * @returns Promise<{success, value}>
817
+     */
818
+    static removePublishStreamUrl(options: RemovePublishStreamOption): Promise<any>;
819
+    /**
820
+     * set live transcoding
821
+     *
822
+     * This method sets the video layout and audio settings for CDN live.
823
+     *
824
+     * @param options {@link LiveTranscoding}
825
+     * @returns Promise<{success, value}>
826
+     */
827
+    static setLiveTranscoding(options: LiveTranscodingOption): Promise<any>;
828
+    /**
829
+     * get sdk version
830
+     *
831
+     * This method gets the sdk version details and passed it into callback function
832
+     *
833
+     * @param callback to handle resolve from getSdkVersion
834
+     * @param errorHandler to handle reject error from getSdkVersion
835
+     */
836
+    static getSdkVersion(callback: Callback<any>, errorHandler?: Callback<any>): any;
837
+    /**
838
+     * mute local audio stream
839
+     *
840
+     * This method sends/stops sending the local audio.
841
+     *
842
+     * @param enabled
843
+     */
844
+    static muteLocalAudioStream(enabled: boolean): void;
845
+    /**
846
+     * video pre-process/post-process
847
+     *
848
+     * This method enables/disables image enhancement and sets the options.
849
+     *
850
+     * @param enable boolean
851
+     * @param options {@link BeautyOptions}
852
+     * @returns Promise<{success, value}>
853
+     */
854
+    static setBeautyEffectOptions(enabled: boolean, options: BeautyOption): Promise<any>;
855
+    /**
856
+     * set local voice change
857
+     *
858
+     * This method changes local speaker voice with voiceChanger
859
+     *
860
+     * @param voiceChanger integer
861
+     * @voiceChanger value ranges [
862
+     *          0: "The original voice",
863
+     *          1: "An old man’s voice",
864
+     *          2: "A little boy’s voice.",
865
+     *          3: "A little girl’s voice.",
866
+     *          4: "TBD",
867
+     *          5: "Ethereal vocal effects.",
868
+     *          6: "Hulk’s voice."
869
+     *      ]
870
+     * @returns Promise<{success, value}>
871
+     */
872
+    static setLocalVoiceChanger(voiceChanger: number): Promise<any>;
873
+    /**
874
+     * set the preset local voice reverberation effect.
875
+     *
876
+     * This method sets the preset local voice reverberation effect.
877
+     *
878
+     * @param preset integer
879
+     * @returns Promise<{success, value}>
880
+     */
881
+    static setLocalVoiceReverbPreset(preset: number): Promise<any>;
882
+    /**
883
+     * control stereo panning for remote users
884
+     *
885
+     * This method enables/disables stereo panning for remote users.
886
+     *
887
+     * @param enabled boolean
888
+     * @returns Promise<{success, value}>
889
+     */
890
+    static enableSoundPositionIndication(enabled: boolean): Promise<any>;
891
+    /**
892
+     * set the sound position of a remote user
893
+     *
894
+     * This method sets the sound position of a remote user by uid
895
+     *
896
+     * @param uid number | The ID of the remote user
897
+     * @param pan float | The sound position of the remote user. The value ranges from -1.0 to 1.0
898
+     * @pan
899
+     *  0.0: the remote sound comes from the front.
900
+     *  -1.0: the remote sound comes from the left.
901
+     *  1.0: the remote sound comes from the right.
902
+     * @param gain float | Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain.
903
+     * @returns Promise<{success, value}>
904
+     */
905
+    static setRemoteVoicePosition(uid: number, pan: number, gain: number): Promise<any>;
906
+    /**
907
+     * start the lastmile probe test
908
+     *
909
+     * This method start the last-mile network probe test before joining a channel to get the uplink and downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT).
910
+     *
911
+     * @param config LastmileProbeConfig {@link LastmileProbeConfig}
912
+     *
913
+     * @event onLastmileQuality: the SDK triggers this callback within two seconds depending on the network conditions. This callback rates the network conditions with a score and is more closely linked to the user experience.
914
+     * @event onLastmileProbeResult: the SDK triggers this callback within 30 seconds depending on the network conditions. This callback returns the real-time statistics of the network conditions and is more objective.
915
+     * @returns Promise<{success, value}>
916
+     */
917
+    static startLastmileProbeTest(config: LastmileProbeConfig): Promise<any>;
918
+    /**
919
+     * stop the lastmile probe test
920
+     *
921
+     * This method stop the lastmile probe test.
922
+     *
923
+     * @returns Promise<{success, value}>
924
+     */
925
+    static stopLastmileProbeTest(): Promise<any>;
926
+    /**
927
+     * sets the priority of a remote user's media stream.
928
+     *
929
+     * note: Use this method with the setRemoteSubscribeFallbackOption method. If the fallback function is enabled for a subscribed stream, the SDK ensures the high-priority user gets the best possible stream quality.
930
+     *
931
+     * This method sets the priority of a remote user's media stream.
932
+     * @param uid number
933
+     * @param userPriority number | The value range is  [50 is "user's priority is hgih", 100 is "the default user's priority is normal"]
934
+     *
935
+     * @returns Promise<{success, value}>
936
+     */
937
+    static setRemoteUserPriority(uid: number, userPrority: number): Promise<any>;
938
+    /**
939
+     * start an audio call test.
940
+     *
941
+     * note:
942
+     *   Call this method before joining a channel.
943
+     *   After calling this method, call the stopEchoTest method to end the test. Otherwise, the app cannot run the next echo test, or call the joinchannel method.
944
+     *   In the Live-broadcast profile, only a host can call this method.
945
+     * This method will start an audio call test with interval parameter.
946
+     * In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly.
947
+     *
948
+     * @param interval number
949
+     *
950
+     * @returns Promise<{success, value}>
951
+     */
952
+    static startEchoTestWithInterval(interval: number): Promise<any>;
953
+    /**
954
+     * set the camera capture preference.
955
+     *
956
+     * note:
957
+     *  For a video call or live broadcast, generally the SDK controls the camera output parameters. When the default camera capture settings do not meet special requirements or cause performance problems, we recommend using this method to set the camera capture preference:
958
+     *  If the resolution or frame rate of the captured raw video data are higher than those set by setVideoEncoderConfiguration, processing video frames requires extra CPU and RAM usage and degrades performance. We recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1) to avoid such problems.
959
+     *  If you do not need local video preview or are willing to sacrifice preview quality, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1) to optimize CPU and RAM usage.
960
+     *  If you want better quality for the local video preview, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PREVIEW(2).
961
+     *
962
+     * This method will set the camera capture preference.
963
+     *
964
+     * @param config {@link CameraCapturerConfiguration}
965
+     *
966
+     * @returns Promise<{success, value}>
967
+     */
968
+    static setCameraCapturerConfiguration(config: CameraCapturerConfiguration): Promise<any>;
969
+}
970
+export default RtcEngine;

+ 2
- 0
lib/index.d.ts View File

@@ -0,0 +1,2 @@
1
+export { default as AgoraView } from './AgoraView.native';
2
+export { default as RtcEngine } from './RtcEngine.native';

+ 0
- 10188
package-lock.json
File diff suppressed because it is too large
View File


+ 7
- 7
package.json View File

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "react-native-agora",
3
-  "version": "2.4.0-alpha-1",
3
+  "version": "2.4.0-alpha.2",
4 4
   "description": "React Native around the Agora RTC SDKs for Android and iOS agora",
5 5
   "summary": "agora native sdk for react-native",
6 6
   "main": "lib/index.js",
@@ -36,16 +36,16 @@
36 36
   },
37 37
   "homepage": "https://github.com/syanbo/react-native-agora#readme",
38 38
   "peerDependencies": {
39
-    "react": ">=16.6.0",
40
-    "react-native": ">=0.58.0"
39
+    "react": "16.3.1",
40
+    "react-native": ">=0.55.0"
41 41
   },
42 42
   "devDependencies": {
43 43
     "@types/jest": "^23.3.13",
44
-    "@types/react": "^16.7.20",
45
-    "@types/react-native": "^0.57.31",
44
+    "@types/react": "^16.3.0",
45
+    "@types/react-native": "^0.55.0",
46 46
     "@types/react-test-renderer": "^16.0.3",
47
-    "react": "16.7.0",
48
-    "react-native": "0.58.3",
47
+    "react": "16.3.1",
48
+    "react-native": "0.55.0",
49 49
     "react-native-typescript-transformer": "^1.2.11",
50 50
     "ts-jest": "^23.10.5",
51 51
     "tslint": "^5.12.1",

+ 2
- 0
tsconfig.json View File

@@ -1,5 +1,7 @@
1 1
 {
2 2
   "compilerOptions": {
3
+    "declaration": true,
4
+    "declarationDir": "./lib",
3 5
     "types": [
4 6
       "react",
5 7
       "react-native"