Skip to content

Commit c3bb865

Browse files
xgfd3zhaoyongqiang
and
zhaoyongqiang
authored
Dev/4.2.6 (#364)
* update CI * [Android]remove duplicate foreground notification of screen sharing. * [Android]update rtc sdk version to 4.2.6 and etc. * update CI * [Windows]update rtc sdk version to 4.2.6. * update ios script add sdk version * update script * update script * update script * update script * update script * [Android]Update echo test api. * fix change role bug * fix change role bug * update screen share bug * [Winodws]fix some crashes(NMS-17129/NMS-17191) * update sdk version to 4.2.6 --------- Co-authored-by: zhaoyongqiang <[email protected]>
1 parent f46fc03 commit c3bb865

File tree

53 files changed

+276
-318
lines changed

Some content is hidden

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

53 files changed

+276
-318
lines changed

.github/ci/build/build_ios_ipa.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,18 @@ cd ${WORKSPACE}
142142
# sh sign "${TARGET_NAME}_${BUILD_NUMBER}.xcarchive.zip" --type xcarchive --plist "${PLIST_PATH}"
143143
sh export "${TARGET_NAME}_${BUILD_NUMBER}.xcarchive.zip" --plist "${PLIST_PATH}"
144144

145+
SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)
145146
# 上传IPA
146-
PAYLOAD_PATH="${TARGET_NAME}_${BUILD_NUMBER}_Payload"
147+
PAYLOAD_PATH="${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}_Payload"
147148
mkdir "${PAYLOAD_PATH}"
148149
# mv "${TARGET_NAME}_${BUILD_NUMBER}_iOS.ipa" "${PAYLOAD_PATH}"
149150
mv "${TARGET_NAME}_${BUILD_NUMBER}.ipa" "${PAYLOAD_PATH}"
150151

151-
7za a "${TARGET_NAME}_${BUILD_NUMBER}_IPA.zip" -r "${PAYLOAD_PATH}"
152-
python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_${BUILD_NUMBER}_IPA.zip" --project
152+
7za a "${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}_IPA.zip" -r "${PAYLOAD_PATH}"
153+
python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}_IPA.zip" --project
153154

154155
# 删除IPA文件夹
155-
rm -rf ${TARGET_NAME}_${BUILD_NUMBER}.xcarchive
156+
rm -rf ${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}.xcarchive
156157
rm -rf *.zip
157158
rm -rf ${PAYLOAD_PATH}
158159

.github/ci/build/build_mac.sh

-1
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,4 @@ if [ $is_generate_validate_app = true ]; then
8181
fi
8282

8383
7za a -tzip result.zip -r $unzip_name
84-
# 7za a -tzip result.zip -r Agora_Native_SDK_for_Mac_FULL
8584
cp result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name

.github/ci/build/build_mac_ipa.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ xcodebuild clean -workspace "${APP_PATH}" -configuration "${CONFIGURATION}" -sch
6868
# 时间戳
6969
CURRENT_TIME=$(date "+%Y-%m-%d %H-%M-%S")
7070

71+
SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)
72+
7173
# 归档路径
7274
ARCHIVE_PATH="${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}.xcarchive"
7375
# 编译环境
@@ -88,8 +90,11 @@ cd ${WORKSPACE}
8890
# 签名
8991
sh sign "${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}.xcarchive.zip" --type xcarchive --plist "${PLIST_PATH}" --application macApp
9092

93+
# 重命名
94+
cp "${TARGET_NAME}_${BUILD_NUMBER}.app.zip" "${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}.app.zip"
95+
9196
# 上传IPA
92-
python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_${BUILD_NUMBER}.app.zip" --project
97+
python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}.app.zip" --project
9398

9499
# 删除archive文件
95100
rm -rf ${TARGET_NAME}_${BUILD_NUMBER}.xcarchive

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.3"
51+
def agora_sdk_version = "4.2.6"
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/examples/advanced/PreCallTest.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import androidx.annotation.NonNull;
1616
import androidx.annotation.Nullable;
1717

18+
import java.util.Random;
1819
import java.util.Timer;
1920
import java.util.TimerTask;
2021

