Browse Source

安卓修复

少言 7 years ago
parent
commit
379437ae85

+ 41
- 36
android/react-native-agora.iml View File

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<module external.linked.project.id=":react-native-agora" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../../android" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
2
+<module external.linked.project.id=":react-native-agora" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../../android" external.system.id="GRADLE" version="4">
3 3
   <component name="FacetManager">
4 4
     <facet type="android-gradle" name="Android-Gradle">
5 5
       <configuration>
@@ -28,20 +28,21 @@
28 28
     <output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
29 29
     <exclude-output />
30 30
     <content url="file://$MODULE_DIR$">
31
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
31 32
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
32 33
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
33 34
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
34 35
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
35
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
36 36
       <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
37 37
       <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
38
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
38 39
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
39 40
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
40 41
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
41 42
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
42
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
43 43
       <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
44 44
       <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
45
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
45 46
       <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
46 47
       <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
47 48
       <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
@@ -56,6 +57,13 @@
56 57
       <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
57 58
       <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
58 59
       <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
60
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
61
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
62
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
63
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
64
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
65
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
66
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
59 67
       <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
60 68
       <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
61 69
       <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
@@ -77,51 +85,48 @@
77 85
       <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
78 86
       <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
79 87
       <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
88
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/attr" />
80 89
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
81 90
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
82
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
83
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
84
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fbui.textlayoutbuilder/textlayoutbuilder/1.0.0/jars" />
85
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/drawee/1.3.0/jars" />
86
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/fbcore/1.3.0/jars" />
87
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/fresco/1.3.0/jars" />
88
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline-base/1.3.0/jars" />
89
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline-okhttp3/1.3.0/jars" />
90
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline/1.3.0/jars" />
91
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.react/react-native/0.51.0/jars" />
92
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.soloader/soloader/0.1.0/jars" />
93
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/org.webkit/android-jsc/r174650/jars" />
91
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
92
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
94 93
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
94
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/intermediate-jars" />
95
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
96
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
95 97
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
96 98
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
97 99
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
98 100
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
99 101
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
100 102
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
103
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
104
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
101 105
       <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
106
+      <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
102 107
     </content>
103 108
     <orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
104 109
     <orderEntry type="sourceFolder" forTests="false" />
