Skip to content

Commit ff6fcae

Browse files
author
zhaoyongqiang
committed
Merge branch 'dev/4.0.0.3' of github.com:AgoraIO/API-Examples into dev/4.0.0.3
2 parents d5cf003 + b457180 commit ff6fcae

Some content is hidden

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

47 files changed

+300
-704
lines changed

.github/ci/build/build_android.sh

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
# pr: output test.zip to workspace dir
3838
# others: Rename the zip package name yourself, But need copy it to workspace dir
3939
##################################
40-
4140
echo Package_Publish: $Package_Publish
4241
echo is_tag_fetch: $is_tag_fetch
4342
echo arch: $arch
@@ -59,16 +58,74 @@ python3 $WORKSPACE/artifactory_utils.py --action=download_file --file=$sdk_url
5958
unzip_name=`ls -S -d */ | grep Agora`
6059
echo unzip_name: $unzip_name
6160

62-
mv $unzip_name/rtc/** $unzip_name
63-
rm -rf $unzip_name/rtc
64-
rm -rf ./$unzip_name/bin
65-
rm -rf ./$unzip_name/demo
66-
rm ./$unzip_name/commits
67-
rm ./$unzip_name/package_size_report.txt
68-
mkdir ./$unzip_name/samples
69-
mkdir ./$unzip_name/samples/API-example
61+
#mv $unzip_name/rtc/** $unzip_name
62+
#rm -rf $unzip_name/rtc
63+
#rm -rf ./$unzip_name/bin
64+
#rm -rf ./$unzip_name/demo
65+
#rm ./$unzip_name/commits
66+
#rm ./$unzip_name/package_size_report.txt
67+
#mkdir ./$unzip_name/samples
68+
#mkdir ./$unzip_name/samples/API-example
69+
#cp -rf ./Android/APIExample$(echo $sdk_url | cut -d "/" -f 9 | grep audio_only | cut -d "_" -f 1 | sed -e 's/a/-A/g')/** ./$unzip_name/samples/API-example
7070

71-
cp -rf ./Android/APIExample$(echo $sdk_url | cut -d "/" -f 9 | grep audio_only | cut -d "_" -f 1 | sed -e 's/a/-A/g')/** ./$unzip_name/samples/API-example
71+
rm -rf ./$unzip_name/rtc/bin
72+
rm -rf ./$unzip_name/rtc/demo
73+
rm ./$unzip_name/rtc/commits
74+
rm ./$unzip_name/rtc/package_size_report.txt
75+
mkdir ./$unzip_name/rtc/samples
76+
mkdir ./$unzip_name/rtc/samples/API-example
77+
cp -rf ./Android/APIExample$(echo $sdk_url | cut -d "/" -f 9 | grep audio_only | cut -d "_" -f 1 | sed -e 's/a/-A/g')/** ./$unzip_name/rtc/samples/API-example
7278

7379
7za a -tzip result.zip -r $unzip_name
7480
cp result.zip $WORKSPACE/withAPIExample_$zip_name
81+
82+
# install android sdk
83+
which java
84+
java --version
85+
echo ${ANDROID_HOME}
86+
ls -al ${ANDROID_HOME}/*
87+
88+
cd ./$unzip_name/samples/
89+
mkdir AndroidSDK
90+
export ANDROID_HOME=$(pwd)/AndroidSDK
91+
cd -
92+
cd ${ANDROID_HOME}
93+
wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
94+
unzip commandlinetools-linux-8512546_latest.zip
95+
export PATH=$(pwd)/cmdline-tools/bin:$PATH
96+
yes | sdkmanager --licenses --sdk_root=${ANDROID_HOME}
97+
yes | sdkmanager "platform-tools" "cmake;3.10.2.4988404" "platforms;android-32" "build-tools;32.0.0" --sdk_root=${ANDROID_HOME}
98+
cd -
99+
100+
# compile apk
101+
cd ./$unzip_name/samples/API-example
102+
pwd
103+
ls -al
104+
105+
## config appId
106+
sed -i -e "s#YOUR APP ID#${APP_ID}#g" app/src/main/res/values/string_configs.xml
107+
sed -i -e "s#YOUR APP CERTIFICATE##g" app/src/main/res/values/string_configs.xml
108+
sed -i -e "s#YOUR ACCESS TOKEN##g" app/src/main/res/values/string_configs.xml
109+
rm -f app/src/main/res/values/string_configs.xml-e
110+
cat app/src/main/res/values/string_configs.xml
111+
112+
## config simple filter
113+
sed -i -e "s#simpleFilter = false#simpleFilter = true#g" gradle.properties
114+
mkdir -p agora-simple-filter/src/main/agoraLibs
115+
cp -r ../../sdk/arm64-v8a agora-simple-filter/src/main/agoraLibs/
116+
cp -r ../../sdk/armeabi-v7a agora-simple-filter/src/main/agoraLibs/
117+
wget https://agora-adc-artifacts.s3.cn-north-1.amazonaws.com.cn/androidLibs/opencv4.zip
118+
unzip opencv4.zip
119+
mkdir -p agora-simple-filter/src/main/jniLibs2
120+
mv arm64-v8a agora-simple-filter/src/main/jniLibs2
121+
mv armeabi-v7a agora-simple-filter/src/main/jniLibs2
122+
sed -i -e "s#jniLibs/#jniLibs2/#g" agora-simple-filter/src/main/cpp/CMakeLists.txt
123+
124+
./gradlew clean
125+
./gradlew :app:assembleDebug
126+
cp app/build/outputs/apk/debug/app-debug.apk ./APIExample_Android_$(date "+%y%m%d%H").apk
127+
7za a -tzip result.zip -r *.apk
128+
cp result.zip $WORKSPACE/APIExample_Android$(echo $sdk_url | cut -d "/" -f 9 | grep audio_only | cut -d "_" -f 1 | sed -e 's/a/_A/g')_apk.zip
129+
ls $WORKSPACE
130+
cd -
131+

.github/ci/build/build_windows.bat

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ REM for example: python %WORKSPACE%\\artifactory_utils.py --action=upload_file -
3030
REM upload folder to artifactory
3131
REM python %WORKSPACE%\\artifactory_utils.py --action=upload_file --file=FILEPATTERN --server_path=SERVERPATH --server_repo=SERVER_REPO --with_folder
3232
REM for example: python %WORKSPACE%\\artifactory_utils.py --action=upload_file --file=publish --server_path=windows/ --server_repo=ACCS_repo --with_folder
33-
# --- Input: ----
34-
# sourcePath: see jenkins console for details.
35-
# WORKSPACE: %WORKSPACE%
36-
# --- Output: ----
37-
# pr: output test.zip to workspace dir
38-
# others: Rename the zip package name yourself, But need copy it to workspace dir
33+
REM --- Input: ----
34+
REM sourcePath: see jenkins console for details.
35+
REM WORKSPACE: %WORKSPACE%
36+
REM --- Output: ----
37+
REM pr: output test.zip to workspace dir
38+
REM others: Rename the zip package name yourself, But need copy it to workspace dir
3939
REM ##################################
4040

4141
echo Package_Publish: %Package_Publish%
@@ -86,3 +86,14 @@ xcopy /Y /E windows\README.md Agora_Native_SDK_for_Windows_FULL\samples\API-exam
8686
xcopy /Y /E windows\README.zh.md Agora_Native_SDK_for_Windows_FULL\samples\API-example
8787
7z a -tzip result.zip -r Agora_Native_SDK_for_Windows_FULL
8888
copy result.zip %WORKSPACE%\\withAPIExample_%zip_name%
89+
del /F result.zip
90+
del /F %WORKSPACE%\\%zip_name%
91+
92+
cd Agora_Native_SDK_for_Windows_FULL\samples\API-example
93+
echo "compile start..."
94+
call installThirdParty.bat
95+
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" "APIExample.sln" /p:platform="Win32" /p:configuration="Release"
96+
7z a -tzip result.zip -r Release
97+
copy result.zip %WORKSPACE%\\APIExample-windows.zip
98+
del /F result.zip
99+
echo "compile done."

Android/APIExample-Audio/app/build.gradle

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
apply plugin: 'com.android.application'
2-
apply plugin: "androidx.navigation.safeargs"
32

43
def localSdkPath= "${rootProject.projectDir.absolutePath}/../../sdk"
54

65
android {
7-
compileSdkVersion 31
8-
buildToolsVersion "31.0.0"
6+
compileSdkVersion 32
7+
buildToolsVersion "32.0.0"
98

109
defaultConfig {
1110
applicationId "io.agora.api.example"
12-
minSdkVersion 19
13-
targetSdkVersion 29
11+
minSdkVersion 21
12+
targetSdkVersion 32
1413
versionCode 1
1514
versionName "1.0"
1615

@@ -38,7 +37,6 @@ android {
3837
}
3938
}
4039

41-
ndkVersion '21.4.7075529'
4240
}
4341

4442
dependencies {
@@ -56,15 +54,15 @@ dependencies {
5654
implementation "io.agora.rtc:audio-beauty:${agora_sdk_version}"
5755
}
5856

59-
implementation 'androidx.appcompat:appcompat:1.1.0'
60-
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
57+
implementation 'androidx.appcompat:appcompat:1.5.0'
58+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
6159

6260
// Java language implementation
63-
implementation "androidx.navigation:navigation-fragment:2.3.0-alpha06"
64-
implementation "androidx.navigation:navigation-ui:2.3.0-alpha06"
61+
implementation "androidx.navigation:navigation-fragment:2.5.0"
62+
implementation "androidx.navigation:navigation-ui:2.5.0"
6563

6664
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
67-
implementation 'androidx.recyclerview:recyclerview:1.1.0'
65+
implementation 'androidx.recyclerview:recyclerview:1.2.1'
6866
testImplementation 'junit:junit:4.12'
6967
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
7068
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

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

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public class PreCallTest extends BaseFragment implements View.OnClickListener {
4141

4242
private RtcEngine engine;
4343
private int myUid;
44-
private Button btn_lastmile, btn_echo, btn_device_test;
44+
private Button btn_lastmile, btn_echo;
4545
private StatisticsInfo statisticsInfo;
46-
private TextView lastmileQuality, lastmileResult, labelDeviceTest;
46+
private TextView lastmileQuality, lastmileResult;
4747
private static final Integer MAX_COUNT_DOWN = 8;
4848
private int num;
4949
private Timer echoTimer;
@@ -121,9 +121,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
121121
btn_echo.setOnClickListener(this);
122122
btn_lastmile = view.findViewById(R.id.btn_lastmile);
123123
btn_lastmile.setOnClickListener(this);
124-
btn_device_test = view.findViewById(R.id.btn_device_test);
125-
btn_device_test.setOnClickListener(this);
126-
labelDeviceTest = view.findViewById(R.id.lb_device_test);
127124
lastmileQuality = view.findViewById(R.id.lastmile_quality);
128125
lastmileResult = view.findViewById(R.id.lastmile_result);
129126
}
@@ -178,19 +175,6 @@ else if(num >= MAX_COUNT_DOWN) {
178175
}
179176
}
180177
}, 1000, 1000);
181-
}else if(v.getId() == R.id.btn_device_test){
182-
boolean enable = btn_device_test.getTag() instanceof Boolean && (Boolean) btn_device_test.getTag();
183-
if(!enable){
184-
engine.startRecordingDeviceTest(500);
185-
btn_device_test.setText(R.string.stop);
186-
btn_device_test.setTag(true);
187-
handler.postDelayed(() -> onClick(v), 10* 1000);
188-
}else{
189-
engine.stopRecordingDeviceTest();
190-
btn_device_test.setText(R.string.start);
191-
btn_device_test.setTag(null);
192-
labelDeviceTest.setText("");
193-
}
194178
}
195179
}
196180

@@ -322,11 +306,6 @@ public void onLastmileProbeResult(LastmileProbeResult lastmileProbeResult) {
322306
});
323307
}
324308

325-
@Override
326-
public void onAudioVolumeIndication(AudioVolumeInfo[] speakers, int totalVolume) {
327-
super.onAudioVolumeIndication(speakers, totalVolume);
328-
runOnUIThread(() -> labelDeviceTest.append("totalVolume=" + totalVolume + "\n"));
329-
}
330309
};
331310

332311
private void updateLastMileResult() {

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,6 @@ public boolean onMixedAudioFrame(String channel, int audioFrameType, int samples
321321
return false;
322322
}
323323

324-
@Override
325-
public boolean onEarMonitoringAudioFrame(int type, int samplesPerChannel, int bytesPerSample, int channels, int samplesPerSec, ByteBuffer buffer, long renderTimeMs, int avsync_type) {
326-
return false;
327-
}
328-
329324
@Override
330325
public boolean onPlaybackAudioFrameBeforeMixing(String channel, int uid, int audioFrameType, int samples, int bytesPerSample, int channels, int samplesPerSec, ByteBuffer byteBuffer, long renderTimeMs, int bufferLength) {
331326
return false;
@@ -351,10 +346,6 @@ public AudioParams getMixedAudioParams() {
351346
return null;
352347
}
353348

354-
@Override
355-
public AudioParams getEarMonitoringAudioParams() {
356-
return null;
357-
}
358349
};
359350

360351
/**

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ public void onPreloadEvent(String src, Constants.MediaPlayerPreloadEvent event)
239239

240240
}
241241

242+
@Override
243+
public void onCompleted() {
244+
245+
}
246+
242247
@Override
243248
public void onAgoraCDNTokenWillExpire() {
244249

Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/basic/JoinChannelAudio.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ else if (v.getId() == R.id.btn_speaker)
305305
speaker.setActivated(!speaker.isActivated());
306306
speaker.setText(getString(speaker.isActivated() ? R.string.speaker : R.string.earpiece));
307307
/**Turn off / on the speaker and change the audio playback route.*/
308-
engine.setDefaultAudioRoutetoSpeakerphone(speaker.isActivated());
308+
engine.setEnableSpeakerphone(speaker.isActivated());
309309
}
310310
}
311311