@@ -24,6 +25,7 @@
2425
import io.agora.api.example.common.BaseFragment;
2526
import io.agora.api.example.common.model.StatisticsInfo;
2627
import io.agora.rtc2.Constants;
28+
import io.agora.rtc2.EchoTestConfiguration;
2729
import io.agora.rtc2.IRtcEngineEventHandler;
2830
import io.agora.rtc2.RtcEngine;
2931
import io.agora.rtc2.RtcEngineConfig;
@@ -159,7 +161,13 @@ public void onClick(View v) {
159161
}
160162
else if (v.getId() == R.id.btn_echo){
161163
num = 0;
162-
engine.startEchoTest(MAX_COUNT_DOWN);
164+
engine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER);
165+
EchoTestConfiguration config = new EchoTestConfiguration();
166+
config.enableVideo = false;
167+
config.enableAudio = true;
168+
config.intervalInSeconds = MAX_COUNT_DOWN;
169+
config.channelId = (new Random().nextInt(10000) + 100000) + "";
170+
engine.startEchoTest(config);
163171
btn_echo.setEnabled(false);
164172
btn_echo.setText("Recording on Microphone ...");
165173
echoTimer = new Timer(true);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ 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-7.3.3-bin.zip
7-
# distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip
6+
#distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip
7+
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip

Android/APIExample/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ dependencies {
6262
implementation fileTree(dir: "${localSdkPath}", include: ['*.jar', '*.aar'])
6363
}
6464
else{
65-
def agora_sdk_version = "4.2.3"
65+
def agora_sdk_version = "4.2.6"
6666
// case 1: full libs
6767
implementation "io.agora.rtc:full-sdk:${agora_sdk_version}"
6868
implementation "io.agora.rtc:full-screen-sharing:${agora_sdk_version}"

Android/APIExample/app/src/main/AndroidManifest.xml

-10
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@
4646
</intent-filter>
4747
</activity>
4848

49-
<service android:name=".examples.advanced.SwitchCameraScreenShare$MediaProjectFgService"
50-
android:enabled="true"
51-
android:exported="false"
52-
android:foregroundServiceType="mediaProjection" />
53-
54-
<service android:name=".examples.advanced.ScreenSharing$MediaProjectFgService"
55-
android:enabled="true"
56-
android:exported="false"
57-
android:foregroundServiceType="mediaProjection" />
58-
5949
<activity
6050
android:name=".SettingActivity"
6151
android:label="@string/setting"

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import androidx.annotation.NonNull;
1616
import androidx.annotation.Nullable;
1717

18+
import java.util.Random;
1819
import java.util.Timer;
1920
import java.util.TimerTask;
2021

@@ -24,6 +25,7 @@
2425
import io.agora.api.example.common.BaseFragment;
2526
import io.agora.api.example.common.model.StatisticsInfo;
2627
import io.agora.rtc2.Constants;
28+
import io.agora.rtc2.EchoTestConfiguration;
2729
import io.agora.rtc2.IRtcEngineEventHandler;
2830
import io.agora.rtc2.RtcEngine;
2931
import io.agora.rtc2.RtcEngineConfig;
@@ -159,7 +161,13 @@ public void onClick(View v) {
159161
}
160162
else if (v.getId() == R.id.btn_echo){
161163
num = 0;
162-
engine.startEchoTest(MAX_COUNT_DOWN);
164+
engine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER);
165+
EchoTestConfiguration config = new EchoTestConfiguration();
166+
config.enableVideo = false;
167+
config.enableAudio = true;
168+
config.intervalInSeconds = MAX_COUNT_DOWN;
169+
config.channelId = (new Random().nextInt(10000) + 100000) + "";
170+
engine.startEchoTest(config);
163171
btn_echo.setEnabled(false);
164172
btn_echo.setText("Recording on Microphone ...");
165173
echoTimer = new Timer(true);

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

-79
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@
66
import static io.agora.rtc2.video.VideoEncoderConfiguration.STANDARD_BITRATE;
77
import static io.agora.rtc2.video.VideoEncoderConfiguration.VD_640x360;
88

9-
import android.app.Notification;
10-
import android.app.NotificationChannel;
11-
import android.app.NotificationManager;
12-
import android.app.Service;
139
import android.content.Context;
14-
import android.content.Intent;
15-
import android.graphics.BitmapFactory;
16-
import android.graphics.Color;
17-
import android.os.Build;
1810
import android.os.Bundle;
19-
import android.os.IBinder;
2011
import android.util.DisplayMetrics;
2112
import android.util.Log;
2213
import android.view.LayoutInflater;
@@ -34,8 +25,6 @@
3425

3526
import androidx.annotation.NonNull;
3627
import androidx.annotation.Nullable;
37-
import androidx.annotation.RequiresApi;
38-
import androidx.core.app.NotificationCompat;
3928

4029
import com.yanzhenjie.permission.AndPermission;
4130
import com.yanzhenjie.permission.runtime.Permission;
@@ -83,7 +72,6 @@ public class ScreenSharing extends BaseFragment implements View.OnClickListener,
8372
private RtcEngineEx engine;
8473
private final ScreenCaptureParameters screenCaptureParameters = new ScreenCaptureParameters();
8574

86-
private Intent fgServiceIntent;
8775
private Spinner screenScenarioType;
8876

8977
@Nullable
@@ -122,9 +110,6 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
122110
if (context == null) {
123111
return;
124112
}
125-
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
126-
fgServiceIntent = new Intent(getActivity(), ScreenSharing.MediaProjectFgService.class);
127-
}
128113
try {
129114
RtcEngineConfig config = new RtcEngineConfig();
130115
/**
@@ -176,9 +161,6 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
176161

177162
@Override
178163
public void onDestroy() {
179-
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
180-
getActivity().stopService(fgServiceIntent);
181-
}
182164
/**leaveChannel and Destroy the RtcEngine instance*/
183165
if (engine != null) {
184166
engine.leaveChannel();
@@ -285,10 +267,6 @@ private void joinChannel(String channelId) {
285267
/**Set up to play remote sound with receiver*/
286268
engine.setDefaultAudioRoutetoSpeakerphone(true);
287269

288-
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
289-
getActivity().startForegroundService(fgServiceIntent);
290-
}
291-
292270
DisplayMetrics metrics = new DisplayMetrics();
293271
getActivity().getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
294272
screenCaptureParameters.captureVideo = true;
@@ -490,9 +468,6 @@ private void leaveChannel() {
490468
fl_remote.removeAllViews();
491469
remoteUid = myUid = -1;
492470

493-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
494-
getActivity().stopService(fgServiceIntent);
495-
}
496471
engine.leaveChannel();
497472
engine.stopScreenCapture();
498473
engine.stopPreview();
@@ -531,58 +506,4 @@ public void onNothingSelected(AdapterView<?> parent) {
531506

532507
}
533508

534-
public static class MediaProjectFgService extends Service {
535-
@Nullable
536-
@Override
537-
public IBinder onBind(Intent intent) {
538-
return null;
539-
}
540-
541-
@Override
542-
public void onCreate() {
543-
super.onCreate();
544-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
545-
createNotificationChannel();
546-
}
547-
}
548-
549-
@Override
550-
public int onStartCommand(Intent intent, int flags, int startId) {
551-
return START_NOT_STICKY;
552-
}
553-
554-
@Override
555-
public void onDestroy() {
556-
super.onDestroy();
557-
stopForeground(true);
558-
}
559-
560-
@RequiresApi(api = Build.VERSION_CODES.O)
561-
private void createNotificationChannel() {
562-
CharSequence name = getString(R.string.app_name);
563-
String description = "Notice that we are trying to capture the screen!!";
564-
int importance = NotificationManager.IMPORTANCE_HIGH;
565-
String channelId = "agora_channel_mediaproject";
566-
NotificationChannel channel = new NotificationChannel(channelId, name, importance);
567-
channel.setDescription(description);
568-
channel.enableLights(true);
569-
channel.setLightColor(Color.RED);
570-
channel.enableVibration(true);
571-
channel.setVibrationPattern(
572-
new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
573-
NotificationManager notificationManager = (NotificationManager)
574-
getSystemService(Context.NOTIFICATION_SERVICE);
575-
notificationManager.createNotificationChannel(channel);
576-
int notifyId = 1;
577-
// Create a notification and set the notification channel.
578-
Notification notification = new NotificationCompat.Builder(this, channelId)
579-
.setContentText(name + "正在录制屏幕内容...")
580-
.setSmallIcon(R.mipmap.ic_launcher)
581-
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
582-
.setChannelId(channelId)
583-
.setWhen(System.currentTimeMillis())
584-
.build();
585-
startForeground(notifyId, notification);
586-
}
587-
}
588509
}

0 commit comments

Comments
 (0)