105
-    <orderEntry type="library" exported="" name="com.facebook.fresco:imagepipeline-okhttp3-1.3.0" level="project" />
106
-    <orderEntry type="library" exported="" name="com.android.support:support-v4-23.0.1" level="project" />
107
-    <orderEntry type="library" exported="" name="com.facebook.fresco:imagepipeline-1.3.0" level="project" />
108
-    <orderEntry type="library" exported="" name="com.squareup.okhttp3:okhttp:3.6.0@jar" level="project" />
109
-    <orderEntry type="library" exported="" name="com.facebook.fresco:fbcore-1.3.0" level="project" />
110
-    <orderEntry type="library" exported="" name="com.facebook.fresco:drawee-1.3.0" level="project" />
111
-    <orderEntry type="library" exported="" name="com.facebook.react:react-native-0.51.0" level="project" />
112
-    <orderEntry type="library" exported="" name="com.android.support:appcompat-v7-23.0.1" level="project" />
113
-    <orderEntry type="library" exported="" name="javax.inject:javax.inject:1@jar" level="project" />
114
-    <orderEntry type="library" exported="" name="com.facebook.fbui.textlayoutbuilder:staticlayout-proxy:1.0@jar" level="project" />
115
-    <orderEntry type="library" exported="" name="com.facebook.fresco:imagepipeline-base-1.3.0" level="project" />
116
-    <orderEntry type="library" exported="" name="com.parse.bolts:bolts-tasks:1.4.0@jar" level="project" />
117
-    <orderEntry type="library" exported="" name="__local_jars__:/Users/dengbo/Documents/GitHub/RNAgoraExample/node_modules/react-native-agora/android/libs/agora-rtc-sdk.jar:unspecified@jar" level="project" />
118
-    <orderEntry type="library" exported="" name="com.google.code.findbugs:jsr305:3.0.0@jar" level="project" />
119
-    <orderEntry type="library" exported="" name="com.squareup.okhttp3:okhttp-urlconnection:3.6.0@jar" level="project" />
120
-    <orderEntry type="library" exported="" name="com.android.support:support-annotations:23.0.1@jar" level="project" />
121
-    <orderEntry type="library" exported="" name="com.facebook.soloader:soloader-0.1.0" level="project" />
122
-    <orderEntry type="library" exported="" name="com.squareup.okio:okio:1.13.0@jar" level="project" />
123
-    <orderEntry type="library" exported="" name="com.facebook.fbui.textlayoutbuilder:textlayoutbuilder-1.0.0" level="project" />
124
-    <orderEntry type="library" exported="" name="com.facebook.fresco:fresco-1.3.0" level="project" />
125
-    <orderEntry type="library" exported="" name="org.webkit:android-jsc-r174650" level="project" />
110
+    <orderEntry type="library" name="com.facebook.fresco:imagepipeline-okhttp3-1.3.0" level="project" />
111
+    <orderEntry type="library" name="com.android.support:support-v4-23.0.1" level="project" />
112
+    <orderEntry type="library" name="com.facebook.fresco:imagepipeline-1.3.0" level="project" />
113
+    <orderEntry type="library" name="com.squareup.okhttp3:okhttp:3.6.0@jar" level="project" />
114
+    <orderEntry type="library" name="com.facebook.fresco:fbcore-1.3.0" level="project" />
115
+    <orderEntry type="library" name="com.facebook.fresco:drawee-1.3.0" level="project" />
116
+    <orderEntry type="library" name="com.facebook.react:react-native-0.51.0" level="project" />
117
+    <orderEntry type="library" name="com.android.support:appcompat-v7-23.0.1" level="project" />
118
+    <orderEntry type="library" name="javax.inject:javax.inject:1@jar" level="project" />
119
+    <orderEntry type="library" name="com.facebook.fbui.textlayoutbuilder:staticlayout-proxy:1.0@jar" level="project" />
120
+    <orderEntry type="library" name="__local_aars__:/Users/dengbo/Documents/GitHub/RNAgoraExample/node_modules/react-native-agora/android/libs/agora-rtc-sdk.jar:unspecified@jar" level="project" />
121
+    <orderEntry type="library" name="com.facebook.fresco:imagepipeline-base-1.3.0" level="project" />
122
+    <orderEntry type="library" name="com.parse.bolts:bolts-tasks:1.4.0@jar" level="project" />
123
+    <orderEntry type="library" name="com.google.code.findbugs:jsr305:3.0.0@jar" level="project" />
124
+    <orderEntry type="library" name="com.squareup.okhttp3:okhttp-urlconnection:3.6.0@jar" level="project" />
125
+    <orderEntry type="library" name="com.android.support:support-annotations:23.0.1@jar" level="project" />
126
+    <orderEntry type="library" name="com.facebook.soloader:soloader-0.1.0" level="project" />
127
+    <orderEntry type="library" name="com.squareup.okio:okio:1.13.0@jar" level="project" />
128
+    <orderEntry type="library" name="com.facebook.fbui.textlayoutbuilder:textlayoutbuilder-1.0.0" level="project" />
129
+    <orderEntry type="library" name="com.facebook.fresco:fresco-1.3.0" level="project" />
130
+    <orderEntry type="library" name="org.webkit:android-jsc-r174650" level="project" />
126 131
   </component>
127 132
 </module>

+ 25
- 0
android/src/main/java/com/syan/agora/AgoraVideoView.java View File

@@ -0,0 +1,25 @@
1
+package com.syan.agora;
2
+
3
+import android.content.Context;
4
+import android.util.AttributeSet;
5
+import android.widget.LinearLayout;
6
+
7
+/**
8
+ * Created by DB on 2017/6/27.
9
+ */
10
+
11
+public class AgoraVideoView extends LinearLayout {
12
+
13
+    public AgoraVideoView(Context context) {
14
+        super(context);
15
+    }
16
+
17
+    public AgoraVideoView(Context context, AttributeSet attrs) {
18
+        super(context, attrs);
19
+    }
20
+
21
+
22
+    public AgoraVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
23
+        super(context, attrs, defStyleAttr);
24
+    }
25
+}

