Bladeren bron

Merge pull request #19 from a1528zhang/master

 增加onVideoMute 和 onAudioMute回调
少言 6 jaren geleden
bovenliggende
commit
da13254200
No account linked to committer's email address
4 gewijzigde bestanden met toevoegingen van 63 en 1 verwijderingen
  1. 34
    0
      android/src/main/java/com/syan/agora/AgoraModule.java
  2. 24
    0
      ios/RCTAgora/RCTAgora.m
  3. 1
    1
      package.json
  4. 4
    0
      yarn.lock

+ 34
- 0
android/src/main/java/com/syan/agora/AgoraModule.java Bestand weergeven

@@ -218,6 +218,40 @@ public class AgoraModule extends ReactContextBaseJavaModule {
218 218
                 }
219 219
             });
220 220
         }
221
+
222
+        /**
223
+         * 用户mute音频回调
224
+         */
225
+        @Override
226
+        public void onUserMuteAudio(final int uid, boolean muted) {
227
+            runOnUiThread(new Runnable() {
228
+                @Override
229
+                public void run() {
230
+                    WritableMap map = Arguments.createMap();
231
+                    map.putString("type", "onUserMuteAudio");
232
+                    map.putInt("uid", uid);
233
+                    map.putBoolean("muted", muted);
234
+                    commonEvent(map);
235
+                }
236
+            });
237
+        }
238
+
239
+        /**
240
+         * 用户mute视频回调
241
+         */
242
+        @Override
243
+        public void onUserMuteVideo(final int uid, boolean muted) {
244
+            runOnUiThread(new Runnable() {
245
+                @Override
246
+                public void run() {
247
+                    WritableMap map = Arguments.createMap();
248
+                    map.putString("type", "onUserMuteVideo");
249
+                    map.putInt("uid", uid);
250
+                    map.putBoolean("muted", muted);
251
+                    commonEvent(map);
252
+                }
253
+            });
254
+        }
221 255
     };
222 256
 
223 257
     @ReactMethod

+ 24
- 0
ios/RCTAgora/RCTAgora.m Bestand weergeven

@@ -333,6 +333,30 @@ RCT_EXPORT_METHOD(getSdkVersion:(RCTResponseSenderBlock)callback){
333 333
     [self sendEvent:params];
334 334
 }
335 335
 
336
+/*
337
+ 用户mute音频回调
338
+ */
339
+- (void)rtcEngine:(AgoraRtcEngineKit *)engine didAudioMuted:(BOOL)muted byUid:(NSUInteger)uid {
340
+    NSMutableDictionary *params = @{}.mutableCopy;
341
+    params[@"type"] = @"onUserMuteAudio";
342
+    params[@"uid"] = [NSNumber numberWithInteger:uid];;
343
+    params[@"muted"] = @(muted);
344
+
345
+    [self sendEvent:params];
346
+}
347
+
348
+/*
349
+ 用户mute视频回调
350
+ */
351
+- (void)rtcEngine:(AgoraRtcEngineKit *)engine didVideoMuted:(BOOL)muted byUid:(NSUInteger)uid {
352
+    NSMutableDictionary *params = @{}.mutableCopy;
353
+    params[@"type"] = @"onUserMuteVideo";
354
+    params[@"uid"] = [NSNumber numberWithInteger:uid];;
355
+    params[@"muted"] = @(muted);
356
+
357
+    [self sendEvent:params];
358
+}
359
+
336 360
 /*
337 361
  音量提示回调
338 362
  需要开启enableAudioVolumeIndication

+ 1
- 1
package.json Bestand weergeven

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "react-native-agora",
3
-  "version": "1.1.1",
3
+  "version": "1.1.2",
4 4
   "description": "声网Agora",
5 5
   "main": "index.js",
6 6
   "scripts": {

+ 4
- 0
yarn.lock Bestand weergeven

@@ -0,0 +1,4 @@
1
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+# yarn lockfile v1
3
+
4
+