Skip to content

Commit

Permalink
Merge commit '04070c12d905586037a1d732c9338072a9eaa73d' into rc/4.0.+
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Jun 28, 2021
2 parents a53fcf3 + 04070c1 commit 9eabe45
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
8 changes: 8 additions & 0 deletions android/src/main/java/io/agora/rtc/base/Annotations.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class Annotations {
Constants.LOCAL_AUDIO_STREAM_ERROR_DEVICE_BUSY,
Constants.LOCAL_AUDIO_STREAM_ERROR_CAPTURE_FAILURE,
Constants.LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE,
Constants.LOCAL_AUDIO_STREAM_ERROR_INTERRUPTED,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraAudioLocalError {
Expand Down Expand Up @@ -410,6 +411,8 @@ public class Annotations {
AgoraEncryptionMode.SM4128ECB,
AgoraEncryptionMode.AES128GCM,
AgoraEncryptionMode.AES256GCM,
AgoraEncryptionMode.AES128GCM2,
AgoraEncryptionMode.AES256GCM2,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraEncryptionMode {
Expand All @@ -420,6 +423,8 @@ public class Annotations {
int SM4128ECB = 4;
int AES128GCM = 5;
int AES256GCM = 6;
int AES128GCM2 = 7;
int AES256GCM2 = 8;
}

@IntDef({
Expand Down Expand Up @@ -469,6 +474,7 @@ public class Annotations {
Constants.ERR_PUBLISH_STREAM_NOT_FOUND,
Constants.ERR_PUBLISH_STREAM_FORMAT_NOT_SUPPORTED,
Constants.ERR_MODULE_NOT_FOUND,
Constants.ERR_ALREADY_IN_RECORDING,
Constants.ERR_LOAD_MEDIA_ENGINE,
Constants.ERR_START_CALL,
Constants.ERR_START_CAMERA,
Expand Down Expand Up @@ -610,6 +616,7 @@ public class Annotations {
Constants.RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED,
Constants.RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND,
Constants.RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED,
Constants.RTMP_STREAM_UNPUBLISH_ERROR_OK,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraRtmpStreamingErrorCode {
Expand Down Expand Up @@ -827,6 +834,7 @@ public class Annotations {

@IntDef({
Constants.RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE,
Constants.RTMP_STREAMING_EVENT_URL_ALREADY_IN_USE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraRtmpStreamingEvent {
Expand Down
19 changes: 18 additions & 1 deletion android/src/main/java/io/agora/rtc/base/BeanCovertor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,23 @@ fun mapToChannelMediaOptions(map: Map<*, *>): ChannelMediaOptions {
return ChannelMediaOptions().apply {
(map["autoSubscribeAudio"] as? Boolean)?.let { autoSubscribeAudio = it }
(map["autoSubscribeVideo"] as? Boolean)?.let { autoSubscribeVideo = it }
(map["publishLocalAudio"] as? Boolean)?.let { publishLocalAudio = it }
(map["publishLocalVideo"] as? Boolean)?.let { publishLocalVideo = it }
}
}

fun mapToRtcEngineConfig(map: Map<*, *>): RtcEngineConfig {
return RtcEngineConfig().apply {
mAppId = map["appId"] as String
(map["areaCode"] as? Number)?.toInt()?.let { mAreaCode = it }
(map["areaCode"] as? List<*>)?.let { list ->
var areaCode = 0
for (i in list.indices) {
(list[i] as? Number)?.let {
areaCode = areaCode or it.toInt()
}
}
mAreaCode = areaCode
}
(map["logConfig"] as? Map<*, *>)?.let { mLogConfig = mapToLogConfig(it) }
}
}
Expand All @@ -223,6 +233,13 @@ fun mapToEncryptionConfig(map: Map<*, *>): EncryptionConfig {
return EncryptionConfig().apply {
(map["encryptionMode"] as? Number)?.let { encryptionMode = intToEncryptionMode(it.toInt()) }
(map["encryptionKey"] as? String)?.let { encryptionKey = it }
(map["encryptionKdfSalt"] as? List<*>)?.let { list ->
for (i in list.indices) {
(list[i] as? Number)?.let {
encryptionKdfSalt[i] = it.toByte()
}
}
}
}
}

Expand Down
22 changes: 22 additions & 0 deletions android/src/main/java/io/agora/rtc/base/RtcChannel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ class IRtcChannel {

fun getConnectionState(params: Map<String, *>, callback: Callback)

@Deprecated("")
fun publish(params: Map<String, *>, callback: Callback)

@Deprecated("")
fun unpublish(params: Map<String, *>, callback: Callback)

fun getCallId(params: Map<String, *>, callback: Callback)
Expand All @@ -37,6 +39,8 @@ class IRtcChannel {
interface RtcAudioInterface {
fun adjustUserPlaybackSignalVolume(params: Map<String, *>, callback: Callback)

fun muteLocalAudioStream(params: Map<String, *>, callback: Callback)

fun muteRemoteAudioStream(params: Map<String, *>, callback: Callback)

fun muteAllRemoteAudioStreams(params: Map<String, *>, callback: Callback)
Expand All @@ -46,6 +50,8 @@ class IRtcChannel {
}

interface RtcVideoInterface {
fun muteLocalVideoStream(params: Map<String, *>, callback: Callback)

fun muteRemoteVideoStream(params: Map<String, *>, callback: Callback)

fun muteAllRemoteVideoStreams(params: Map<String, *>, callback: Callback)
Expand Down Expand Up @@ -222,6 +228,14 @@ class RtcChannelManager(
)
}

override fun muteLocalAudioStream(params: Map<String, *>, callback: Callback) {
callback.code(
this[params["channelId"] as String]?.muteLocalAudioStream(
params["muted"] as Boolean
)
)
}

override fun muteRemoteAudioStream(params: Map<String, *>, callback: Callback) {
callback.code(
this[params["channelId"] as String]?.muteRemoteAudioStream(
Expand All @@ -239,6 +253,14 @@ class RtcChannelManager(
callback.code(this[params["channelId"] as String]?.setDefaultMuteAllRemoteAudioStreams(params["muted"] as Boolean))
}

override fun muteLocalVideoStream(params: Map<String, *>, callback: Callback) {
callback.code(
this[params["channelId"] as String]?.muteLocalVideoStream(
params["muted"] as Boolean
)
)
}

override fun muteRemoteVideoStream(params: Map<String, *>, callback: Callback) {
callback.code(
this[params["channelId"] as String]?.muteRemoteVideoStream(
Expand Down

0 comments on commit 9eabe45

Please sign in to comment.