Skip to content

Commit cdbac13

Browse files
committed
feat: support 3.1.+
1 parent 5eb9e9a commit cdbac13

34 files changed

+1143
-131
lines changed

CHANGELOG.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,70 @@
1-
# Change log
1+
## [3.1.6](https://github.com/AgoraIO/Flutter-SDK/compare/v3.1.5...v3.1.6) (2020-12-21)
2+
3+
4+
### Bug Fixes
5+
6+
* `MetadataReceived` event parameters bug ([56ab25b](https://github.com/AgoraIO/Flutter-SDK/commit/56ab25bcf41b9b7034049fb307cca95fdfae3e4c))
7+
* `MetadataReceived` event parameters bug ([9ab28a7](https://github.com/AgoraIO/Flutter-SDK/commit/9ab28a7ae559f3bd5ce8ab8e0455860d9de89977))
8+
* add missing permissions for Android ([fd74959](https://github.com/AgoraIO/Flutter-SDK/commit/fd74959e94d5f43d6ab7a77d197ec450e3421769))
9+
* some rendering problems when change render widget order ([12e2561](https://github.com/AgoraIO/Flutter-SDK/commit/12e25618ce8fabd5bf9b34e418792450518e219e))
10+
* some rendering problems when change render widget order ([95bbf39](https://github.com/AgoraIO/Flutter-SDK/commit/95bbf39ef58bcda58c1b2ba9063d07e631939c69))
11+
* some rendering problems when change render widget order ([c737102](https://github.com/AgoraIO/Flutter-SDK/commit/c737102ecc22e3cb563f9762a88d9b519fdc599f))
12+
* use the better way to fix rendering problems ([a290e73](https://github.com/AgoraIO/Flutter-SDK/commit/a290e7313e3d189dc9ea69e49c0c3be4799a7933))
13+
* use the better way to fix rendering problems ([75f572d](https://github.com/AgoraIO/Flutter-SDK/commit/75f572df2afed36a4bbd3ccffd0baad7bace2eae))
14+
15+
16+
### Features
17+
18+
* example support render multi remote-videos ([72e94b0](https://github.com/AgoraIO/Flutter-SDK/commit/72e94b0aa06332f5477e336ecf28bcbb89141c46))
19+
20+
## [3.1.5](https://github.com/AgoraIO/Flutter-SDK/compare/v3.1.4...v3.1.5) (2020-12-15)
21+
22+
23+
### Bug Fixes
24+
25+
* `RtcSurfaceView` memory leak ([c0f7025](https://github.com/AgoraIO/Flutter-SDK/commit/c0f7025d641c61f47fefcbdc71f988823f513dfc))
26+
* `RtcSurfaceView` memory leak ([c8845fe](https://github.com/AgoraIO/Flutter-SDK/commit/c8845fe04c1596fe2e7242302bf160bc671910cb))
27+
28+
29+
### Features
30+
31+
* example support `switchRender` ([f69c495](https://github.com/AgoraIO/Flutter-SDK/commit/f69c4953b31e551f8ec7259e9e43398e1560fc1d))
32+
33+
## [3.1.4](https://github.com/AgoraIO/Flutter-SDK/compare/v3.1.4-rc.0...v3.1.4) (2020-12-02)
34+
35+
36+
### Bug Fixes
37+
38+
* add lost file ([4e899b7](https://github.com/AgoraIO/Flutter-SDK/commit/4e899b7be469b0f5cc16f4d594e596171a659047))
39+
40+
41+
### Features
42+
43+
* add `getAssetAbsolutePath` to support flutter assets. (fix [#181](https://github.com/AgoraIO/Flutter-SDK/issues/181)) ([b158d7d](https://github.com/AgoraIO/Flutter-SDK/commit/b158d7d67b790f7c1773bf6b58afb64378c0ff5b))
44+
* optimize for other platforms ([0df4a28](https://github.com/AgoraIO/Flutter-SDK/commit/0df4a28c813e0c9a9a3fa632bf0da49b30a71394))
45+
46+
## [3.1.4-rc.0](https://github.com/AgoraIO/Flutter-SDK/compare/3.1.3...v3.1.4-rc.0) (2020-10-23)
47+
48+
49+
### Bug Fixes
50+
51+
* `getUserInfoByUid` `getUserInfoByUserAccount` type cast error, resolve [#204](https://github.com/AgoraIO/Flutter-SDK/issues/204) ([cb75715](https://github.com/AgoraIO/Flutter-SDK/commit/cb757152f81717fb640771e38e489fb0a268b2d6))
52+
* events.dart `joinChannelSuccess` `rejoinChannelSuccess` bug ([b25771f](https://github.com/AgoraIO/Flutter-SDK/commit/b25771f73be3dd8a4ac2cfbce435f78e824ba0e6))
53+
* rtc_engine `destroy` bug ([263ad09](https://github.com/AgoraIO/Flutter-SDK/commit/263ad09c0b20073eb10c4d8cdd2c5a1e7ad87fd4))
54+
55+
56+
### Features
57+
58+
* add API example ([1b01711](https://github.com/AgoraIO/Flutter-SDK/commit/1b01711ccdac0ea182afd71735e791af5a008bae))
59+
* Android add getNativeHandle ([0eab471](https://github.com/AgoraIO/Flutter-SDK/commit/0eab47114cde933482f90879e177fd019430cafd))
60+
* iOS add getNativeHandle ([1a4833e](https://github.com/AgoraIO/Flutter-SDK/commit/1a4833eadd97d48149bcac04549bc7debbaf5e36))
61+
62+
## 3.1.3
63+
* fix `setDefaultAudioRoutetoSpeakerphone` crash bug
64+
* add `setAudioSessionOperationRestriction` and `sendCustomReportMessage` method
65+
66+
## 3.1.2
67+
* upgrade Agora SDK to 3.1.2
268

369
## 3.0.1-dev.7
470
* fix android `VideoSizeChanged` bug
@@ -14,7 +80,7 @@
1480
* fix `startPreview` `stopPreview` bug
1581

1682
## 3.0.1-dev.3
17-
* fix `toJson` bug
83+
* fix `toJson` bug
1884
* add `startPreview` `stopPreview`
1985

2086
## 3.0.1-dev.2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Open the `AndroidManifest.xml` file and add the required device permissions to t
3535
<uses-permission android:name="android.permission.CAMERA" />
3636
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
3737
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
38-
38+
3939
<!-- The Agora SDK requires Bluetooth permissions in case users are using Bluetooth devices.-->
4040
<uses-permission android:name="android.permission.BLUETOOTH" />
4141
...

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ android {
5252
dependencies {
5353
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${safeExtGet('kotlin_version', '1.3.72')}"
5454
implementation "org.jetbrains.kotlin:kotlin-reflect:${safeExtGet('kotlin_version', '1.3.72')}"
55-
implementation "io.agora.rtc:full-sdk:3.0.1.1"
55+
implementation "io.agora.rtc:full-sdk:3.1.3"
5656
}

android/src/main/java/io/agora/rtc/base/Annotations.java

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.agora.rtc.base;
22

33
import androidx.annotation.IntDef;
4-
import androidx.annotation.StringDef;
54

65
import java.lang.annotation.Retention;
76
import java.lang.annotation.RetentionPolicy;
@@ -389,16 +388,20 @@ public class Annotations {
389388
int MAINTAIN_BALANCED = 2;
390389
}
391390

392-
@StringDef({
391+
@IntDef({
392+
AgoraEncryptionMode.NONE,
393393
AgoraEncryptionMode.AES128XTS,
394-
AgoraEncryptionMode.AES256XTS,
395394
AgoraEncryptionMode.AES128ECB,
395+
AgoraEncryptionMode.AES256XTS,
396+
AgoraEncryptionMode.SM4128ECB,
396397
})
397398
@Retention(RetentionPolicy.SOURCE)
398399
public @interface AgoraEncryptionMode {
399-
String AES128XTS = "aes-128-xts";
400-
String AES256XTS = "aes-256-xts";
401-
String AES128ECB = "aes-128-ecb";
400+
int NONE = 0;
401+
int AES128XTS = 1;
402+
int AES128ECB = 2;
403+
int AES256XTS = 3;
404+
int SM4128ECB = 4;
402405
}
403406

404407
@IntDef({
@@ -422,6 +425,7 @@ public class Annotations {
422425
Constants.ERR_ALREADY_IN_USE,
423426
Constants.ERR_INVALID_APP_ID,
424427
Constants.ERR_INVALID_CHANNEL_NAME,
428+
Constants.ERR_NO_SERVER_RESOURCES,
425429
Constants.ERR_TOKEN_EXPIRED,
426430
Constants.ERR_INVALID_TOKEN,
427431
Constants.ERR_CONNECTION_INTERRUPTED,
@@ -751,26 +755,57 @@ public class Annotations {
751755
Constants.WARN_ADM_RUNTIME_PLAYOUT_WARNING,
752756
Constants.WARN_ADM_RUNTIME_RECORDING_WARNING,
753757
Constants.WARN_ADM_RECORD_AUDIO_SILENCE,
758+
Constants.WARN_ADM_PLAYOUT_ABNORMAL_FREQUENCY,
759+
Constants.WARN_ADM_RECORD_ABNORMAL_FREQUENCY,
754760
Constants.WARN_ADM_CALL_INTERRUPTION,
755761
Constants.WARN_ADM_RECORD_AUDIO_LOWLEVEL,
756762
Constants.WARN_ADM_PLAYOUT_AUDIO_LOWLEVEL,
757763
Constants.WARN_ADM_RECORD_IS_OCCUPIED,
758764
Constants.WARN_APM_HOWLING,
759765
Constants.WARN_ADM_GLITCH_STATE,
760-
Constants.WARN_ADM_IMPROPER_SETTINGS,
766+
Constants.WARN_APM_RESIDUAL_ECHO,
761767
})
762768
@Retention(RetentionPolicy.SOURCE)
763769
public @interface AgoraWarningCode {
764770
}
765771

766772
@IntDef({
767-
RtcEngineConfig.IPAreaCode.AREA_CN,
768-
RtcEngineConfig.IPAreaCode.AREA_NA,
769-
RtcEngineConfig.IPAreaCode.AREA_EUR,
770-
RtcEngineConfig.IPAreaCode.AREA_AS,
771-
RtcEngineConfig.IPAreaCode.AREA_GLOBAL,
773+
RtcEngineConfig.AreaCode.AREA_CODE_CN,
774+
RtcEngineConfig.AreaCode.AREA_CODE_NA,
775+
RtcEngineConfig.AreaCode.AREA_CODE_EU,
776+
RtcEngineConfig.AreaCode.AREA_CODE_AS,
777+
RtcEngineConfig.AreaCode.AREA_CODE_JP,
778+
RtcEngineConfig.AreaCode.AREA_CODE_IN,
779+
RtcEngineConfig.AreaCode.AREA_CODE_GLOB,
772780
})
773781
@Retention(RetentionPolicy.SOURCE)
774782
public @interface AgoraAreaCode {
775783
}
784+
785+
@IntDef({
786+
Constants.SUB_STATE_IDLE,
787+
Constants.SUB_STATE_NO_SUBSCRIBED,
788+
Constants.SUB_STATE_SUBSCRIBING,
789+
Constants.SUB_STATE_SUBSCRIBED,
790+
})
791+
@Retention(RetentionPolicy.SOURCE)
792+
public @interface AgoraStreamSubscribeState {
793+
}
794+
795+
@IntDef({
796+
Constants.PUB_STATE_IDLE,
797+
Constants.PUB_STATE_NO_PUBLISHED,
798+
Constants.PUB_STATE_PUBLISHING,
799+
Constants.PUB_STATE_PUBLISHED,
800+
})
801+
@Retention(RetentionPolicy.SOURCE)
802+
public @interface AgoraStreamPublishState {
803+
}
804+
805+
@IntDef({
806+
Constants.RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE,
807+
})
808+
@Retention(RetentionPolicy.SOURCE)
809+
public @interface AgoraRtmpStreamingEvent {
810+
}
776811
}

android/src/main/java/io/agora/rtc/base/BeanCovertor.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.agora.rtc.base
22

33
import android.graphics.Color
44
import io.agora.rtc.RtcEngineConfig
5+
import io.agora.rtc.internal.EncryptionConfig
56
import io.agora.rtc.internal.LastmileProbeConfig
67
import io.agora.rtc.live.LiveInjectStreamConfig
78
import io.agora.rtc.live.LiveTranscoding
@@ -177,3 +178,10 @@ fun mapToRtcEngineConfig(map: Map<*, *>): RtcEngineConfig {
177178
(map["areaCode"] as? Number)?.toInt()?.let { mAreaCode = it }
178179
}
179180
}
181+
182+
fun mapToEncryptionConfig(map: Map<*, *>): EncryptionConfig {
183+
return EncryptionConfig().apply {
184+
(map["encryptionMode"] as? Number)?.let { encryptionMode = intToEncryptionMode(it.toInt()) }
185+
(map["encryptionKey"] as? String)?.let { encryptionKey = it }
186+
}
187+
}

android/src/main/java/io/agora/rtc/base/EnumCovertor.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.agora.rtc.base
22

3+
import io.agora.rtc.internal.EncryptionConfig
34
import io.agora.rtc.live.LiveInjectStreamConfig
45
import io.agora.rtc.live.LiveTranscoding
56
import io.agora.rtc.video.CameraCapturerConfiguration
@@ -85,3 +86,12 @@ fun intToCameraDirection(@Annotations.AgoraCameraDirection intValue: Int): Camer
8586
}
8687
throw RuntimeException("CameraCapturerConfiguration.CAMERA_DIRECTION not contains $intValue")
8788
}
89+
90+
fun intToEncryptionMode(@Annotations.AgoraEncryptionMode intValue: Int): EncryptionConfig.EncryptionMode {
91+
for (value in EncryptionConfig.EncryptionMode.values()) {
92+
if (value.value == intValue) {
93+
return value
94+
}
95+
}
96+
throw RuntimeException("EncryptionConfig.EncryptionMode not contains $intValue")
97+
}

android/src/main/java/io/agora/rtc/base/Extensions.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ fun LocalAudioStats.toMap(): Map<String, Any?> {
1515
return hashMapOf(
1616
"numChannels" to numChannels,
1717
"sentSampleRate" to sentSampleRate,
18-
"sentBitrate" to sentBitrate
18+
"sentBitrate" to sentBitrate,
19+
"txPacketLossRate" to txPacketLossRate
1920
)
2021
}
2122

@@ -68,7 +69,8 @@ fun RemoteAudioStats.toMap(): Map<String, Any?> {
6869
"receivedBitrate" to receivedBitrate,
6970
"totalFrozenTime" to totalFrozenTime,
7071
"frozenRate" to frozenRate,
71-
"totalActiveTime" to totalActiveTime
72+
"totalActiveTime" to totalActiveTime,
73+
"publishDuration" to publishDuration
7274
)
7375
}
7476

@@ -85,7 +87,9 @@ fun LocalVideoStats.toMap(): Map<String, Any?> {
8587
"encodedFrameWidth" to encodedFrameWidth,
8688
"encodedFrameHeight" to encodedFrameHeight,
8789
"encodedFrameCount" to encodedFrameCount,
88-
"codecType" to codecType
90+
"codecType" to codecType,
91+
"txPacketLossRate" to txPacketLossRate,
92+
"captureFrameRate" to captureFrameRate
8993
)
9094
}
9195

@@ -102,7 +106,8 @@ fun RemoteVideoStats.toMap(): Map<String, Any?> {
102106
"rxStreamType" to rxStreamType,
103107
"totalFrozenTime" to totalFrozenTime,
104108
"frozenRate" to frozenRate,
105-
"totalActiveTime" to totalActiveTime
109+
"totalActiveTime" to totalActiveTime,
110+
"publishDuration" to publishDuration
106111
)
107112
}
108113

android/src/main/java/io/agora/rtc/base/RtcChannel.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package io.agora.rtc.base
22

3+
import io.agora.rtc.Constants
34
import io.agora.rtc.IMetadataObserver
45
import io.agora.rtc.RtcChannel
56
import io.agora.rtc.RtcEngine
7+
import io.agora.rtc.internal.EncryptionConfig
68
import java.util.*
79

810
class IRtcChannel {
@@ -95,6 +97,8 @@ class IRtcChannel {
9597
fun setEncryptionSecret(params: Map<String, *>, callback: Callback)
9698

9799
fun setEncryptionMode(params: Map<String, *>, callback: Callback)
100+
101+
fun enableEncryption(params: Map<String, *>, callback: Callback)
98102
}
99103

100104
interface RtcInjectStreamInterface {
@@ -283,7 +287,16 @@ class RtcChannelManager(
283287
}
284288

285289
override fun setEncryptionMode(params: Map<String, *>, callback: Callback) {
286-
callback.code(this[params["channelId"] as String]?.setEncryptionMode(params["encryptionMode"] as String))
290+
callback.code(this[params["channelId"] as String]?.setEncryptionMode(when ((params["encryptionMode"] as Number).toInt()) {
291+
EncryptionConfig.EncryptionMode.AES_128_XTS.value -> "aes-128-xts"
292+
EncryptionConfig.EncryptionMode.AES_128_ECB.value -> "aes-128-ecb"
293+
EncryptionConfig.EncryptionMode.AES_256_XTS.value -> "aes-256-xts"
294+
else -> ""
295+
}))
296+
}
297+
298+
override fun enableEncryption(params: Map<String, *>, callback: Callback) {
299+
callback.code(this[params["channelId"] as String]?.enableEncryption(params["enabled"] as Boolean, mapToEncryptionConfig(params["config"] as Map<*, *>)))
287300
}
288301

289302
override fun addInjectStreamUrl(params: Map<String, *>, callback: Callback) {

android/src/main/java/io/agora/rtc/base/RtcChannelEvent.kt

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ class RtcChannelEvents {
3737
const val ChannelMediaRelayStateChanged = "ChannelMediaRelayStateChanged"
3838
const val ChannelMediaRelayEvent = "ChannelMediaRelayEvent"
3939
const val MetadataReceived = "MetadataReceived"
40+
const val AudioPublishStateChanged = "AudioPublishStateChanged"
41+
const val VideoPublishStateChanged = "VideoPublishStateChanged"
42+
const val AudioSubscribeStateChanged = "AudioSubscribeStateChanged"
43+
const val VideoSubscribeStateChanged = "VideoSubscribeStateChanged"
44+
const val RtmpStreamingEvent = "RtmpStreamingEvent"
4045

4146
fun toMap(): Map<String, String> {
4247
return hashMapOf(
@@ -69,7 +74,12 @@ class RtcChannelEvents {
6974
"StreamMessageError" to StreamMessageError,
7075
"ChannelMediaRelayStateChanged" to ChannelMediaRelayStateChanged,
7176
"ChannelMediaRelayEvent" to ChannelMediaRelayEvent,
72-
"MetadataReceived" to MetadataReceived
77+
"MetadataReceived" to MetadataReceived,
78+
"AudioPublishStateChanged" to AudioPublishStateChanged,
79+
"VideoPublishStateChanged" to VideoPublishStateChanged,
80+
"AudioSubscribeStateChanged" to AudioSubscribeStateChanged,
81+
"VideoSubscribeStateChanged" to VideoSubscribeStateChanged,
82+
"RtmpStreamingEvent" to RtmpStreamingEvent
7383
)
7484
}
7585
}
@@ -206,4 +216,24 @@ class RtcChannelEventHandler(
206216
override fun onChannelMediaRelayEvent(rtcChannel: RtcChannel?, @Annotations.AgoraChannelMediaRelayEvent code: Int) {
207217
callback(RtcChannelEvents.ChannelMediaRelayEvent, rtcChannel, code)
208218
}
219+
220+
override fun onAudioPublishStateChanged(rtcChannel: RtcChannel?, @Annotations.AgoraStreamPublishState oldState: Int, @Annotations.AgoraStreamPublishState newState: Int, elapseSinceLastState: Int) {
221+
callback(RtcChannelEvents.AudioPublishStateChanged, rtcChannel, rtcChannel?.channelId(), oldState, newState, elapseSinceLastState)
222+
}
223+
224+
override fun onVideoPublishStateChanged(rtcChannel: RtcChannel?, @Annotations.AgoraStreamPublishState oldState: Int, @Annotations.AgoraStreamPublishState newState: Int, elapseSinceLastState: Int) {
225+
callback(RtcChannelEvents.VideoPublishStateChanged, rtcChannel, rtcChannel?.channelId(), oldState, newState, elapseSinceLastState)
226+
}
227+
228+
override fun onAudioSubscribeStateChanged(rtcChannel: RtcChannel?, uid: Int, @Annotations.AgoraStreamSubscribeState oldState: Int, @Annotations.AgoraStreamSubscribeState newState: Int, elapseSinceLastState: Int) {
229+
callback(RtcChannelEvents.AudioSubscribeStateChanged, rtcChannel, rtcChannel?.channelId(), uid, oldState, newState, elapseSinceLastState)
230+
}
231+
232+
override fun onVideoSubscribeStateChanged(rtcChannel: RtcChannel?, uid: Int, @Annotations.AgoraStreamSubscribeState oldState: Int, @Annotations.AgoraStreamSubscribeState newState: Int, elapseSinceLastState: Int) {
233+
callback(RtcChannelEvents.VideoSubscribeStateChanged, rtcChannel, rtcChannel?.channelId(), uid, oldState, newState, elapseSinceLastState)
234+
}
235+
236+
override fun onRtmpStreamingEvent(rtcChannel: RtcChannel?, url: String?, @Annotations.AgoraRtmpStreamingEvent errCode: Int) {
237+
callback(RtcChannelEvents.RtmpStreamingEvent, rtcChannel, url, errCode)
238+
}
209239
}

0 commit comments

Comments
 (0)