Quellcode durchsuchen

upgrade. stage 1 & ios

matrixbirds vor 5 Jahren
Ursprung
Commit
39ba1255fc

+ 3
- 7
ios/RCTAgora/AgoraConst.h Datei anzeigen

@@ -28,19 +28,17 @@ static NSString *AGConnectionLost = @"connectionLost";
28 28
 static NSString *AGTokenPrivilegeWillExpire = @"tokenPrivilegeWillExpire";
29 29
 static NSString *AGRequestToken = @"requestToken";
30 30
 
31
-static NSString *AGMicrophoneEnabled = @"microphoneEnabled";
31
+static NSString *AGLocalAudioStateChanged = @"localAudioStateChanged";
32
+static NSString *AGRemoteAudioStateChanged = @"remoteAudioStateChanged";
33
+static NSString *AGLocalAudioStats = @"localAudioStats";
32 34
 static NSString *AGAudioVolumeIndication = @"audioVolumeIndication";
33 35
 static NSString *AGActiveSpeaker = @"activeSpeaker";
34 36
 static NSString *AGFirstLocalAudioFrame = @"firstLocalAudioFrame";
35 37
 static NSString *AGFirstRemoteAudioFrame = @"firstRemoteAudioFrame";
36 38
 static NSString *AGFirstRemoteAudioDecoded = @"firstRemoteAudioDecoded";
37 39
 static NSString *AGFirstLocalVideoFrame = @"firstLocalVideoFrame";
38
-static NSString *AGFirstRemoteVideoDecoded = @"firstRemoteVideoDecoded";
39 40
 static NSString *AGFirstRemoteVideoFrame = @"firstRemoteVideoFrame";
40 41
 static NSString *AGUserMuteAudio = @"userMuteAudio";
41
-static NSString *AGUserMuteVideo = @"userMuteVideo";
42
-static NSString *AGUserEnableVideo = @"userEnableVideo";
43
-static NSString *AGUserEnableLocalVideo = @"userEnableLocalVideo";
44 42
 static NSString *AGVideoSizeChanged = @"videoSizeChanged";
45 43
 static NSString *AGRemoteVideoStateChanged = @"remoteVideoStateChanged";
46 44
 static NSString *AGLocalPublishFallbackToAudioOnly = @"localPublishFallbackToAudioOnly";
@@ -56,8 +54,6 @@ static NSString *AGNetworkQuality = @"networkQuality";
56 54
 static NSString *AGLocalVideoStats = @"localVideoStats";
57 55
 static NSString *AGRemoteVideoStats = @"remoteVideoStats";
58 56
 static NSString *AGRemoteAudioStats = @"remoteAudioStats";
59
-static NSString *AGAudioTransportStatsOfUid = @"audioTransportStatsOfUid";
60
-static NSString *AGVideoTransportStatsOfUid = @"videoTransportStatsOfUid";
61 57
 
62 58
 static NSString *AGRemoteAudioMixingStart = @"remoteAudioMixingStart";
63 59
 static NSString *AGRemoteAudioMixingFinish = @"remoteAudioMixingFinish";

+ 3
- 7
ios/RCTAgora/AgoraConst.m Datei anzeigen

@@ -44,19 +44,17 @@ static AgoraConst *_person;
44 44
                                   AGTokenPrivilegeWillExpire,
45 45
                                   AGRequestToken,
46 46
                                   
47
-                                  AGMicrophoneEnabled,
47
+                                  AGLocalAudioStateChanged,
48
+                                  AGRemoteAudioStateChanged,
49
+                                  AGLocalAudioStats,
48 50
                                   AGAudioVolumeIndication,
49 51
                                   AGActiveSpeaker,
50 52
                                   AGFirstLocalAudioFrame,
51 53
                                   AGFirstRemoteAudioFrame,
52 54
                                   AGFirstRemoteAudioDecoded,
53 55
                                   AGFirstLocalVideoFrame,
54
-                                  AGFirstRemoteVideoDecoded,
55 56
                                   AGFirstRemoteVideoFrame,
56 57
                                   AGUserMuteAudio,
57
-                                  AGUserMuteVideo,
58
-                                  AGUserEnableVideo,
59
-                                  AGUserEnableLocalVideo,
60 58
                                   AGVideoSizeChanged,
61 59
                                   AGRemoteVideoStateChanged,
