Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/4.2.6 #364

Merged
merged 20 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/ci/build/build_ios_ipa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,18 @@ cd ${WORKSPACE}
# sh sign "${TARGET_NAME}_${BUILD_NUMBER}.xcarchive.zip" --type xcarchive --plist "${PLIST_PATH}"
sh export "${TARGET_NAME}_${BUILD_NUMBER}.xcarchive.zip" --plist "${PLIST_PATH}"

SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)
# 上传IPA
PAYLOAD_PATH="${TARGET_NAME}_${BUILD_NUMBER}_Payload"
PAYLOAD_PATH="${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}_Payload"
mkdir "${PAYLOAD_PATH}"
# mv "${TARGET_NAME}_${BUILD_NUMBER}_iOS.ipa" "${PAYLOAD_PATH}"
mv "${TARGET_NAME}_${BUILD_NUMBER}.ipa" "${PAYLOAD_PATH}"

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

# 删除IPA文件夹
rm -rf ${TARGET_NAME}_${BUILD_NUMBER}.xcarchive
rm -rf ${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}.xcarchive
rm -rf *.zip
rm -rf ${PAYLOAD_PATH}

Expand Down
1 change: 0 additions & 1 deletion .github/ci/build/build_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,4 @@ if [ $is_generate_validate_app = true ]; then
fi

7za a -tzip result.zip -r $unzip_name
# 7za a -tzip result.zip -r Agora_Native_SDK_for_Mac_FULL
cp result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name
7 changes: 6 additions & 1 deletion .github/ci/build/build_mac_ipa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ xcodebuild clean -workspace "${APP_PATH}" -configuration "${CONFIGURATION}" -sch
# 时间戳
CURRENT_TIME=$(date "+%Y-%m-%d %H-%M-%S")

SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)

# 归档路径
ARCHIVE_PATH="${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}.xcarchive"
# 编译环境
Expand All @@ -88,8 +90,11 @@ cd ${WORKSPACE}
# 签名
sh sign "${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}.xcarchive.zip" --type xcarchive --plist "${PLIST_PATH}" --application macApp

# 重命名
cp "${TARGET_NAME}_${BUILD_NUMBER}.app.zip" "${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}.app.zip"

# 上传IPA
python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_${BUILD_NUMBER}.app.zip" --project
python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}.app.zip" --project