BIN
android/src/main/jniLibs/arm64-v8a/libagora-rtc-sdk-jni.so View File


BIN
android/src/main/jniLibs/armeabi-v7a/libagora-rtc-sdk-jni.so View File


+ 6
- 0
android/src/main/jniLibs/include/IAgoraMediaEngine.h View File

@@ -12,6 +12,11 @@ namespace agora
12 12
 namespace media
13 13
 {
14 14
 
15
+enum MEDIA_SOURCE_TYPE {
16
+    AUDIO_PLAYOUT_SOURCE = 0,
17
+    AUDIO_RECORDING_SOURCE = 1,
18
+};
19
+
15 20
 class IAudioFrameObserver
16 21
 {
17 22
 public:
@@ -166,6 +171,7 @@ public:
166 171
   virtual int registerAudioFrameObserver(IAudioFrameObserver* observer) = 0;
167 172
   virtual int registerVideoFrameObserver(IVideoFrameObserver* observer) = 0;
168 173
   virtual int registerVideoRenderFactory(IExternalVideoRenderFactory* factory) = 0;
174
+  virtual int pushAudioFrame(MEDIA_SOURCE_TYPE type, IAudioFrameObserver::AudioFrame *frame, bool wrap = false){ return -1; }
169 175
 };
170 176
 
171 177
 } //media

+ 190
- 11
android/src/main/jniLibs/include/IAgoraRtcEngine.h View File

@@ -120,18 +120,24 @@ enum WARN_CODE_TYPE
120 120
     WARN_OPEN_CHANNEL_TIMEOUT = 106,
121 121
     WARN_OPEN_CHANNEL_REJECTED = 107,
122 122
 
123
+    // sdk: 100~1000
124
+    WARN_SWITCH_LIVE_VIDEO_TIMEOUT = 111,
125
+    WARN_SET_CLIENT_ROLE_TIMEOUT = 118,
126
+    WARN_OPEN_CHANNEL_INVALID_TICKET = 121,
127
+    WARN_OPEN_CHANNEL_TRY_NEXT_VOS = 122,
123 128
     WARN_AUDIO_MIXING_OPEN_ERROR = 701,
129
+
124 130
     WARN_ADM_RUNTIME_PLAYOUT_WARNING = 1014,
125 131
     WARN_ADM_RUNTIME_RECORDING_WARNING = 1016,
126 132
     WARN_ADM_RECORD_AUDIO_SILENCE = 1019,
127 133
     WARN_ADM_PLAYOUT_MALFUNCTION = 1020,
128 134
     WARN_ADM_RECORD_MALFUNCTION = 1021,
135
+    WARN_ADM_WIN_CORE_NO_RECORDING_DEVICE = 1322,
136
+    WARN_ADM_WIN_CORE_NO_PLAYOUT_DEVICE = 1323,
137
+    WARN_ADM_WIN_CORE_IMPROPER_CAPTURE_RELEASE = 1324,
129 138
     WARN_ADM_RECORD_AUDIO_LOWLEVEL = 1031,
139
+    WARN_ADM_WINDOWS_NO_DATA_READY_EVENT = 1040,
130 140
     WARN_APM_HOWLING = 1051,
131
-
132
-    // sdk: 100~1000
133
-    WARN_SWITCH_LIVE_VIDEO_TIMEOUT = 111,
134
-	WARN_SET_CLIENT_ROLE_TIMEOUT = 118,
135 141
 };
136 142
 
137 143
 enum ERROR_CODE_TYPE
@@ -171,6 +177,7 @@ enum ERROR_CODE_TYPE
171 177
 	ERR_TOO_MANY_DATA_STREAMS = 116,
172 178
 	ERR_STREAM_MESSAGE_TIMEOUT = 117,
173 179
     ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED = 119,
180
+    ERR_CLIENT_IS_BANNED_BY_SERVER = 123,
174 181
 
175 182
     //1001~2000
176 183
     ERR_LOAD_MEDIA_ENGINE = 1001,
