Skip to content

Commit 66c708b

Browse files
xgfd3zhaoyongqiang
and
zhaoyongqiang
authored
Dev/4.2.3 (#354)
* add third player moudle * add Audio Waveform Moudle * Fixed an issue where remote users joined player pause when rtc and player were used at the same time * fix ui issue * update content inspect config * add Feature Available On Device * add take snapshot ex * update beautyAPI version to 1.0.3 * add Feature Available On Device * add snapshot ex * fix snapshot remote bug * [Android]Add AudioRouterPlayer case. * [Android]Add AudioWaveform case. * [Android][Audio]add AudioWaveform case. * [Android]adjust content inspect case. * [Android]Add isFeatureAvailableOnDevice api in VideoProcessExtension. * [Android]Add takesnapshotex for JoinMultipleChannel. * [Android]update beauty api to 1.0.3 and etc. * [Windows]add snapshot for MultiChannel. * [Windows]fix snapshot bug. * fix oc crate stream data bug * fix swift create stream data bug * [Android]fix remote render error when rejoining channel(NMS-15581). * [Android]perfect PushExternalVideoYUV case. * add file sharing key * fix title * fix multi channel bug * fix conent inspect bug * [Windows]fix media player crash. * [Android]perfect MultiVideoSourceTracks case. * fix input token crash bug * fix input token crash bug * [Android]Update readme. (#355) * [Android]add 4K 60fps h265. (#356) * [Android]fix ui bug. * [Android]fix render bug(CSD-59845). * Fix the issue of no sound during AVPlayer playback * [Android]add cases of enableVideoImageSource and setAINSMode api and etc. * [Android]add setAINSMode api case and etc. * add video image push * add AINS Mode * iOS Add AINS Mode * ios add video image push * [Windows]add enableVideoImageSource and setAINSMode api case. * [MacOS]fix audio recording path bug. * fix startAudioRecording path bug * fix audio session change issue * fix video image source issue * .. * fix exit screen leave channel issue * screen shareing auto close system interface * [Android]update rtc verstion and etc. * [Windows]Update rtc verstion. * update SDK version to 4.2.3 --------- Co-authored-by: zhaoyongqiang <[email protected]>
1 parent c0caa78 commit 66c708b

File tree

208 files changed

+8163
-8915
lines changed

Some content is hidden

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

208 files changed

+8163
-8915
lines changed

Android/APIExample-Audio/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dependencies {
4848
implementation fileTree(dir: "${localSdkPath}", include: ['*.jar', '*.aar'])
4949
}
5050
else{
51-
def agora_sdk_version = "4.2.2"
51+
def agora_sdk_version = "4.2.3"
5252
// case 1: full single lib with voice only
5353
implementation "io.agora.rtc:voice-sdk:${agora_sdk_version}"
5454
// case 2: partial libs with voice only

Android/APIExample-Audio/app/src/main/java/io/agora/api/example/ReadyFragment.java

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ private void runOnPermissionGranted(@NonNull Runnable runnable) {
9898
permissionList.add(Permission.WRITE_EXTERNAL_STORAGE);
9999
permissionList.add(Permission.RECORD_AUDIO);
100100
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
101+
permissionList.add(Manifest.permission.READ_PHONE_STATE);
101102
permissionList.add(Manifest.permission.BLUETOOTH_CONNECT);
102103
}
103104

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
package io.agora.api.example.common.widget;
2+
3+
import android.content.Context;
4+
import android.content.res.TypedArray;
5+
import android.graphics.Canvas;
6+
import android.graphics.Color;
7+
import android.graphics.LinearGradient;
8+
import android.graphics.Paint;
9+
import android.graphics.Shader;
10+
import android.util.AttributeSet;
11+
import android.view.View;
12+
13+
import androidx.annotation.Nullable;
14+
15+
import java.util.ArrayList;
16+
17+
import io.agora.api.example.R;
18+
19+
public class WaveformView extends View {
20+
private ArrayList<Short> datas = new ArrayList<>();
21+
private short max = 100;
22+
private float mWidth;
23+
private float mHeight;
24+
private float space =1f;
25+
private Paint mWavePaint;
26+
private Paint baseLinePaint;
27+
private int mWaveColor = Color.WHITE;
28+
private int mBaseLineColor = Color.WHITE;
29+
private float waveStrokeWidth = 4f;
30+
private int invalidateTime = 1000 / 100;
31+
private long drawTime;
32+
private boolean isMaxConstant = false;
33+
34+
public WaveformView(Context context) {
35+
this(context, null);
36+
}
37+
38+
public WaveformView(Context context, @Nullable AttributeSet attrs) {
39+
this(context, attrs, 0);
40+
}
41+
42+
public WaveformView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
43+
super(context, attrs, defStyleAttr);
44+
init(attrs, defStyleAttr);
45+
}
46+
47+
private void init(AttributeSet attrs, int defStyle) {
48+
final TypedArray a = getContext().obtainStyledAttributes(
49+
attrs, R.styleable.WaveView, defStyle, 0);
50+
mWaveColor = a.getColor(
51+
R.styleable.WaveView_waveColor,
52+
mWaveColor);
53+
mBaseLineColor = a.getColor(
54+
R.styleable.WaveView_baselineColor,
55+
mBaseLineColor);
56+
57+
waveStrokeWidth = a.getDimension(
58+
R.styleable.WaveView_waveStokeWidth,
59+
waveStrokeWidth);
60+
61+
max = (short) a.getInt(R.styleable.WaveView_maxValue, max);
62+
invalidateTime = a.getInt(R.styleable.WaveView_invalidateTime, invalidateTime);
63+
64+
space = a.getDimension(R.styleable.WaveView_space, space);
65+
a.recycle();
66+
initPainters();
67+
68+
}
69+
70+
private void initPainters() {
71+
mWavePaint = new Paint();
72+
mWavePaint.setColor(mWaveColor);// 画笔为color
73+
mWavePaint.setStrokeWidth(waveStrokeWidth);// 设置画笔粗细
74+
mWavePaint.setAntiAlias(true);
75+
mWavePaint.setFilterBitmap(true);
76+
mWavePaint.setStrokeCap(Paint.Cap.ROUND);
77+
mWavePaint.setStyle(Paint.Style.FILL);
78+
Shader shader = new LinearGradient(0, 0, 1000, 0, 0xffffffff, 0xFFe850ee, Shader.TileMode.CLAMP);
79+
mWavePaint.setShader(shader);
80+
baseLinePaint = new Paint();
81+
baseLinePaint.setColor(mBaseLineColor);// 画笔为color
82+
baseLinePaint.setStrokeWidth(1f);// 设置画笔粗细
83+
baseLinePaint.setAntiAlias(true);
84+
baseLinePaint.setFilterBitmap(true);
85+
baseLinePaint.setStyle(Paint.Style.FILL);
86+
}
87+
88+
public short getMax() {
89+
return max;
90+
}
91+
92+
public void setMax(short max) {
93+
this.max = max;
94+
}
95+
96+
public float getSpace() {
97+
return space;
98+
}
99+
100+
public void setSpace(float space) {
101+
this.space = space;
102+
}
103+
104+
public int getmWaveColor() {
105+
return mWaveColor;
106+
}
107+
108+
public void setmWaveColor(int mWaveColor) {
109+
this.mWaveColor = mWaveColor;
110+
invalidateNow();
111+
}
112+
113+
public int getmBaseLineColor() {
114+
return mBaseLineColor;
115+
}
116+
117+
public void setmBaseLineColor(int mBaseLineColor) {
118+
this.mBaseLineColor = mBaseLineColor;
119+
invalidateNow();
120+
}
121+
122+
public float getWaveStrokeWidth() {
123+
return waveStrokeWidth;
124+
}
125+
126+
public void setWaveStrokeWidth(float waveStrokeWidth) {
127+
this.waveStrokeWidth = waveStrokeWidth;
128+
invalidateNow();
129+
}
130+
131+
public int getInvalidateTime() {
132+
return invalidateTime;
133+
}
134+
135+
public void setInvalidateTime(int invalidateTime) {
136+
this.invalidateTime = invalidateTime;
137+
}
138+
139+
public boolean isMaxConstant() {
140+
return isMaxConstant;
141+
}
142+
143+
public void setMaxConstant(boolean maxConstant) {
144+
isMaxConstant = maxConstant;
145+
}
146+
147+
/**
148+
* 如果改变相应配置 需要刷新相应的paint设置
149+
*/
150+
public void invalidateNow() {
151+
initPainters();
152+
invalidate();
153+
}
154+
155+
public void addData(short data) {
156+
157+
if (data < 0) {
158+
data = (short) -data;
159+
}
160+
if (data > max && !isMaxConstant) {
161+
max = data;
162+
}
163+
if (datas.size() > mWidth / space) {
164+
synchronized (this) {
165+
datas.remove(0);
166+
datas.add(data);
167+
}
168+
} else {
169+
datas.add(data);
170+
}
171+
if (System.currentTimeMillis() - drawTime > invalidateTime) {
172+
invalidate();
173+
drawTime = System.currentTimeMillis();
174+
}
175+
176+
}
177+
178+
public void clear() {
179+
datas.clear();
180+
invalidateNow();
181+
}
182+
183+
184+
@Override
185+
protected void onDraw(Canvas canvas) {
186+
canvas.translate(0, mHeight / 2);
187+
drawBaseLine(canvas);
188+
drawWave(canvas);
189+
}
190+
191+
@Override
192+
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
193+
mWidth = w;
194+
mHeight = h;
195+
}
196+
197+
private void drawWave(Canvas mCanvas) {
198+
for (int i = 0; i < datas.size(); i++) {
199+
float x = (i) * space;
200+
float y = (float) datas.get(i) / max * mHeight / 2;
201+
mCanvas.drawLine(x, -y, x, y, mWavePaint);
202+
}
203+
204+
}
205+
206+
private void drawBaseLine(Canvas mCanvas) {
207+
mCanvas.drawLine(0, 0, mWidth, 0, baseLinePaint);
208+
}
209+
}

Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/advanced/VoiceEffects.java

+20-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public class VoiceEffects extends BaseFragment implements View.OnClickListener,
105105
private EditText et_channel;
106106
private Button join;
107107
private Spinner audioProfile, audioScenario,
108-
chatBeautifier, timbreTransformation, voiceChanger, styleTransformation, roomAcoustics, pitchCorrection, _pitchModeOption, _pitchValueOption, voiceConversion,
108+
chatBeautifier, timbreTransformation, voiceChanger, styleTransformation, roomAcoustics, pitchCorrection, _pitchModeOption, _pitchValueOption, voiceConversion, ainsMode,
109109
customBandFreq, customReverbKey;
110110
private ViewGroup _voice3DLayout, _pitchModeLayout, _pitchValueLayout;
111111
private SeekBar _voice3DCircle, customPitch, customBandGain, customReverbValue, customVoiceFormant;
@@ -152,6 +152,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
152152
_pitchValueLayout = view.findViewById(R.id.audio_pitch_value_layout);
153153
_pitchValueOption = view.findViewById(R.id.audio_pitch_value_option);
154154
voiceConversion = view.findViewById(R.id.audio_voice_conversion);
155+
ainsMode = view.findViewById(R.id.audio_ains_mode);
155156

156157
chatBeautifier.setOnItemSelectedListener(this);
157158
timbreTransformation.setOnItemSelectedListener(this);
@@ -163,6 +164,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
163164
_voice3DCircle.setOnSeekBarChangeListener(this);
164165
_pitchModeOption.setOnItemSelectedListener(this);
165166
_pitchValueOption.setOnItemSelectedListener(this);
167+
ainsMode.setOnItemSelectedListener(this);
166168

167169
// Customize Voice Effects Layout
168170
customPitch = view.findViewById(R.id.audio_custom_pitch); // engine.setLocalVoicePitch()
@@ -201,6 +203,7 @@ private void resetControlLayoutByJoined() {
201203
_pitchModeLayout.setVisibility(View.GONE);
202204
_pitchValueLayout.setVisibility(View.GONE);
203205
voiceConversion.setEnabled(joined);
206+
ainsMode.setEnabled(joined);
204207

205208
customPitch.setEnabled(joined);
206209
customBandFreq.setEnabled(joined);
@@ -216,6 +219,7 @@ private void resetControlLayoutByJoined() {
216219
roomAcoustics.setSelection(0);
217220
pitchCorrection.setSelection(0);
218221
voiceConversion.setSelection(0);
222+
ainsMode.setSelection(0);
219223

220224
customPitch.setProgress(0);
221225
customBandGain.setProgress(0);
@@ -615,11 +619,26 @@ public void onItemSelected(AdapterView<?> parent, View view, int position, long
615619
return;
616620
}
617621

622+
618623
if(parent == _pitchModeOption || parent == _pitchValueOption){
619624
int effectOption1 = getPitch1Value(_pitchModeOption.getSelectedItem().toString());
620625
int effectOption2 = getPitch2Value(_pitchValueOption.getSelectedItem().toString());
621626
engine.setAudioEffectParameters(PITCH_CORRECTION, effectOption1, effectOption2);
622627
}
628+
629+
if(parent == ainsMode){
630+
boolean enable = position > 0;
631+
/*
632+
The AI noise suppression modes:
633+
0: (Default) Balance mode. This mode allows for a balanced performance on noice suppression and time delay.
634+
1: Aggressive mode. In scenarios where high performance on noise suppression is required, such as live streaming
635+
outdoor events, this mode reduces nosies more dramatically, but sometimes may affect the original character of the audio.
636+
2: Aggressive mode with low latency. The noise suppression delay of this mode is about only half of that of the balance
637+
and aggressive modes. It is suitable for scenarios that have high requirements on noise suppression with low latency,
638+
such as sing together online in real time.
639+
*/
640+
engine.setAINSMode(enable, position - 1);
641+
}
623642
}
624643

625644
private int getVoiceConversionValue(String label) {

0 commit comments

Comments
 (0)