Browse Source

Merge pull request #19 from a1528zhang/master

 增加onVideoMute 和 onAudioMute回调
少言 6 years ago
parent
commit
0002f7bd0a
4 changed files with 63 additions and 1 deletions
  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 View File

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
     @ReactMethod
257
     @ReactMethod

+ 24
- 0
ios/RCTAgora/RCTAgora.m View File

333
     [self sendEvent:params];
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
  需要开启enableAudioVolumeIndication
362
  需要开启enableAudioVolumeIndication

+ 1
- 1
package.json View File

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

+ 4
- 0
yarn.lock View File

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