-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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]>
- Loading branch information
Showing
208 changed files
with
8,163 additions
and
8,915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
209 changes: 209 additions & 0 deletions
209
...d/APIExample-Audio/app/src/main/java/io/agora/api/example/common/widget/WaveformView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
package io.agora.api.example.common.widget; | ||
|
||
import android.content.Context; | ||
import android.content.res.TypedArray; | ||
import android.graphics.Canvas; | ||
import android.graphics.Color; | ||
import android.graphics.LinearGradient; | ||
import android.graphics.Paint; | ||
import android.graphics.Shader; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import java.util.ArrayList; | ||
|
||
import io.agora.api.example.R; | ||
|
||
public class WaveformView extends View { | ||
private ArrayList<Short> datas = new ArrayList<>(); | ||
private short max = 100; | ||
private float mWidth; | ||
private float mHeight; | ||
private float space =1f; | ||
private Paint mWavePaint; | ||
private Paint baseLinePaint; | ||
private int mWaveColor = Color.WHITE; | ||
private int mBaseLineColor = Color.WHITE; | ||
private float waveStrokeWidth = 4f; | ||
private int invalidateTime = 1000 / 100; | ||
private long drawTime; | ||
private boolean isMaxConstant = false; | ||
|
||
public WaveformView(Context context) { | ||
this(context, null); | ||
} | ||
|
||
public WaveformView(Context context, @Nullable AttributeSet attrs) { | ||
this(context, attrs, 0); | ||
} | ||
|
||
public WaveformView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
init(attrs, defStyleAttr); | ||
} | ||
|
||
private void init(AttributeSet attrs, int defStyle) { | ||
final TypedArray a = getContext().obtainStyledAttributes( | ||
attrs, R.styleable.WaveView, defStyle, 0); | ||
mWaveColor = a.getColor( | ||
R.styleable.WaveView_waveColor, | ||
mWaveColor); | ||
mBaseLineColor = a.getColor( | ||
R.styleable.WaveView_baselineColor, | ||
mBaseLineColor); | ||
|
||
waveStrokeWidth = a.getDimension( | ||
R.styleable.WaveView_waveStokeWidth, | ||
waveStrokeWidth); | ||
|
||
max = (short) a.getInt(R.styleable.WaveView_maxValue, max); | ||
invalidateTime = a.getInt(R.styleable.WaveView_invalidateTime, invalidateTime); | ||
|
||
space = a.getDimension(R.styleable.WaveView_space, space); | ||
a.recycle(); | ||
initPainters(); | ||
|
||
} | ||
|
||
private void initPainters() { | ||
mWavePaint = new Paint(); | ||
mWavePaint.setColor(mWaveColor);// 画笔为color | ||
mWavePaint.setStrokeWidth(waveStrokeWidth);// 设置画笔粗细 | ||
mWavePaint.setAntiAlias(true); | ||
mWavePaint.setFilterBitmap(true); | ||
mWavePaint.setStrokeCap(Paint.Cap.ROUND); | ||
mWavePaint.setStyle(Paint.Style.FILL); | ||
Shader shader = new LinearGradient(0, 0, 1000, 0, 0xffffffff, 0xFFe850ee, Shader.TileMode.CLAMP); | ||
mWavePaint.setShader(shader); | ||
baseLinePaint = new Paint(); | ||
baseLinePaint.setColor(mBaseLineColor);// 画笔为color | ||
baseLinePaint.setStrokeWidth(1f);// 设置画笔粗细 | ||
baseLinePaint.setAntiAlias(true); | ||
baseLinePaint.setFilterBitmap(true); | ||
baseLinePaint.setStyle(Paint.Style.FILL); | ||
} | ||
|
||
public short getMax() { | ||
return max; | ||
} | ||
|
||
public void setMax(short max) { | ||
this.max = max; | ||
} | ||
|
||
public float getSpace() { | ||
return space; | ||
} | ||
|
||
public void setSpace(float space) { | ||
this.space = space; | ||
} | ||
|
||
public int getmWaveColor() { | ||
return mWaveColor; | ||
} | ||
|
||
public void setmWaveColor(int mWaveColor) { | ||
this.mWaveColor = mWaveColor; | ||
invalidateNow(); | ||
} | ||
|
||
public int getmBaseLineColor() { | ||
return mBaseLineColor; | ||
} | ||
|
||
public void setmBaseLineColor(int mBaseLineColor) { | ||
this.mBaseLineColor = mBaseLineColor; | ||
invalidateNow(); | ||
} | ||
|
||
public float getWaveStrokeWidth() { | ||
return waveStrokeWidth; | ||
} | ||
|
||
public void setWaveStrokeWidth(float waveStrokeWidth) { | ||
this.waveStrokeWidth = waveStrokeWidth; | ||
invalidateNow(); | ||
} | ||
|
||
public int getInvalidateTime() { | ||
return invalidateTime; | ||
} | ||
|
||
public void setInvalidateTime(int invalidateTime) { | ||
this.invalidateTime = invalidateTime; | ||
} | ||
|
||
public boolean isMaxConstant() { | ||
return isMaxConstant; | ||
} | ||
|
||
public void setMaxConstant(boolean maxConstant) { | ||
isMaxConstant = maxConstant; | ||
} | ||
|
||
/** | ||
* 如果改变相应配置 需要刷新相应的paint设置 | ||
*/ | ||
public void invalidateNow() { | ||
initPainters(); | ||
invalidate(); | ||
} | ||
|
||
public void addData(short data) { | ||
|
||
if (data < 0) { | ||
data = (short) -data; | ||
} | ||
if (data > max && !isMaxConstant) { | ||
max = data; | ||
} | ||
if (datas.size() > mWidth / space) { | ||
synchronized (this) { | ||
datas.remove(0); | ||
datas.add(data); | ||
} | ||
} else { | ||
datas.add(data); | ||
} | ||
if (System.currentTimeMillis() - drawTime > invalidateTime) { | ||
invalidate(); | ||
drawTime = System.currentTimeMillis(); | ||
} | ||
|
||
} | ||
|
||
public void clear() { | ||
datas.clear(); | ||
invalidateNow(); | ||
} | ||
|
||
|
||
@Override | ||
protected void onDraw(Canvas canvas) { | ||
canvas.translate(0, mHeight / 2); | ||
drawBaseLine(canvas); | ||
drawWave(canvas); | ||
} | ||
|
||
@Override | ||
protected void onSizeChanged(int w, int h, int oldw, int oldh) { | ||
mWidth = w; | ||
mHeight = h; | ||
} | ||
|
||
private void drawWave(Canvas mCanvas) { | ||
for (int i = 0; i < datas.size(); i++) { | ||
float x = (i) * space; | ||
float y = (float) datas.get(i) / max * mHeight / 2; | ||
mCanvas.drawLine(x, -y, x, y, mWavePaint); | ||
} | ||
|
||
} | ||
|
||
private void drawBaseLine(Canvas mCanvas) { | ||
mCanvas.drawLine(0, 0, mWidth, 0, baseLinePaint); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.