Browse Source

增加onVideoMute 和 onAudioMute回调

az 6 years ago
parent
commit
e7a426e7c3
4 changed files with 68 additions and 6 deletions
  1. 34
    0
      android/src/main/java/com/syan/agora/AgoraModule.java
  2. 24
    0
      ios/RCTAgora/RCTAgora.m
  3. 6
    6
      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

+ 6
- 6
package.json View File

1
 {
1
 {
2
-  "name": "react-native-agora",
3
-  "version": "1.1.1",
4
-  "description": "声网Agora",
2
+  "name": "white-react-native-agora",
3
+  "version": "1.0.1",
4
+  "description": "Agora bridge for rn",
5
   "main": "index.js",
5
   "main": "index.js",
6
   "scripts": {
6
   "scripts": {
7
     "pu": "npm publish",
7
     "pu": "npm publish",
9
   },
9
   },
10
   "repository": {
10
   "repository": {
11
     "type": "git",
11
     "type": "git",
12
-    "url": "git+https://github.com/DBshaoYan/react-native-agora.git"
12
+    "url": "git+https://github.com/duty-os/react-native-agora.git"
13
   },
13
   },
14
   "keywords": [
14
   "keywords": [
15
     "agora",
15
     "agora",
24
   "author": "",
24
   "author": "",
25
   "license": "ISC",
25
   "license": "ISC",
26
   "bugs": {
26
   "bugs": {
27
-    "url": "https://github.com/DBshaoYan/react-native-agora/issues"
27
+    "url": "https://github.com/duty-os/react-native-agora/issues"
28
   },
28
   },
29
-  "homepage": "https://github.com/DBshaoYan/react-native-agora#readme"
29
+  "homepage": "https://github.com/duty-os/react-native-agora#readme"
30
 }
30
 }

+ 4
- 0
yarn.lock View File

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