@@ -189,11 +196,13 @@ enum ERROR_CODE_TYPE
189 196
     ERR_ADM_RUNTIME_PLAYOUT_ERROR = 1015,
190 197
     ERR_ADM_RUNTIME_RECORDING_ERROR = 1017,
191 198
     ERR_ADM_RECORD_AUDIO_FAILED = 1018,
192
-    ERR_ADM_INIT_LOOPBACK  = 1022,
193
-    ERR_ADM_START_LOOPBACK  = 1023,
199
+    ERR_ADM_INIT_LOOPBACK = 1022,
200
+    ERR_ADM_START_LOOPBACK = 1023,
201
+    ERR_ADM_NO_PERMISSION = 1027,
194 202
     // 1025, as warning for interruption of adm on ios
195 203
     // 1026, as warning for route change of adm on ios
196
-  
204
+    ERR_ADM_ANDROID_JNI_JAVA_RECORD_ERROR = 1115,
205
+
197 206
     // VDM error code starts from 1500
198 207
     ERR_VDM_CAMERA_NOT_AUTHORIZED  = 1501,
199 208
 
@@ -233,6 +242,8 @@ enum MEDIA_ENGINE_EVENT_CODE_TYPE
233 242
     MEDIA_ENGINE_RECORDING_WARNING = 2,
234 243
     MEDIA_ENGINE_PLAYOUT_WARNING = 3,
235 244
     MEDIA_ENGINE_AUDIO_FILE_MIX_FINISH = 10,
245
+    MEDIA_ENGINE_AUDIO_FAREND_MUSIC_BEGINS = 12,
246
+    MEDIA_ENGINE_AUDIO_FAREND_MUSIC_ENDS = 13,
236 247
     // media engine role changed
237 248
     MEDIA_ENGINE_ROLE_BROADCASTER_SOLO = 20,
238 249
     MEDIA_ENGINE_ROLE_BROADCASTER_INTERACTIVE = 21,
@@ -240,7 +251,10 @@ enum MEDIA_ENGINE_EVENT_CODE_TYPE
240 251
     MEDIA_ENGINE_ROLE_COMM_PEER = 23,
241 252
     MEDIA_ENGINE_ROLE_GAME_PEER = 24,
242 253
     // iOS adm sample rate changed
243
-    MEDIA_ENGINE_AUDIO_ADM_REQUIRE_RESTART = 110
254
+    MEDIA_ENGINE_AUDIO_ADM_REQUIRE_RESTART = 110,
255
+    MEDIA_ENGINE_AUDIO_ADM_SPECIAL_RESTART = 111,
256
+    // iOS keep AVAudioSession settings
257
+    MEDIA_ENGINE_AUDIO_KEEP_SESSION_CONFIG = 120
244 258
 };
245 259
 
246 260
 enum MEDIA_DEVICE_STATE_TYPE
@@ -258,6 +272,7 @@ enum MEDIA_DEVICE_TYPE
258 272
     AUDIO_RECORDING_DEVICE = 1,
259 273
     VIDEO_RENDER_DEVICE = 2,
260 274
     VIDEO_CAPTURE_DEVICE = 3,
275
+    AUDIO_APPLICATION_PLAYOUT_DEVICE = 4,
261 276
 };
262 277
 
263 278
 enum AUDIO_RECORDING_QUALITY_TYPE
@@ -332,6 +347,27 @@ enum VIDEO_PROFILE_TYPE
332 347
     VIDEO_PROFILE_DEFAULT = VIDEO_PROFILE_360P,
333 348
 };
334 349
 