# 删除archive文件
rm -rf ${TARGET_NAME}_${BUILD_NUMBER}.xcarchive
Expand Down
2 changes: 1 addition & 1 deletion Android/APIExample-Audio/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies {
implementation fileTree(dir: "${localSdkPath}", include: ['*.jar', '*.aar'])
}
else{
def agora_sdk_version = "4.2.3"
def agora_sdk_version = "4.2.6"
// case 1: full single lib with voice only
implementation "io.agora.rtc:voice-sdk:${agora_sdk_version}"
// case 2: partial libs with voice only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;

Expand All @@ -24,6 +25,7 @@
import io.agora.api.example.common.BaseFragment;
import io.agora.api.example.common.model.StatisticsInfo;
import io.agora.rtc2.Constants;
import io.agora.rtc2.EchoTestConfiguration;
import io.agora.rtc2.IRtcEngineEventHandler;
import io.agora.rtc2.RtcEngine;
import io.agora.rtc2.RtcEngineConfig;
Expand Down Expand Up @@ -159,7 +161,13 @@ public void onClick(View v) {
}
else if (v.getId() == R.id.btn_echo){
num = 0;
engine.startEchoTest(MAX_COUNT_DOWN);
engine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER);
EchoTestConfiguration config = new EchoTestConfiguration();
config.enableVideo = false;
config.enableAudio = true;
config.intervalInSeconds = MAX_COUNT_DOWN;
config.channelId = (new Random().nextInt(10000) + 100000) + "";
engine.startEchoTest(config);
btn_echo.setEnabled(false);
btn_echo.setText("Recording on Microphone ...");
echoTimer = new Timer(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip
# distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip
#distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip
2 changes: 1 addition & 1 deletion Android/APIExample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dependencies {
implementation fileTree(dir: "${localSdkPath}", include: ['*.jar', '*.aar'])
}
else{
def agora_sdk_version = "4.2.3"
def agora_sdk_version = "4.2.6"
// case 1: full libs
implementation "io.agora.rtc:full-sdk:${agora_sdk_version}"
implementation "io.agora.rtc:full-screen-sharing:${agora_sdk_version}"
Expand Down
10 changes: 0 additions & 10 deletions Android/APIExample/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@
</intent-filter>
</activity>

<service android:name=".examples.advanced.SwitchCameraScreenShare$MediaProjectFgService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="mediaProjection" />

<service android:name=".examples.advanced.ScreenSharing$MediaProjectFgService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="mediaProjection" />

<activity
android:name=".SettingActivity"
android:label="@string/setting"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;

Expand All @@ -24,6 +25,7 @@
import io.agora.api.example.common.BaseFragment;
import io.agora.api.example.common.model.StatisticsInfo;
import io.agora.rtc2.Constants;
import io.agora.rtc2.EchoTestConfiguration;
import io.agora.rtc2.IRtcEngineEventHandler;
import io.agora.rtc2.RtcEngine;
import io.agora.rtc2.RtcEngineConfig;
Expand Down Expand Up @@ -159,7 +161,13 @@ public void onClick(View v) {
}
else if (v.getId() == R.id.btn_echo){
num = 0;
engine.startEchoTest(MAX_COUNT_DOWN);
engine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER);
EchoTestConfiguration config = new EchoTestConfiguration();
config.enableVideo = false;
config.enableAudio = true;
config.intervalInSeconds = MAX_COUNT_DOWN;
config.channelId = (new Random().nextInt(10000) + 100000) + "";
engine.startEchoTest(config);
btn_echo.setEnabled(false);
btn_echo.setText("Recording on Microphone ...");
echoTimer = new Timer(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,8 @@
import static io.agora.rtc2.video.VideoEncoderConfiguration.STANDARD_BITRATE;
import static io.agora.rtc2.video.VideoEncoderConfiguration.VD_640x360;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
Expand All @@ -34,8 +25,6 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;

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

private Intent fgServiceIntent;
private Spinner screenScenarioType;

@Nullable
Expand Down Expand Up @@ -122,9 +110,6 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
if (context == null) {
return;
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
fgServiceIntent = new Intent(getActivity(), ScreenSharing.MediaProjectFgService.class);
}
try {
RtcEngineConfig config = new RtcEngineConfig();
/**
Expand Down Expand Up @@ -176,9 +161,6 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {

@Override
public void onDestroy() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
getActivity().stopService(fgServiceIntent);
}
/**leaveChannel and Destroy the RtcEngine instance*/
if (engine != null) {
engine.leaveChannel();
Expand Down Expand Up @@ -285,10 +267,6 @@ private void joinChannel(String channelId) {
/**Set up to play remote sound with receiver*/
engine.setDefaultAudioRoutetoSpeakerphone(true);

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
getActivity().startForegroundService(fgServiceIntent);
}

DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
screenCaptureParameters.captureVideo = true;
Expand Down Expand Up @@ -490,9 +468,6 @@ private void leaveChannel() {
fl_remote.removeAllViews();
remoteUid = myUid = -1;

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
getActivity().stopService(fgServiceIntent);
}
engine.leaveChannel();
engine.stopScreenCapture();
engine.stopPreview();
Expand Down Expand Up @@ -531,58 +506,4 @@ public void onNothingSelected(AdapterView<?> parent) {

}

public static class MediaProjectFgService extends Service {
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}

@Override
public void onCreate() {
super.onCreate();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
createNotificationChannel();
}
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_NOT_STICKY;
}

@Override
public void onDestroy() {
super.onDestroy();
stopForeground(true);
}

@RequiresApi(api = Build.VERSION_CODES.O)
private void createNotificationChannel() {
CharSequence name = getString(R.string.app_name);
String description = "Notice that we are trying to capture the screen!!";
int importance = NotificationManager.IMPORTANCE_HIGH;
String channelId = "agora_channel_mediaproject";
NotificationChannel channel = new NotificationChannel(channelId, name, importance);
channel.setDescription(description);
channel.enableLights(true);
channel.setLightColor(Color.RED);
channel.enableVibration(true);
channel.setVibrationPattern(
new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
NotificationManager notificationManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.createNotificationChannel(channel);
int notifyId = 1;
// Create a notification and set the notification channel.
Notification notification = new NotificationCompat.Builder(this, channelId)
.setContentText(name + "正在录制屏幕内容...")
.setSmallIcon(R.mipmap.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
.setChannelId(channelId)
.setWhen(System.currentTimeMillis())
.build();
startForeground(notifyId, notification);
}
}
}
Loading
Loading