62 60
                                   AGLocalPublishFallbackToAudioOnly,
@@ -72,8 +70,6 @@ static AgoraConst *_person;
72 70
                                   AGLocalVideoStats,
73 71
                                   AGRemoteVideoStats,
74 72
                                   AGRemoteAudioStats,
75
-                                  AGAudioTransportStatsOfUid,
76
-                                  AGVideoTransportStatsOfUid,
77 73
                                   
78 74
                                   AGAudioMixingStateChanged,
79 75
                                   AGRemoteAudioMixingStart,

+ 63
- 65
ios/RCTAgora/RCTAgora.m Datei anzeigen

@@ -301,6 +301,18 @@ RCT_EXPORT_METHOD(joinChannel:(NSDictionary *)options
301 301
   }
302 302
 }
303 303
 
304
+// switch channel
305
+RCT_EXPORT_METHOD(switchChannel:(NSDictionary *)options
306
+                  resolve:(RCTPromiseResolveBlock)resolve
307
+                  reject:(RCTPromiseRejectBlock)reject) {
308
+  NSInteger res = [self.rtcEngine switchChannelByToken:options[@"token"] channelId:options[@"channelName"] joinSuccess:nil];
309
+  if (res == 0) {
310
+    resolve(nil);
311
+  } else {
312
+    reject(@(-1).stringValue, @(res).stringValue, nil);
313
+  }
314
+}
315
+
304 316
 // register user account
