Parcourir la source

refactor. event & exception

matrixbirds il y a 5 ans
Parent
révision
0ac153138a

+ 1
- 1
CHANGELOG Voir le fichier

@@ -3,7 +3,7 @@
3 3
 #### 2.4.1-alpha.2
4 4
 - deprecated `sendMessage` & `createDataStream` & `removeAllListeners`
5 5
 - refactor event system
6
-
6
+- fix `android` enum convert failed.
7 7
 
8 8
 #### 2.4.1-alpha
9 9
 - support 2.4.1-alpha.1 agora video sdk android-2.4.1 / iOS-2.4.1

+ 0
- 68
README.md Voir le fichier

@@ -55,74 +55,6 @@ Either way, then link with:
55 55
 
56 56
 ## [API DOCS](https://syanbo.github.io/react-native-agora/globals.html)
57 57
 
58
-#### Events
59
-
60
-```javascript
61
-RtcEngine.on('eventName', (data) => {
62
-    console.log(data);
63
-});
64
-```
65
-
66
-| Name                      | Description  | Platform |
67
-| ------------------------- | ------------ | ------- |
68
-| warning                 | warning | all |
69
-| error                   | error | all |
70
-| apiCallExecute | capture agora native api call executed| all |
71
-| joinChannelSuccess      | join channel success | all |
72
-| reJoinChannelSuccess      | rejoin channel success | all |
73
-| leaveChannel            | quit channel | all |
74
-| clientRoleChanged | when changed client role | all |
75
-| userJoined              | when user joined channel | all |
76
-| userOffline             | when user left channel | all |
77
-| connectionStateChanged | when connection state changed | all |
78
-| connectionLost | when connection lost | all |
79
-| tokenPrivilegeWillExpire | when token will expire | all |
80
-| requestToken | when token expired | all |
81
-| microphoneEnabled | when microphone enabled | all |
82
-| audioVolumeIndication | notice audio volume | all |
83
-| activeSpeaker | reports which user is the loudest speaker | all |
84
-| firstLocalAudioFrame | when the first local audio frame is sent | all |
85
-| firstRemoteAudioFrame | when the first remote audio frame is sent | all |
86
-| videoStopped | when video stopped | all |
87
-| firstLocalVideoFrame | when first local video frame is sent | all |
88
-| firstRemoteVideoDecoded | when first remote video is decoded | all |
89
-| firstRemoteVideoFrame | when first remote video frame is rendered | all |
90
-| userMuteAudio | when a remote user's audio stream is muted/unmuted | all |
91
-| userMuteVideo | when a remote user's video stream is muted/unmuted | all |
92
-| userEnableVideo | when a remote user enables/disables the video module | all |
93
-| userEnableLocalVideo | when a remote user enables/disables the local video capture function | all |
94
-| videoSizeChanged | when the video size or rotation information of a specified remote user changes | all|
95
-| remoteVideoStateChanged | when the remote video stream state changes | all |
96
-| localPublishFallbackToAudioOnly | Occurs when the published video stream falls back to an audio-only stream due to unreliable network conditions or switches back to the video when the network conditions improve. | all |
97
-| remoteSubscribeFallbackToAudioOnly | Occurs when the remote video stream falls back to an audio-only stream due to unreliable network conditions or switches back to the video after the network conditions improve. | all |
98
-| audioRouteChanged | when the local audio pkayout route changes | all |
99
-| cameraReady | when the camera is turned on and ready to capture video | all |
100
-| cameraFocusAreaChanged | when the camera focus area is changed | all |
101
-| cameraExposureAreaChanged | The camera exposure area has changed | all |
102
-| remoteAudioStats | Reports the statistics of the audio stream from each remote user/host. | all |
103
-| rtcStats | Reports the statistics of the RtcEngine once every two seconds | all |
104
-| lastmileQuality | Reports the last mile network quality of the local user once every two seconds before the user joins the channel. Last mile refers to the connection between the local device and Agora's edge server. After the application calls the enableLastmileTest method, this callback reports once every two seconds the uplink and downlink last mile network conditions of the local user before the user joins the channel. | all |
105
-| networkQuality | Reports the last mile network quality of each user in the channel once every two seconds. Last mile refers to the connection between the local device and Agora's edge server. This callback reports once every two seconds the uplink last mile network conditions of each user in the channel. If a channel includes multiple users, then this callback will be triggered as many times. | all |
106
-| localVideoStats | Reports the statistics of the uploading local video streams. This callback is triggered once every two seconds for each individual user/host. If there are multiple users/hosts in the channel, this callback is triggered multiple times every 2 seconds. | all |
107
-| remoteVideoStats | Reports the statistics of the video stream from each remote user/host. The SDK triggers this callback once every two seconds for each remote user/host. If a channel includes multiple remote users, the SDK triggers this callback as many times. This callback reports statistics more closely linked to the real-user experience of the video transmission quality than the statistics that the onRemoteVideoTransportStats callback reports | all |
108
-| audioTransportStatsOfUid | Reports the transport-layer statistics of each remote audio stream. | all |
109
-| videoTransportStatsOfUid | Reports the transport-layer statistics of each remote video stream. | all |
110
-| localAudioMixingFinish | Occurs when the audio mixing file playback finishes. | all |
111
-| remoteAudioMixingStart | Occurs when a remote user starts audio mixing. | ios |
112
-| remoteAudioMixingFinish | Occurs when a remote user finishes audio mixing. | ios |
113
-| audioEffectFinish | Occurs when the audio effect file playback finishes. | all |
114
-| streamPublished | Occurs when a CDN live stream is published. | all |
115
-| streamUnpublish | Occurs when CDN live streaming stops. This callback notifies the host that the CDN live stream is unpublished. | all |
116
-| transcodingUpdate | Occurs when the publisher's transcoding settings are updated. | all |
117
-| streamInjectedStatus | Reports the status of the injected online media stream. | all |
118
-| receiveStreamMessage | Occurs when the local user receives a remote data stream within five seconds. | all |
119
-| occurStreamMessageError | Occurs when the local user fails to receive a remote data stream. | all |
120
-| mediaEngineLoaded | Occurs when the media engine is loaded. | all |
121
-| mediaEngineStartCall | Occurs when the media engine starts. | all |
122
-| startEchoTestWithInterval | Occurs when you startEchoTestWithInterval | all |
123
-| audioMixingStateChanged | Occurs when audio mixing state changed | all |
124
-| lastmileProbeTestResult | Reports the last-mile network probe result. | all|
125
-
126 58
 ## Resources