@@ -323,6 +323,8 @@ private void joinChannel(String channelId)
323323
int scenario = Constants.AudioScenario.valueOf(audioScenarioInput.getSelectedItem().toString()).ordinal();
324324
engine.setAudioScenario(scenario);
325325

326+
engine.setDefaultAudioRoutetoSpeakerphone(true);
327+
326328
ChannelMediaOptions option = new ChannelMediaOptions();
327329
option.autoSubscribeAudio = true;
328330
option.autoSubscribeVideo = true;

Android/APIExample-Audio/app/src/main/res/layout/fragment_precall_test.xml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,4 @@
6868

6969
</RelativeLayout>
7070

71-
<LinearLayout
72-
android:layout_width="match_parent"
73-
android:layout_height="0dp"
74-
android:layout_weight="1"
75-
android:layout_marginHorizontal="16dp"
76-
android:orientation="vertical"
77-
android:layout_marginTop="16dp">
78-
79-
<TextView
80-
android:layout_width="wrap_content"
81-
android:layout_height="wrap_content"
82-
android:text="RecordingDeviceTest" />
83-
84-
<androidx.appcompat.widget.AppCompatButton
85-
android:id="@+id/btn_device_test"
86-
android:layout_width="wrap_content"
87-
android:layout_height="wrap_content"
88-
android:text="@string/start" />
89-
90-
<TextView
91-
android:id="@+id/lb_device_test"
92-
android:layout_width="wrap_content"
93-
android:layout_height="wrap_content"
94-
android:layout_marginTop="8dp"
95-
android:gravity="bottom"/>
96-
97-
</LinearLayout>
98-
9971
</LinearLayout>

Android/APIExample-Audio/build.gradle

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
3-
buildscript {
4-
repositories {
5-
mavenCentral()
6-
google()
7-
jcenter()
8-
9-
}
10-
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.4.2'
12-
13-
// NOTE: Do not place your application dependencies here; they belong
14-
// in the individual module build.gradle files
15-
16-
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0-alpha06"
17-
}
18-
}
19-
20-
allprojects {
21-
repositories {
22-
mavenCentral()
23-
google()
24-
jcenter()
25-
maven { url 'https://jitpack.io' }
26-
}
2+
plugins {
3+
id 'com.android.application' version '7.2.0' apply false
4+
id 'com.android.library' version '7.2.0' apply false
275
}
286

297
task clean(type: Delete) {

Android/APIExample-Audio/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip
6+
distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip

0 commit comments

Comments
 (0)