Procházet zdrojové kódy

增加onVideoMute 和 onAudioMute回调

az před 6 roky
rodič
revize
e7a426e7c3

+ 34
- 0
android/src/main/java/com/syan/agora/AgoraModule.java Zobrazit soubor

@@ -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 Zobrazit soubor

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

+ 6
- 6
package.json Zobrazit soubor

@@ -1,7 +1,7 @@
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 5
   "main": "index.js",
6 6
   "scripts": {
7 7
     "pu": "npm publish",
@@ -9,7 +9,7 @@
9 9
   },
10 10
   "repository": {
11 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 14
   "keywords": [
15 15
     "agora",
@@ -24,7 +24,7 @@
24 24
   "author": "",
25 25
   "license": "ISC",
26 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 Zobrazit soubor

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