From 39cf76439f6c03f52b7727194d394591f1695273 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Sat, 1 Jun 2024 10:32:32 +0800 Subject: [PATCH] =?UTF-8?q?fix[=E5=A3=B0=E6=9C=9B=E5=8D=87=E7=BA=A7-APPID?= =?UTF-8?q?=20=E6=9B=B4=E6=8D=A2=E5=AD=98=E5=82=A8=E4=BD=8D=E7=BD=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/common/CommonAppConfig.java | 2 ++ .../beautyapi/faceunity/agora/SWAuManager.java | 16 +++++++++++----- .../beautyapi/faceunity/agora/SWManager.java | 5 +---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java index 3ec41c897..5b98684f4 100644 --- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java +++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java @@ -79,6 +79,8 @@ public class CommonAppConfig { public static String SWToken = ""; //声网Token public static final String SWChannelPrefix = "g"; + public static final String SWAPPId = "4cf0376582d742ac8a96778b25b1079e"; + /** * 获取通道 diff --git a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWAuManager.java b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWAuManager.java index 63ca6e76a..b3f9742d7 100644 --- a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWAuManager.java +++ b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWAuManager.java @@ -10,6 +10,7 @@ import android.widget.FrameLayout; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.API; import com.yunbao.common.http.ResponseModel; @@ -21,6 +22,8 @@ import com.yunbao.common.utils.L; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import java.util.List; + import io.agora.rtc2.ChannelMediaOptions; import io.agora.rtc2.Constants; import io.agora.rtc2.IRtcEngineEventHandler; @@ -43,9 +46,6 @@ import io.rong.message.TextMessage; */ public class SWAuManager extends BaseCacheManager { - // 填写项目的 App ID,可在声网控制台中生成 - public static final String shengwang_appId = "4cf0376582d742ac8a96778b25b1079e"; - // 填写频道名 private Activity mContext; public static SWAuManager manager; private RtcEngineEx mRtcEngine; @@ -102,7 +102,7 @@ public class SWAuManager extends BaseCacheManager { // 创建 RtcEngineConfig 对象,并进行配置 RtcEngineConfig config = new RtcEngineConfig(); config.mContext = mContext; - config.mAppId = SWAuManager.shengwang_appId; + config.mAppId = CommonAppConfig.SWAPPId; config.mEventHandler = mRtcEventHandler; // 创建并初始化 RtcEngine mRtcEngine = (RtcEngineEx) RtcEngineEx.create(config); @@ -123,7 +123,7 @@ public class SWAuManager extends BaseCacheManager { // 创建 RtcEngineConfig 对象,并进行配置 RtcEngineConfig config = new RtcEngineConfig(); config.mContext = mContext; - config.mAppId = SWAuManager.shengwang_appId; + config.mAppId = CommonAppConfig.SWAPPId; config.mEventHandler = mEventHandler; // 创建并初始化 RtcEngine mRtcEngine = (RtcEngineEx) RtcEngineEx.create(config); @@ -415,4 +415,10 @@ public class SWAuManager extends BaseCacheManager { public interface SwListener { void onUserOffline(int liveUid); } + + public void preloadChannel(List uids){ + for (int i = 0; i