Skip to content

Commit b9a8b0e

Browse files
author
xia ning
authored
Merge pull request #265 from AgoraIO/staging
3.6.2 tag version
2 parents 1b8f7bd + f37d4cb commit b9a8b0e

File tree

68 files changed

+2765
-763
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2765
-763
lines changed

Android/APIExample/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The project uses a single app to combine a variety of functionalities. Each func
5555

5656
1. In Android Studio, open `/Android/APIExample`.
5757
2. Sync the project with Gradle files.
58-
3. Edit the `/Android/APIExample/app/src/main/res/values/string_config.xml` file.
58+
3. Edit the `/Android/APIExample/app/src/main/res/values/string_configs.xml` file.
5959

6060
- Replace `YOUR APP ID` with your App ID.
6161
- Replace `YOUR ACCESS TOKEN` with the Access Token.

Android/APIExample/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android {
77

88
defaultConfig {
99
applicationId "io.agora.api.example"
10-
minSdkVersion 19
10+
minSdkVersion 21
1111
targetSdkVersion 29
1212
versionCode 1
1313
versionName "1.0"

Android/APIExample/app/src/main/java/io/agora/api/example/ExampleActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
import io.agora.api.example.examples.advanced.MediaPlayerKit;
2525
import io.agora.api.example.examples.advanced.PlayAudioFiles;
2626
import io.agora.api.example.examples.advanced.PreCallTest;
27-
import io.agora.api.example.examples.advanced.ProcessAudioRawData;
2827
import io.agora.api.example.examples.advanced.ProcessRawData;
2928
import io.agora.api.example.examples.advanced.PushExternalVideo;
29+
import io.agora.api.example.examples.advanced.ScreenShare;
3030
import io.agora.api.example.examples.advanced.SendDataStream;
3131
import io.agora.api.example.examples.advanced.SetVideoProfile;
3232
import io.agora.api.example.examples.advanced.SuperResolution;
@@ -156,12 +156,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
156156
case R.id.action_mainFragment_senddatastream:
157157
fragment = new SendDataStream();
158158
break;
159-
case R.id.action_mainFragment_raw_audio:
160-
fragment = new ProcessAudioRawData();
161-
break;
162159
case R.id.action_mainFragment_video_enhancement:
163160
fragment = new FaceBeauty();
164161
break;
162+
case R.id.action_mainFragment_to_screen_share:
163+
fragment = new ScreenShare();
164+
break;
165165
default:
166166
fragment = new JoinChannelAudio();
167167
break;

Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/FaceBeauty.java

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import com.yanzhenjie.permission.AndPermission;
2323
import com.yanzhenjie.permission.runtime.Permission;
2424

25+
import org.json.JSONException;
26+
2527
import io.agora.api.example.MainApplication;
2628
import io.agora.api.example.R;
2729
import io.agora.api.example.annotation.Example;
@@ -32,8 +34,12 @@
3234
import io.agora.rtc.RtcEngineConfig;
3335
import io.agora.rtc.models.ChannelMediaOptions;
3436
import io.agora.rtc.video.BeautyOptions;
37+
import io.agora.rtc.video.ColorEnhanceOptions;
38+
import io.agora.rtc.video.LowLightEnhanceOptions;
3539
import io.agora.rtc.video.VideoCanvas;
40+
import io.agora.rtc.video.VideoDenoiserOptions;
3641
import io.agora.rtc.video.VideoEncoderConfiguration;
42+
import io.agora.rtc.video.VirtualBackgroundSource;
3743

3844
import static io.agora.api.example.common.model.Examples.ADVANCED;
3945
import static io.agora.rtc.Constants.CHANNEL_PROFILE_LIVE_BROADCASTING;
@@ -56,13 +62,19 @@ public class FaceBeauty extends BaseFragment implements View.OnClickListener, Co
5662
private FrameLayout fl_local, fl_remote;
5763
private LinearLayout controlPanel;
5864
private Button join;
59-
private Switch beauty;
60-
private SeekBar seek_lightness, seek_redness, seek_sharpness, seek_smoothness;
65+
private Switch beauty, lightness, colorful, noiseReduce, virtualBackground;
66+
private SeekBar seek_lightness, seek_redness, seek_sharpness, seek_smoothness, seek_strength, seek_skin;
6167
private EditText et_channel;
6268
private RtcEngine engine;
6369
private int myUid;
6470
private boolean joined = false;
6571
private BeautyOptions beautyOptions = new BeautyOptions();
72+
private LowLightEnhanceOptions lowLightEnhanceOptions = new LowLightEnhanceOptions();
73+
private ColorEnhanceOptions colorEnhanceOptions = new ColorEnhanceOptions();
74+
private VideoDenoiserOptions videoDenoiserOptions = new VideoDenoiserOptions();
75+
private VirtualBackgroundSource virtualBackgroundSource = new VirtualBackgroundSource();
76+
private float skinProtect = 1.0f;
77+
private float strength = 0.5f;
6678

6779
@Nullable
6880
@Override
@@ -84,6 +96,14 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
8496
controlPanel = view.findViewById(R.id.controlPanel);
8597
beauty = view.findViewById(R.id.switch_face_beautify);
8698
beauty.setOnCheckedChangeListener(this);
99+
lightness = view.findViewById(R.id.switch_lightness);
100+
lightness.setOnCheckedChangeListener(this);
101+
colorful = view.findViewById(R.id.switch_color);
102+
colorful.setOnCheckedChangeListener(this);
103+
virtualBackground = view.findViewById(R.id.switch_virtual_background);
104+
virtualBackground.setOnCheckedChangeListener(this);
105+
noiseReduce = view.findViewById(R.id.switch_video_noise_reduce);
106+
noiseReduce.setOnCheckedChangeListener(this);
87107
seek_lightness = view.findViewById(R.id.lightening);
88108
seek_lightness.setOnSeekBarChangeListener(this);
89109
seek_redness = view.findViewById(R.id.redness);
@@ -92,6 +112,12 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
92112
seek_sharpness.setOnSeekBarChangeListener(this);
93113
seek_smoothness = view.findViewById(R.id.smoothness);
94114
seek_smoothness.setOnSeekBarChangeListener(this);
115+
seek_strength = view.findViewById(R.id.strength);
116+
seek_strength.setOnSeekBarChangeListener(this);
117+
seek_skin = view.findViewById(R.id.skinProtect);
118+
seek_skin.setOnSeekBarChangeListener(this);
119+
120+
virtualBackgroundSource.blur_degree = 2;
95121
}
96122

97123
@Override
@@ -274,9 +300,22 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
274300
if(buttonView.getId() == beauty.getId()){
275301
engine.setBeautyEffectOptions(isChecked, beautyOptions);
276302
}
303+
else if(buttonView.getId() == lightness.getId()){
304+
engine.setLowlightEnhanceOptions(isChecked, lowLightEnhanceOptions);
305+
}
306+
else if(buttonView.getId() == colorful.getId()){
307+
colorEnhanceOptions.skinProtectLevel = skinProtect;
308+
colorEnhanceOptions.strengthLevel = strength;
309+
engine.setColorEnhanceOptions(isChecked, colorEnhanceOptions);
310+
}
311+
else if(buttonView.getId() == noiseReduce.getId()){
312+
engine.setVideoDenoiserOptions(isChecked, videoDenoiserOptions);
313+
}
314+
else if(buttonView.getId() == virtualBackground.getId()){
315+
engine.enableVirtualBackground(isChecked, virtualBackgroundSource);
316+
}
277317
}
278318

279-
280319
@Override
281320
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
282321
float value = ((float) progress) / 10;
@@ -296,6 +335,14 @@ else if(seekBar.getId() == seek_smoothness.getId()){
296335
beautyOptions.smoothnessLevel = value;
297336
engine.setBeautyEffectOptions(beauty.isChecked(), beautyOptions);
298337
}
338+
else if(seekBar.getId() == seek_strength.getId()) {
339+
colorEnhanceOptions.strengthLevel = value;
340+
engine.setColorEnhanceOptions(colorful.isChecked(), colorEnhanceOptions);
341+
}
342+
else if(seekBar.getId() == seek_skin.getId()) {
343+
colorEnhanceOptions.skinProtectLevel = value;
344+
engine.setColorEnhanceOptions(colorful.isChecked(), colorEnhanceOptions);
345+
}
299346
}
300347

301348
@Override

Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/MediaPlayerKit.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,13 +564,15 @@ public void run() {
564564
@Override
565565
public void onDestroy() {
566566
super.onDestroy();
567-
/**leaveChannel and Destroy the RtcEngine instance*/
568-
agoraMediaPlayerKit.destroy();
569567
if (engine != null) {
570-
engine.leaveChannel();
568+
/**leaveChannel and Destroy the RtcEngine instance*/
569+
if (joined) {
570+
engine.leaveChannel();
571+
}
572+
agoraMediaPlayerKit.destroy();
573+
handler.post(RtcEngine::destroy);
574+
engine = null;
571575
}
572-
handler.post(RtcEngine::destroy);
573-
engine = null;
574576
}
575577

576578
}

0 commit comments

Comments
 (0)