350
+enum AUDIO_PROFILE_TYPE // sample rate, bit rate, mono/stereo, speech/music codec
351
+{
352
+    AUDIO_PROFILE_DEFAULT = 0, // use default settings
353
+    AUDIO_PROFILE_SPEECH_STANDARD = 1, // 32Khz, 18kbps, mono, speech
354
+    AUDIO_PROFILE_MUSIC_STANDARD = 2, // 48Khz, 50kbps, mono, music
355
+    AUDIO_PROFILE_MUSIC_STANDARD_STEREO = 3, // 48Khz, 50kbps, stereo, music
356
+    AUDIO_PROFILE_MUSIC_HIGH_QUALITY = 4, // 48Khz, 128kbps, mono, music
357
+    AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO = 5, // 48Khz, 128kbps, stereo, music
358
+    AUDIO_PROFILE_NUM = 6,
359
+};
360
+
361
+enum AUDIO_SCENARIO_TYPE // set a suitable scenario for your app type
362
+{
363
+    AUDIO_SCENARIO_DEFAULT = 0,
364
+    AUDIO_SCENARIO_CHATROOM = 1,
365
+    AUDIO_SCENARIO_EDUCATION = 2,
366
+    AUDIO_SCENARIO_GAME_STREAMING = 3,
367
+    AUDIO_SCENARIO_SHOWROOM = 4,
368
+    AUDIO_SCENARIO_NUM = 5,
369
+};
370
+
335 371
 enum CHANNEL_PROFILE_TYPE
336 372
 {
337 373
 	CHANNEL_PROFILE_COMMUNICATION = 0,
@@ -706,6 +742,14 @@ public:
706 742
     virtual void onAudioMixingFinished() {
707 743
     }
708 744
 
745
+    /**
746
+     * When far-end rhythm begins/ends, these functions will be called
747
+     */
748
+    virtual void onRemoteAudioMixingBegin() {
749
+    }
750
+    virtual void onRemoteAudioMixingEnd() {
751
+    }
752
+
709 753
     /**
710 754
     * When audio effect playback finished, this function will be called
711 755
     */
@@ -878,7 +922,19 @@ public:
878 922
 		(void)enabled;
879 923
 	}
880 924
 	
881
-	/**
925
+    /**
926
+    * when remote user enable local video function, the function will be called
927
+    * @param [in] uid
928
+    *        the UID of the remote user
929
+    * @param [in] enabled
930
+    *        true: the remote user has enabled local video function, false: the remote user has disabled local video function
931
+    */
932
+    virtual void onUserEnableLocalVideo(uid_t uid, bool enabled) {
933
+        (void)uid;
934
+        (void)enabled;
935
+    }
936
+    
937
+    /**
882 938
     * when api call executed completely, the function will be called
883 939
     * @param [in] api
884 940
     *        the api name
@@ -927,6 +983,11 @@ public:
927 983
     * when local user disconnected by accident, the function will be called(then SDK will try to reconnect itself)
928 984
     */
929 985
     virtual void onConnectionInterrupted() {}
986
+
987
+    /**
988
+     * when local user is banned by the server, the function will be called
989
+     */
990
+    virtual void onConnectionBanned() {}
930 991
     
931 992
     virtual void onRefreshRecordingServiceStatus(int status) {
932 993
         (void)status;
@@ -1002,6 +1063,18 @@ public:
1002 1063
     virtual void onActiveSpeaker(uid_t uid) {
1003 1064
         (void)uid;
1004 1065
     }
1066
+
1067
+    /**
1068
+    * when client role is successfully changed, the function will be called
1069
+    */
1070
+    virtual void onClientRoleChanged(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole) {
1071
+    }
1072
+
1073
+    virtual void onAudioDeviceVolumeChanged(MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) {
1074
+        (void)deviceType;
1075
+        (void)volume;
1076
+        (void)muted;
1077
+    }
1005 1078
 };
1006 1079
 
1007 1080
 /**
@@ -1117,6 +1190,10 @@ public:
1117 1190
     */
1118 1191
     virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0;
1119 1192
 
1193
+    virtual int setApplicationVolume(int volume) = 0;
1194
+    virtual int getApplicationVolume(int& volume) = 0;
1195
+    virtual int setApplicationMute(bool mute) = 0;
1196
+    virtual int isApplicationMute(bool& mute) = 0;
1120 1197
     /**
1121 1198
     * release the resource
1122 1199
     */
@@ -1201,6 +1278,11 @@ public:
1201 1278
     * @return return 0 if success or an error code
1202 1279
     */
1203 1280
     virtual int getRecordingDeviceVolume(int *volume) = 0;
1281
+  
1282
+    virtual int setPlaybackDeviceMute(bool mute) = 0;
1283
+    virtual int getPlaybackDeviceMute(bool *mute) = 0;
1284
+    virtual int setRecordingDeviceMute(bool mute) = 0;
1285
+    virtual int getRecordingDeviceMute(bool *mute) = 0;
1204 1286
 
1205 1287
     /**
1206 1288
     * test the playback audio device to know whether it can worked well
@@ -1400,6 +1482,8 @@ public:
1400 1482
     */
1401 1483
     virtual int disableAudio() = 0;
1402 1484
 
1485
+    virtual int setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) = 0;
1486
+
1403 1487
     /**
1404 1488
     * get self call id in the current channel
1405 1489
     * @param [in, out] callId
@@ -1723,7 +1807,12 @@ public:
1723 1807
     }
1724 1808
 
1725 1809
     int setRemoteVideoStreamType(uid_t uid, REMOTE_VIDEO_STREAM_TYPE streamType) {
1726
-        return setObject("rtc.video.set_remote_video_stream", "{\"uid\":%u,\"stream\":%d}", uid, streamType);
1810
+        return setParameters("{\"rtc.video.set_remote_video_stream\":{\"uid\":%u,\"stream\":%d}, \"che.video.setstream\":{\"uid\":%u,\"stream\":%d}}", uid, streamType, uid, streamType);
1811
+//        return setObject("rtc.video.set_remote_video_stream", "{\"uid\":%u,\"stream\":%d}", uid, streamType);
1812
+    }
1813
+
1814
+    int setRemoteDefaultVideoStreamType(REMOTE_VIDEO_STREAM_TYPE streamType) {
1815
+        return m_parameter ? m_parameter->setInt("rtc.video.set_remote_default_video_stream_type", streamType) : -ERR_NOT_INITIALIZED;
1727 1816
     }
1728 1817
 
1729 1818
     /**
@@ -1846,6 +1935,68 @@ public:
1846 1935
     int setAudioMixingPosition(int pos /*in ms*/) {
1847 1936
         return m_parameter ? m_parameter->setInt("che.audio.mixing.file.position", pos) : -ERR_NOT_INITIALIZED;
1848 1937
     }
1938
+    /**
1939
+     * Change the pitch of local speaker's voice
1940
+     * @param [in] pitch
1941
+     *        frequency, in the range of [0.5..2.0], default value is 1.0
1942
+     *
1943
+     * @return return 0 if success or an error code
1944
+     */
1945
+    int setLocalVoicePitch(double pitch) {
1946
+        return m_parameter ? m_parameter->setInt(
1947
+            "che.audio.game_local_pitch_shift",
1948
+            static_cast<int>(pitch * 100)) : -ERR_NOT_INITIALIZED;
1949
+    }
1950
+    /**
1951
+     * Set the audio ears back's volume and effect
1952
+     * @param [in] volume
1953
+     *        set volume of audio ears back, in the range of [0..100], default value is 100
1954
+     *
1955
+     * @return return 0 if success or an error code
1956
+     */
1957
+    int setInEarMonitoringVolume(int volume) {
1958
+        return m_parameter ? m_parameter->setInt("che.audio.headset.monitoring.parameter", volume) : -ERR_NOT_INITIALIZED;
1959
+    }
1960
+    /**
1961
+     *  set audio profile and scenario
1962
+     *  including sample rate, bit rate, mono/stereo, speech/music codec
1963
+     *
1964
+     *  @param [in] profile
1965
+     *              enumeration definition about the audio's samplerate, bitrate, mono/stereo, speech/music codec
1966
+     *  @param [in] scenario
1967
+     *              enumeration definition about the audio scenario
1968
+     *
1969
+     *  @return 0 when executed successfully. return negative value if failed.
1970
+     */
1971
+    int setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) {
1972
+        return setObject(
1973
+            "che.audio.profile",
1974
+            "{\"config\":%d,\"scenario\":%d}",
1975
+            static_cast<int>(profile), static_cast<int>(scenario));
1976
+    }
1977
+
1978
+    /**
1979
+     * disable audio function in channel, which will be recovered when leave channel.
1980
+     * @return return 0 if success or an error code
1981
+     */
1982
+    int pauseAudio() {
1983
+        return m_parameter ? m_parameter->setBool("che.pause.audio", true) : -ERR_NOT_INITIALIZED;
1984
+    }
1985
+
1986
+    /**
1987
+     * resume audio function in channel.
1988
+     * @return return 0 if success or an error code
1989
+     */
1990
+    int resumeAudio() {
1991
+        return m_parameter ? m_parameter->setBool("che.pause.audio", false) : -ERR_NOT_INITIALIZED;
1992
+    }
1993
+
1994
+    int setExternalAudioSource(bool enabled, int sampleRate, int channels) {
1995
+        if (enabled)
1996
+            return setParameters("{\"che.audio.external_capture\":true,\"che.audio.external_capture.push\":true,\"che.audio.set_capture_raw_audio_format\":{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d}}", sampleRate, channels, RAW_AUDIO_FRAME_OP_MODE_TYPE::RAW_AUDIO_FRAME_OP_MODE_READ_WRITE);
1997
+        else
1998
+            return setParameters("{\"che.audio.external_capture\":false,\"che.audio.external_capture.push\":false}");
1999
+    }
1849 2000
 #if defined(__APPLE__)