127 59
 * Complete [API documentation](https://docs.agora.io/en/) at the Developer Center
128 60
 * [File bugs about this sample](https://github.com/syanbo/react-native-agora/issues)

+ 0
- 2
android/src/main/java/com/syan/agora/AgoraConst.java Voir le fichier

@@ -22,7 +22,6 @@ public class AgoraConst {
22 22
     public final static String AGActiveSpeaker = "activeSpeaker";
23 23
     public final static String AGFirstLocalAudioFrame = "firstLocalAudioFrame";
24 24
     public final static String AGFirstRemoteAudioFrame = "firstRemoteAudioFrame";
25
-    public final static String AGVideoStopped = "videoStopped";
26 25
     public final static String AGFirstLocalVideoFrame = "firstLocalVideoFrame";
27 26
     public final static String AGFirstRemoteVideoDecoded = "firstRemoteVideoDecoded";
28 27
     public final static String AGFirstRemoteVideoFrame = "firstRemoteVideoFrame";
@@ -41,7 +40,6 @@ public class AgoraConst {
41 40
     public final static String AGRemoteSubscribeFallbackToAudioOnly = "remoteSubscribeFallbackToAudioOnly";
42 41
 
43 42
     public final static String AGAudioRouteChanged = "audioRouteChanged";
44
-    public final static String AGCameraReady = "cameraReady";
45 43
     public final static String AGCameraFocusAreaChanged = "cameraFocusAreaChanged";
46 44
     public final static String AGCameraExposureAreaChanged = "cameraExposureAreaChanged";
47 45
 

+ 14
- 5
android/src/main/java/com/syan/agora/AgoraManager.java Voir le fichier

@@ -59,16 +59,22 @@ public class AgoraManager {
59 59
         switch (val) {
60 60
             case 1:
61 61
                 type = FRAME_RATE.FRAME_RATE_FPS_1;
62
+                break;
62 63
             case 7:
63 64
                 type = FRAME_RATE.FRAME_RATE_FPS_7;
65
+                break;
64 66
             case 10:
65 67
                 type = FRAME_RATE.FRAME_RATE_FPS_10;
68
+                break;
66 69
             case 15:
67 70
                 type = FRAME_RATE.FRAME_RATE_FPS_15;
71
+                break;
68 72
             case 24:
69 73
                 type = FRAME_RATE.FRAME_RATE_FPS_24;
74
+                break;
70 75
             case 30:
71 76
                 type = FRAME_RATE.FRAME_RATE_FPS_30;
77
+                break;
72 78
         }
73 79
         return type;
74 80
     }
@@ -78,10 +84,13 @@ public class AgoraManager {
78 84
         switch (val) {
79 85
             case 0:
80 86
                 type = ORIENTATION_MODE.ORIENTATION_MODE_ADAPTIVE;
87
+                break;
81 88
             case 1:
82 89
                 type = ORIENTATION_MODE.ORIENTATION_MODE_FIXED_LANDSCAPE;
90
+                break;
83 91
             case 2:
84 92
                 type = ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT;
93
+                break;
85 94
         }
86 95
         return type;
87 96
     }
@@ -193,7 +202,7 @@ public class AgoraManager {
193 202
 
194 203
     /**
195 204
      * set local video render mode
196
-     * @param Integer renderMode
205
+     * @param renderMode Integer
197 206
      * @return result state
198 207
      */
199 208
     public int setLocalRenderMode(final Integer renderMode) {
@@ -250,12 +259,12 @@ public class AgoraManager {
250 259
         return mRtcEngine.disableLastmileTest();
251 260
     }
252 261
 
253
-    public void startPreview() {
254
-        mRtcEngine.startPreview();
262
+    public int startPreview() {
263
+        return mRtcEngine.startPreview();
255 264
     }
256 265
 
257
-    public void stopPreview() {
258
-        mRtcEngine.stopPreview();
266
+    public int stopPreview() {
267
+        return mRtcEngine.stopPreview();
259 268
     }
260 269
 
261 270
     public int leaveChannel() {

+ 732
- 966
android/src/main/java/com/syan/agora/AgoraModule.java
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 1
- 1
android/src/main/java/com/syan/agora/MediaObserver.java Voir le fichier

@@ -54,6 +54,6 @@ public class MediaObserver implements IMetadataObserver {
54 54
         map.putString("uid", Integer.toString(uid));
55 55
         map.putString("ts", Long.toString(timeStampMs));
56 56
         reactCtx.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
57
-                .emit("mediaMetaDataReceived", map);
57
+                .emit(AgoraConst.AGMediaMetaDataReceived, map);
58 58
     }
59 59
 }

+ 0
- 16
android/src/main/java/com/syan/agora/ReactNativeAgoraException.java Voir le fichier

@@ -1,16 +0,0 @@
1
-package com.syan.agora;
2
-
3
-public class ReactNativeAgoraException extends Exception {
4
-
5
-    private int code;
6
-
7
-    public ReactNativeAgoraException(String message, final int code) {
8
-        super(message);
9
-        this.code = code;
10
-    }
11
-
12
-    public int getCode() {
13
-        return this.code;
14
-    }
15
-
16
-}

+ 0
- 2
ios/RCTAgora/AgoraConst.h Voir le fichier

@@ -32,7 +32,6 @@ static NSString *AGActiveSpeaker = @"activeSpeaker";
32 32
 static NSString *AGFirstLocalAudioFrame = @"firstLocalAudioFrame";
33 33
 static NSString *AGFirstRemoteAudioFrame = @"firstRemoteAudioFrame";
34 34
 static NSString *AGFirstRemoteAudioDecoded = @"firstRemoteAudioDecoded";
35
-static NSString *AGVideoStopped = @"videoStopped";
36 35
 static NSString *AGFirstLocalVideoFrame = @"firstLocalVideoFrame";
37 36
 static NSString *AGFirstRemoteVideoDecoded = @"firstRemoteVideoDecoded";
38 37
 static NSString *AGFirstRemoteVideoFrame = @"firstRemoteVideoFrame";
@@ -46,7 +45,6 @@ static NSString *AGLocalPublishFallbackToAudioOnly = @"localPublishFallbackToAud
46 45
 static NSString *AGRemoteSubscribeFallbackToAudioOnly = @"remoteSubscribeFallbackToAudioOnly";
47 46
 
48 47
 static NSString *AGAudioRouteChanged = @"audioRouteChanged";
49
-static NSString *AGCameraReady = @"cameraReady";
50 48
 static NSString *AGCameraFocusAreaChanged = @"cameraFocusAreaChanged";
51 49
 static NSString *AGCameraExposureAreaChanged = @"cameraExposureAreaChanged";
52 50
 

+ 0
- 2
ios/RCTAgora/AgoraConst.m Voir le fichier

@@ -48,7 +48,6 @@ static AgoraConst *_person;
48 48
                                   AGFirstLocalAudioFrame,
49 49
                                   AGFirstRemoteAudioFrame,
50 50
                                   AGFirstRemoteAudioDecoded,
51
-                                  AGVideoStopped,
52 51
                                   AGFirstLocalVideoFrame,
53 52
                                   AGFirstRemoteVideoDecoded,
54 53
                                   AGFirstRemoteVideoFrame,
@@ -62,7 +61,6 @@ static AgoraConst *_person;
62 61
                                   AGRemoteSubscribeFallbackToAudioOnly,
63 62
                                   
64 63
                                   AGAudioRouteChanged,
65
-                                  AGCameraReady,
66 64
                                   AGCameraFocusAreaChanged,
67 65
                                   AGCameraExposureAreaChanged,
68 66
                                   

+ 1
- 1
ios/RCTAgora/RCTAgora.h Voir le fichier

@@ -13,7 +13,7 @@
13 13
 #import <AgoraRtcEngineKit/AgoraRtcEngineKit.h>
14 14
 
15 15
 @interface RCTAgora : RCTEventEmitter<RCTBridgeModule, AgoraMediaMetadataDelegate, AgoraMediaMetadataDataSource>
16
-- (void) sendEvent:(NSString *)msg params:(NSDictionary *)params;
16
+- (void) sendEvent:(NSString *_Nullable)msg params:(NSDictionary *_Nullable)params;
17 17
 - (NSInteger) metadataMaxSize;
18 18
 - (NSData *_Nullable)readyToSendMetadataAtTimestamp:(NSTimeInterval)timestamp;
19 19
 - (void)receiveMetadata:(NSData *_Nonnull)data fromUser:(NSInteger)uid atTimestamp:(NSTimeInterval)timestamp;

+ 556
- 910
ios/RCTAgora/RCTAgora.m
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 220
- 135
lib/RtcEngine.native.d.ts
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 226
- 156
lib/RtcEngine.native.js
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 1
- 1
lib/RtcEngine.native.js.map
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 259
- 196
src/RtcEngine.native.ts
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier