Skip to content

Commit bf4fccc

Browse files
author
xianing
committed
fix ios mpk issues
1 parent 266b5f9 commit bf4fccc

File tree

16 files changed

+681
-12
lines changed

16 files changed

+681
-12
lines changed

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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import io.agora.api.example.examples.advanced.ProcessAudioRawData;
2828
import io.agora.api.example.examples.advanced.ProcessRawData;
2929
import io.agora.api.example.examples.advanced.PushExternalVideo;
30+
import io.agora.api.example.examples.advanced.ScreenShare;
3031
import io.agora.api.example.examples.advanced.SendDataStream;
3132
import io.agora.api.example.examples.advanced.SetVideoProfile;
3233
import io.agora.api.example.examples.advanced.SuperResolution;
@@ -162,6 +163,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
162163
case R.id.action_mainFragment_video_enhancement:
163164
fragment = new FaceBeauty();
164165
break;
166+
case R.id.action_mainFragment_to_screen_share:
167+
fragment = new ScreenShare();
168+
break;
165169
default:
166170
fragment = new JoinChannelAudio();
167171
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

0 commit comments

Comments
 (0)