305 317
 RCT_EXPORT_METHOD(registerLocalUserAccount:(NSDictionary *)options
306 318
                   resolve:(RCTPromiseResolveBlock)resolve
@@ -362,20 +374,26 @@ RCT_EXPORT_METHOD(getUserInfoByUserAccount:(NSString *)userAccount
362 374
 RCT_EXPORT_METHOD(leaveChannel
363 375
                   :(RCTPromiseResolveBlock) resolve
364 376
                   reject:(RCTPromiseRejectBlock) reject) {
365
-  NSInteger res = [self.rtcEngine leaveChannel:^(AgoraChannelStats * _Nonnull stat) {
377
+  NSInteger res = [self.rtcEngine leaveChannel:^(AgoraChannelStats * _Nonnull stats) {
366 378
     [self sendEvent:AGLeaveChannel params:@{
367 379
                                             @"message": @"leaveChannel",
368
-                                            @"duration": @(stat.duration),
369
-                                            @"txBytes": @(stat.txBytes),
370
-                                            @"rxBytes": @(stat.rxBytes),
371
-                                            @"txAudioKBitrate": @(stat.txAudioKBitrate),
372
-                                            @"rxAudioKBitrate": @(stat.rxAudioKBitrate),
373
-                                            @"txVideoKBitrate": @(stat.txVideoKBitrate),
374
-                                            @"rxVideoKBitrate": @(stat.rxVideoKBitrate),
375
-                                            @"lastmileDelay": @(stat.lastmileDelay),
376
-                                            @"userCount": @(stat.userCount),
377
-                                            @"cpuAppUsage": @(stat.cpuAppUsage),
378
-                                            @"cpuTotalUsage": @(stat.cpuTotalUsage)
380
+                                            @"duration": @(stats.duration),
381
+                                            @"txBytes": @(stats.txBytes),
382
+                                            @"rxBytes": @(stats.rxBytes),
383
+                                            @"txAudioBytes": @(stats.txAudioBytes),
384
+                                            @"txVideoBytes": @(stats.txVideoBytes),
385
+                                            @"rxAudioBytes": @(stats.rxAudioBytes),
386
+                                            @"rxVideoBytes": @(stats.rxVideoBytes),
387
+                                            @"txPacketLossRate": @(stats.txPacketLossRate),
388
+                                            @"rxPacketLossRate": @(stats.rxPacketLossRate),
389
+                                            @"txAudioKBitrate": @(stats.txAudioKBitrate),
390
+                                            @"rxAudioKBitrate": @(stats.rxAudioKBitrate),
391
+                                            @"txVideoKBitrate": @(stats.txVideoKBitrate),
392
+                                            @"rxVideoKBitrate": @(stats.rxVideoKBitrate),
393
+                                            @"lastmileDelay": @(stats.lastmileDelay),
394
+                                            @"userCount": @(stats.userCount),
395
+                                            @"cpuAppUsage": @(stats.cpuAppUsage),
396
+                                            @"cpuTotalUsage": @(stats.cpuTotalUsage)
379 397
                                             }];
380 398
   }];
381 399
   if (res == 0) {
@@ -1744,6 +1762,12 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
1744 1762
                                               @"duration": @(stats.duration),
1745 1763
                                               @"txBytes": @(stats.txBytes),
1746 1764
                                               @"rxBytes": @(stats.rxBytes),
1765
+                                              @"txAudioBytes": @(stats.txAudioBytes),
1766
+                                              @"txVideoBytes": @(stats.txVideoBytes),
1767
+                                              @"rxAudioBytes": @(stats.rxAudioBytes),
1768
+                                              @"rxVideoBytes": @(stats.rxVideoBytes),
1769
+                                              @"txPacketLossRate": @(stats.txPacketLossRate),
1770
+                                              @"rxPacketLossRate": @(stats.rxPacketLossRate),
1747 1771
                                               @"txAudioKBitrate": @(stats.txAudioKBitrate),
1748 1772
                                               @"rxAudioKBitrate": @(stats.rxVideoKBitrate),
1749 1773
                                               @"txVideoKBitrate": @(stats.txVideoKBitrate),
@@ -1825,12 +1849,30 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
1825 1849
                                           }];
1826 1850
 }
1827 1851
 
1828
-- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didMicrophoneEnabled:(BOOL)enabled {
1829
-  [self sendEvent:AGMicrophoneEnabled params:@{
1830
-                                               @"enabled": @(enabled)
1852
+- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine localAudioStateChange:(AgoraAudioLocalState)state error:(AgoraAudioLocalError)error {
1853
+  [self sendEvent:AGLocalAudioStateChanged params:@{
1854
+                                               @"state": @(state),
1855
+                                               @"error": @(error)
1831 1856
                                                }];
1832 1857
 }
1833 1858
 
1859
+- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine remoteAudioStateChangedOfUid:(NSUInteger)uid state:(AgoraAudioRemoteState)state reason:(AgoraAudioRemoteStateReason)reason elapsed:(NSInteger)elapsed {
1860
+  [self sendEvent:AGRemoteAudioStateChanged params:@{
1861
+                                                    @"uid": @(uid),
1862
+                                                    @"state": @(state),
1863
+                                                    @"reason": @(reason),
1864
+                                                    @"elapsed": @(elapsed)
1865
+                                                    }];
1866
+}
1867
+
1868
+- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine localAudioStats:(AgoraRtcLocalAudioStats *_Nonnull)stats {
1869
+  [self sendEvent:AGLocalAudioStats params:@{
1870
+                                                     @"numChannels": @(stats.numChannels),
1871
+                                                     @"sentSampleRate": @(stats.sentSampleRate),
1872
+                                                     @"sentBitrate": @(stats.sentBitrate),
1873
+                                                     }];
1874
+}
1875
+
1834 1876
 - (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine reportAudioVolumeIndicationOfSpeakers:(NSArray<AgoraRtcAudioVolumeInfo*> *_Nonnull)speakers totalVolume:(NSInteger)totalVolume {
1835 1877
   NSMutableArray *result = [NSMutableArray new];
1836 1878
   for (AgoraRtcAudioVolumeInfo *speaker in speakers) {
@@ -1879,15 +1921,6 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
1879 1921
                                                   }];
1880 1922
 }
1881 1923
 
1882
-- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstRemoteVideoDecodedOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed {
1883
-  [self sendEvent:AGFirstRemoteVideoDecoded params:@{
1884
-                                                     @"uid": @(uid),
1885
-                                                     @"width": @(size.width),
1886
-                                                     @"height": @(size.height),
1887
-                                                     @"elapsed": @(elapsed)
1888
-                                                     }];
1889
-}
1890
-
1891 1924
 - (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstRemoteVideoFrameOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed {
1892 1925
   [self sendEvent:AGFirstRemoteVideoFrame params:@{
1893 1926
                                                    @"uid": @(uid),
@@ -1903,27 +1936,6 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
1903 1936
                                            }];
1904 1937
 }
1905 1938
 
1906
-- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoMuted:(BOOL)muted byUid:(NSUInteger)uid {
1907
-  [self sendEvent:AGUserMuteVideo params:@{
1908
-                                           @"muted": @(muted),
1909
-                                           @"uid": @(uid)
1910
-                                           }];
1911
-}
1912
-
1913
-- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid {
1914
-  [self sendEvent:AGUserEnableVideo params:@{
1915
-                                             @"enabled": @(enabled),
1916
-                                             @"uid": @(uid)
1917
-                                             }];
1918
-}
1919
-
1920
-- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didLocalVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid {
1921
-  [self sendEvent:AGUserEnableLocalVideo params:@{
1922
-                                                  @"enabled": @(enabled),
1923
-                                                  @"uid": @(uid)
1924
-                                                  }];
1925
-}
1926
-
1927 1939
 - (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation {
1928 1940
   [self sendEvent:AGVideoSizeChanged params:@{
1929 1941
                                               @"uid": @(uid),
@@ -1992,10 +2004,14 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
1992 2004
   [self sendEvent:AGRtcStats params:@{
1993 2005
                                       @"stats": @{
1994 2006
                                           @"duration": @(stats.duration),
1995
-                                          @"txPacketLossRate": @(stats.txPacketLossRate),
1996
-                                          @"rxPacketLossRate": @(stats.rxPacketLossRate),
1997 2007
                                           @"txBytes": @(stats.txBytes),
1998 2008
                                           @"rxBytes": @(stats.rxBytes),
2009
+                                          @"txAudioBytes": @(stats.txAudioBytes),
2010
+                                          @"txVideoBytes": @(stats.txVideoBytes),
2011
+                                          @"rxAudioBytes": @(stats.rxAudioBytes),
2012
+                                          @"rxVideoBytes": @(stats.rxVideoBytes),
2013
+                                          @"txPacketLossRate": @(stats.txPacketLossRate),
2014
+                                          @"rxPacketLossRate": @(stats.rxPacketLossRate),
1999 2015
                                           @"txAudioKBitrate": @(stats.txAudioKBitrate),
2000 2016
                                           @"rxAudioKBitrate": @(stats.rxAudioKBitrate),
2001 2017
                                           @"txVideoKBitrate": @(stats.txVideoKBitrate),
@@ -2050,24 +2066,6 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
2050 2066
                                               }];
2051 2067
 }
2052 2068
 
2053
-- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate {
2054
-  [self sendEvent:AGAudioTransportStatsOfUid params:@{
2055
-                                                      @"uid": @(uid),
2056
-                                                      @"delay": @(delay),
2057
-                                                      @"lost": @(lost),
2058
-                                                      @"rxKBitrate": @(rxKBitRate)
2059
-                                                      }];
2060
-}
2061
-
2062
-- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine videoTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate {
2063
-  [self sendEvent:AGVideoTransportStatsOfUid params:@{
2064
-                                                      @"uid": @(uid),
2065
-                                                      @"delay": @(delay),
2066
-                                                      @"lost": @(lost),
2067
-                                                      @"rxKBitrate": @(rxKBitRate)
2068
-                                                      }];
2069
-}
2070
-
2071 2069
 - (void)rtcEngineRemoteAudioMixingDidStart:(AgoraRtcEngineKit *_Nonnull)engine {
2072 2070
   [self sendEvent:AGRemoteAudioMixingStart params:@{
2073 2071
                                                     @"message": @"RemoteAudioMixingStarted"

+ 18
- 7
lib/RtcEngine.native.d.ts Datei anzeigen

@@ -34,6 +34,21 @@ declare class RtcEngine {
34 34
      * @param info
35 35
      */
36 36
     static joinChannel(channelName: string, uid?: number, token?: string, info?: Object): Promise<any>;
37
+    /**
38
+     * switch to specified channel
39
+     *
40
+     * This method will switch channel smoothly than you invoke leaveChannel & joinChannel.
41
+     * Otherwise, it will invoke error by the event
42
+     * It will occurs two events:
43
+     * Occurs leaveChannel when achieve leaving stage
44
+     * Occurs joinChannelSuccess when achieve joining stage
45
+     * @param channelName
46
+     * @param token
47
+     */
48
+    static switchChannel(channelName: string, token?: string): Promise<any>;
49
+    static startChannelMediaRelay(): void;
50
+    static updateChannelMediaRelay(): void;
51
+    static stopChannelMediaRelay(): void;
37 52
     /**
38 53
      * Registers a user account.
39 54
      *
@@ -117,21 +132,19 @@ declare class RtcEngine {
117 132
      * connectionLost | occurs when sdk connection lost | on("connectionLost", evt) |
118 133
      * tokenPrivilegeWillExpire | occurs when token will expire | on("tokenPrivilegeWillExpire", evt) |
119 134
      * requestToken | occurs when token expired | on("requestToken") |
120
-     * microphoneEnabled | occurs when microphone enable state changed | on("microphoneEnabled", evt) |
135
+     * localAudioStateChanged | occurs when local audio device state changed | on("localAudioStateChanged", (state, errorCode) => {}) |
121 136
      * audioVolumeIndication | occurs when audio volume indication changed | on("audioVolumeIndication", evt) |
122 137
      * activeSpeaker | occurs when detect active speaker | on("activeSpeaker", evt) |
123 138
      * firstLocalAudioFrame | occurs when sent first audio frame on local | on("firstLocalAudioFrame", evt) |
124 139
      * firstRemoteAudioFrame | occurs when received first audio frame from remote side | on("firstRemoteAudioFrame", evt) |
125 140
      * firstRemoteAudioDecoded | occurs when first remote audio decoded | on("firstRemoteAudioDecoded", evt) |
126 141
      * firstLocalVideoFrame | occurs when sent first video frame on local | on("firstLocalVideoFrame", evt) |
127
-     * firstRemoteVideoDecoded | occurs when received first video frame from remote side decoded | on("firstRemoteVideoDecoded", evt) |
128 142
      * firstRemoteVideoFrame | occurs when received first video frame from remote side | on("firstRemoteVideoFrame", evt) |
129 143
      * userMuteAudio | occurs when user mute audio | on("userMuteAudio", evt) |
130
-     * userMuteVideo | occurs when user mute video | on("userMuteVideo", evt) |
131
-     * userEnableVideo | occurs when remote side's user change video enable state | on("userEnableVideo", evt) |
132
-     * userEnableLocalVideo | occurs when user change video enable state on local | on("userEnableLocalVideo", evt) |
133 144
      * videoSizeChanged | occurs when change local or remote side video size or rotation | on("videoSizeChanged", evt) |
134 145
      * remoteVideoStateChanged | occurs when remote video state has any changed | on("remoteVideoStateChanged", evt) |
146
+     * remoteAudioStateChanged | occurs when remote audio state has any changed | on("remoteAudioStateChanged", evt) |
147
+     * localAudioStats | occurs when engine start to report local audio stats | on("localAudioStats", evt) |
135 148
      * localPublishFallbackToAudioOnly | occurs when published stream from local side fallback to audio stream | on("localPublishFallbackToAudioOnly", evt) |
136 149
      * remoteSubscribeFallbackToAudioOnly | occurs when subscribed side's stream fallback to audio stream | on("remoteSubscribeFallbackToAudioOnly", evt) |
137 150
      * audioRouteChanged | occurs when local audio route changed | on("audioRouteChanged", evt) |
@@ -143,8 +156,6 @@ declare class RtcEngine {
143 156
      * localVideoStats | occurs when reports local video statistics | on("localVideoStats", evt) |
144 157
      * remoteVideoStats | occurs when reports remote video statistics| on("remoteVideoStats", evt) |
145 158
      * remoteAudioStats | occurs when reports remote audio statistics| on("remoteAudioStats", evt) |
146
-     * audioTransportStatsOfUid | occurs when reports  transport-layer statistics of each remote audio stream. | on("audioTransportStatsOfUid", evt) |
147
-     * videoTransportStatsOfUid | occurs when reports  transport-layer statistics of each remote video stream.| on("videoTransportStatsOfUid", evt) |
148 159
      * audioEffectFinish | occurs when the local audio effect playback finishes. | on("audioEffectFinish", evt) |
149 160
      * streamPublished | occurs when addPublishStreamUrl success| on("streamPublished", evt) |
150 161
      * streamUnpublish | occurs when removePublishStreamUrl success| on("streamUnpublish", evt) |

+ 24
- 14
lib/RtcEngine.native.js Datei anzeigen

@@ -35,6 +35,26 @@ class RtcEngine {
35 35
     static joinChannel(channelName, uid, token, info) {
36 36
         return Agora.joinChannel({ channelName, uid, token, info });
37 37
     }
38
+    /**
39
+     * switch to specified channel
40
+     *
41
+     * This method will switch channel smoothly than you invoke leaveChannel & joinChannel.
42
+     * Otherwise, it will invoke error by the event
43
+     * It will occurs two events:
44
+     * Occurs leaveChannel when achieve leaving stage
45
+     * Occurs joinChannelSuccess when achieve joining stage
46
+     * @param channelName
47
+     * @param token
48
+     */
49
+    static switchChannel(channelName, token) {
50
+        return Agora.switchChannel({ channelName, token });
51
+    }
52
+    static startChannelMediaRelay() {
53
+    }
54
+    static updateChannelMediaRelay() {
55
+    }
56
+    static stopChannelMediaRelay() {
57
+    }
38 58
     /**
39 59
      * Registers a user account.
40 60
      *
@@ -141,21 +161,19 @@ class RtcEngine {
141 161
      * connectionLost | occurs when sdk connection lost | on("connectionLost", evt) |
142 162
      * tokenPrivilegeWillExpire | occurs when token will expire | on("tokenPrivilegeWillExpire", evt) |
143 163
      * requestToken | occurs when token expired | on("requestToken") |
144
-     * microphoneEnabled | occurs when microphone enable state changed | on("microphoneEnabled", evt) |
164
+     * localAudioStateChanged | occurs when local audio device state changed | on("localAudioStateChanged", (state, errorCode) => {}) |
145 165
      * audioVolumeIndication | occurs when audio volume indication changed | on("audioVolumeIndication", evt) |
146 166
      * activeSpeaker | occurs when detect active speaker | on("activeSpeaker", evt) |
147 167
      * firstLocalAudioFrame | occurs when sent first audio frame on local | on("firstLocalAudioFrame", evt) |
148 168
      * firstRemoteAudioFrame | occurs when received first audio frame from remote side | on("firstRemoteAudioFrame", evt) |
149 169
      * firstRemoteAudioDecoded | occurs when first remote audio decoded | on("firstRemoteAudioDecoded", evt) |
150 170
      * firstLocalVideoFrame | occurs when sent first video frame on local | on("firstLocalVideoFrame", evt) |
151
-     * firstRemoteVideoDecoded | occurs when received first video frame from remote side decoded | on("firstRemoteVideoDecoded", evt) |
152 171
      * firstRemoteVideoFrame | occurs when received first video frame from remote side | on("firstRemoteVideoFrame", evt) |
153 172
      * userMuteAudio | occurs when user mute audio | on("userMuteAudio", evt) |
154
-     * userMuteVideo | occurs when user mute video | on("userMuteVideo", evt) |
155
-     * userEnableVideo | occurs when remote side's user change video enable state | on("userEnableVideo", evt) |
156
-     * userEnableLocalVideo | occurs when user change video enable state on local | on("userEnableLocalVideo", evt) |
157 173
      * videoSizeChanged | occurs when change local or remote side video size or rotation | on("videoSizeChanged", evt) |
158 174
      * remoteVideoStateChanged | occurs when remote video state has any changed | on("remoteVideoStateChanged", evt) |
175
+     * remoteAudioStateChanged | occurs when remote audio state has any changed | on("remoteAudioStateChanged", evt) |
176
+     * localAudioStats | occurs when engine start to report local audio stats | on("localAudioStats", evt) |
159 177
      * localPublishFallbackToAudioOnly | occurs when published stream from local side fallback to audio stream | on("localPublishFallbackToAudioOnly", evt) |
160 178
      * remoteSubscribeFallbackToAudioOnly | occurs when subscribed side's stream fallback to audio stream | on("remoteSubscribeFallbackToAudioOnly", evt) |
161 179
      * audioRouteChanged | occurs when local audio route changed | on("audioRouteChanged", evt) |
@@ -167,8 +185,6 @@ class RtcEngine {
167 185
      * localVideoStats | occurs when reports local video statistics | on("localVideoStats", evt) |
168 186
      * remoteVideoStats | occurs when reports remote video statistics| on("remoteVideoStats", evt) |
169 187
      * remoteAudioStats | occurs when reports remote audio statistics| on("remoteAudioStats", evt) |
170
-     * audioTransportStatsOfUid | occurs when reports  transport-layer statistics of each remote audio stream. | on("audioTransportStatsOfUid", evt) |
171
-     * videoTransportStatsOfUid | occurs when reports  transport-layer statistics of each remote video stream.| on("videoTransportStatsOfUid", evt) |
172 188
      * audioEffectFinish | occurs when the local audio effect playback finishes. | on("audioEffectFinish", evt) |
173 189
      * streamPublished | occurs when addPublishStreamUrl success| on("streamPublished", evt) |
174 190
      * streamUnpublish | occurs when removePublishStreamUrl success| on("streamUnpublish", evt) |
@@ -203,15 +219,11 @@ class RtcEngine {
203 219
             'receiveStreamMessage',
204 220
             'activeSpeaker',
205 221
             'firstRemoteAudioFrame',
206
-            'firstRemoteVideoDecoded',
207 222
             'firstRemoteVideoFrame',
208 223
             'userMuteAudio',
209
-            'userMuteVideo',
210
-            'userEnableVideo',
211
-            'userEnableLocalVideo',
212 224
             'videoSizeChanged',
213
-            'firstRemoteAudioDecoded',
214 225
             'remoteVideoStateChanged',
226
+            'remoteAudioStateChanged',
215 227
             'remoteSubscribeFallbackToAudioOnly',
216 228
             'networkQuality',
217 229
             'streamInjectedStatus',
@@ -248,8 +260,6 @@ class RtcEngine {
248 260
         if ([
249 261
             'remoteAudioStats',
250 262
             'remoteVideoStats',
251
-            'audioTransportStatsOfUid',
252
-            'videoTransportStatsOfUid',
253 263
         ].indexOf(eventType) != -1) {
254 264
             AgoraEventEmitter.addListener(`${RtcEngine.AG_PREFIX}${eventType}`, (args) => {
255 265
                 args.stats.uid = this.Int32ToUint32(args.stats.uid);

+ 1
- 1
lib/RtcEngine.native.js.map
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 1
- 1
package.json Datei anzeigen

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "react-native-agora",
3
-  "version": "2.8.0-alpha.2",
3
+  "version": "2.9.0-alpha.1",
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",

+ 1
- 1
react-native-agora.podspec Datei anzeigen

@@ -20,5 +20,5 @@ Pod::Spec.new do |s|
20 20
     end
21 21
 
22 22
     s.dependency 'React'
23
-    s.dependency "AgoraRtcEngine_iOS", "2.8"
23
+    s.dependency "AgoraRtcEngine_iOS", "2.9"
24 24
 end

+ 31
- 14
src/RtcEngine.native.ts Datei anzeigen

@@ -76,6 +76,33 @@ class RtcEngine {
76 76
         return Agora.joinChannel({channelName, uid, token, info});
77 77
     }
78 78
 
79
+    /**
80
+     * switch to specified channel
81
+     *
82
+     * This method will switch channel smoothly than you invoke leaveChannel & joinChannel.
83
+     * Otherwise, it will invoke error by the event
84
+     * It will occurs two events:
85
+     * Occurs leaveChannel when achieve leaving stage
86
+     * Occurs joinChannelSuccess when achieve joining stage
87
+     * @param channelName
88
+     * @param token
89
+     */
90
+    public static switchChannel(channelName: string, token?: string): Promise<any> {
91
+        return Agora.switchChannel({channelName, token});
92
+    }
93
+    
94
+    public static startChannelMediaRelay() {
95
+
96
+    }
97
+
98
+    public static updateChannelMediaRelay() {
99
+
100
+    }
101
+
102
+    public static stopChannelMediaRelay() {
103
+        
104
+    }
105
+
79 106
     /**
80 107
      * Registers a user account.
81 108
      * 
@@ -182,21 +209,19 @@ class RtcEngine {
182 209
      * connectionLost | occurs when sdk connection lost | on("connectionLost", evt) |
183 210
      * tokenPrivilegeWillExpire | occurs when token will expire | on("tokenPrivilegeWillExpire", evt) |
184 211
      * requestToken | occurs when token expired | on("requestToken") |
185
-     * microphoneEnabled | occurs when microphone enable state changed | on("microphoneEnabled", evt) |
212
+     * localAudioStateChanged | occurs when local audio device state changed | on("localAudioStateChanged", (state, errorCode) => {}) |
186 213
      * audioVolumeIndication | occurs when audio volume indication changed | on("audioVolumeIndication", evt) |
187 214
      * activeSpeaker | occurs when detect active speaker | on("activeSpeaker", evt) |
188 215
      * firstLocalAudioFrame | occurs when sent first audio frame on local | on("firstLocalAudioFrame", evt) |
189 216
      * firstRemoteAudioFrame | occurs when received first audio frame from remote side | on("firstRemoteAudioFrame", evt) |
190 217
      * firstRemoteAudioDecoded | occurs when first remote audio decoded | on("firstRemoteAudioDecoded", evt) |
191 218
      * firstLocalVideoFrame | occurs when sent first video frame on local | on("firstLocalVideoFrame", evt) |
192
-     * firstRemoteVideoDecoded | occurs when received first video frame from remote side decoded | on("firstRemoteVideoDecoded", evt) |
193 219
      * firstRemoteVideoFrame | occurs when received first video frame from remote side | on("firstRemoteVideoFrame", evt) |
194 220
      * userMuteAudio | occurs when user mute audio | on("userMuteAudio", evt) |
195
-     * userMuteVideo | occurs when user mute video | on("userMuteVideo", evt) |
196
-     * userEnableVideo | occurs when remote side's user change video enable state | on("userEnableVideo", evt) |
197
-     * userEnableLocalVideo | occurs when user change video enable state on local | on("userEnableLocalVideo", evt) |
198 221
      * videoSizeChanged | occurs when change local or remote side video size or rotation | on("videoSizeChanged", evt) |
199 222
      * remoteVideoStateChanged | occurs when remote video state has any changed | on("remoteVideoStateChanged", evt) |
223
+     * remoteAudioStateChanged | occurs when remote audio state has any changed | on("remoteAudioStateChanged", evt) |
224
+     * localAudioStats | occurs when engine start to report local audio stats | on("localAudioStats", evt) |
200 225
      * localPublishFallbackToAudioOnly | occurs when published stream from local side fallback to audio stream | on("localPublishFallbackToAudioOnly", evt) |
201 226
      * remoteSubscribeFallbackToAudioOnly | occurs when subscribed side's stream fallback to audio stream | on("remoteSubscribeFallbackToAudioOnly", evt) |
202 227
      * audioRouteChanged | occurs when local audio route changed | on("audioRouteChanged", evt) |
@@ -208,8 +233,6 @@ class RtcEngine {
208 233
      * localVideoStats | occurs when reports local video statistics | on("localVideoStats", evt) | 
209 234
      * remoteVideoStats | occurs when reports remote video statistics| on("remoteVideoStats", evt) | 
210 235
      * remoteAudioStats | occurs when reports remote audio statistics| on("remoteAudioStats", evt) | 
211
-     * audioTransportStatsOfUid | occurs when reports  transport-layer statistics of each remote audio stream. | on("audioTransportStatsOfUid", evt) | 
212
-     * videoTransportStatsOfUid | occurs when reports  transport-layer statistics of each remote video stream.| on("videoTransportStatsOfUid", evt) | 
213 236
      * audioEffectFinish | occurs when the local audio effect playback finishes. | on("audioEffectFinish", evt) | 
214 237
      * streamPublished | occurs when addPublishStreamUrl success| on("streamPublished", evt) | 
215 238
      * streamUnpublish | occurs when removePublishStreamUrl success| on("streamUnpublish", evt) | 
@@ -244,15 +267,11 @@ class RtcEngine {
244 267
             'receiveStreamMessage',
245 268
             'activeSpeaker',
246 269
             'firstRemoteAudioFrame',
247
-            'firstRemoteVideoDecoded',
248 270
             'firstRemoteVideoFrame',
249 271
             'userMuteAudio',
250
-            'userMuteVideo',
251
-            'userEnableVideo',
252
-            'userEnableLocalVideo',
253 272
             'videoSizeChanged',
254
-            'firstRemoteAudioDecoded',
255 273
             'remoteVideoStateChanged',
274
+            'remoteAudioStateChanged',
256 275
             'remoteSubscribeFallbackToAudioOnly',
257 276
             'networkQuality',
258 277
             'streamInjectedStatus',
@@ -295,8 +314,6 @@ class RtcEngine {
295 314
         if ([
296 315
             'remoteAudioStats',
297 316
             'remoteVideoStats',
298
-            'audioTransportStatsOfUid',
299
-            'videoTransportStatsOfUid',   
300 317
         ].indexOf(eventType) != -1) {
301 318
             AgoraEventEmitter.addListener(`${RtcEngine.AG_PREFIX}${eventType}`, (args) => {
302 319
                 args.stats.uid = this.Int32ToUint32(args.stats.uid);