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