1850 2001
     /**
1851 2002
      * start screen/windows capture
@@ -1869,6 +2020,20 @@ public:
1869 2020
     int stopScreenCapture() {
1870 2021
         return m_parameter ? m_parameter->setBool("che.video.stop_screen_capture", true) : -ERR_NOT_INITIALIZED;
1871 2022
     }
2023
+
2024
+    /**
2025
+    * update screen capture region
2026
+    *
2027
+    *  @param rect     valid when windowId is 0; whole screen if rect is NULL.
2028
+    *
2029
+    *  @return return 0 if success or an error code
2030
+    */
2031
+    int updateScreenCaptureRegion(const Rect *rect) {
2032
+      if (!rect)
2033
+        return setObject("che.video.update_screen_capture_region", "{}");
2034
+      else
2035
+        return setObject("che.video.update_screen_capture_region", "{\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", rect->top, rect->left, rect->bottom, rect->right);
2036
+    }
1872 2037
 #elif defined(_WIN32)
1873 2038
     /**
1874 2039
      * start screen/windows capture
@@ -1892,6 +2057,20 @@ public:
1892 2057
     int stopScreenCapture() {
1893 2058
         return m_parameter ? m_parameter->setBool("che.video.stop_screen_capture", true) : -ERR_NOT_INITIALIZED;
1894 2059
     }
2060
+
2061
+    /**
2062
+    * update screen capture region
2063
+    *
2064
+    *  @param rect     valid when windowId is 0; whole screen if rect is NULL.
2065
+    *
2066
+    *  @return return 0 if success or an error code
2067
+    */
2068
+    int updateScreenCaptureRegion(const Rect *rect) {
2069
+      if (!rect)
2070
+        return setObject("che.video.update_screen_capture_region", "{}");
2071
+      else
2072
+        return setObject("che.video.update_screen_capture_region", "{\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", rect->top, rect->left, rect->bottom, rect->right);
2073
+    }
1895 2074
 #endif
1896 2075
 
1897 2076
     /**
@@ -1973,7 +2152,7 @@ public:
1973 2152
     }
1974 2153
 
1975 2154
     int enableDualStreamMode(bool enabled) {
1976
-        return setParameters("{\"rtc.dual_stream_mode\":%s,\"che.video.enableLowBitRateStream\":%s}", enabled ? "true" : "false", enabled ? "true" : "false");
2155
+        return setParameters("{\"rtc.dual_stream_mode\":%s,\"che.video.enableLowBitRateStream\":%d}", enabled ? "true" : "false", enabled ? 1 : 0);
1977 2156
     }
1978 2157
 
1979 2158
     int setRecordingAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) {

BIN
android/src/main/jniLibs/x86/libagora-rtc-sdk-jni.so View File


+ 1
- 1
package.json View File

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