修复声网直播间会白屏问题

调整模块间的引用
This commit is contained in:
2024-06-11 14:08:45 +08:00
parent d70c3a8b27
commit 5ae55f87fa
5 changed files with 20 additions and 16 deletions

View File

@@ -227,4 +227,7 @@ dependencies {
//声网SDK
//api 'io.agora.rtc:agora-special-full:4.2.6.245'
//ExoPlayer,腾讯的播放器不支持无缝切换
api 'com.google.android.exoplayer:exoplayer:2.18.2'
api 'com.google.android.exoplayer:exoplayer-core:2.18.2@aar'
}

View File

@@ -9,9 +9,9 @@ ext {
]
manifestPlaceholders = [
//正式、
serverHost : "https://napi.yaoulive.com",
// serverHost : "https://napi.yaoulive.com",
// 测试
// serverHost : "https://ceshi.yaoulive.com",
serverHost : "https://ceshi.yaoulive.com",
buildTime : new Date().format("MM-dd HH:mm", TimeZone.getTimeZone("GMT+8")),

View File

@@ -40,6 +40,7 @@ dependencies {
api "$AGORA_RTC_SDK"
}
api project(path: ':FaceUnity')
api project(path: ':common')
}
// Because the components are created only during the afterEvaluate phase, you must

View File

@@ -3,7 +3,7 @@ package io.agora.beautyapi.faceunity.agora;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.SurfaceView;
import android.view.TextureView;
import android.widget.FrameLayout;
@@ -166,8 +166,8 @@ public class SWAuManager extends BaseCacheManager {
*/
public void updateMyChannelView(FrameLayout frameLayout, int uid) {
mRtcEngine.setupLocalVideo(null);
SurfaceView surfaceView = new SurfaceView(mContext);
surfaceView.setZOrderMediaOverlay(true);
TextureView surfaceView = new TextureView(mContext);
//surfaceView.setZOrderMediaOverlay(true);
frameLayout.addView(surfaceView);
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid);
@@ -185,8 +185,8 @@ public class SWAuManager extends BaseCacheManager {
} else {
uid = Integer.parseInt(strUid);
}
// 创建一个 SurfaceView 对象,并将其作为 FrameLayout 的子对象
SurfaceView surfaceView = new SurfaceView(mContext);
// 创建一个 TextureView 对象,并将其作为 FrameLayout 的子对象
TextureView surfaceView = new TextureView(mContext);
audienceContainer.addView(surfaceView);
// 启用视频模块
@@ -228,8 +228,8 @@ public class SWAuManager extends BaseCacheManager {
@Override
public void run() {
L.eSw("onJoinChannelSuccess:" + channel + " uid " + uid + " elapsed: " + elapsed);
SurfaceView surfaceView = new SurfaceView(mContext);
surfaceView.setZOrderMediaOverlay(true);
TextureView surfaceView = new TextureView(mContext);
// surfaceView.setZOrderMediaOverlay(true);
pkContainer1.addView(surfaceView);
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, strUid);
mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
@@ -308,8 +308,8 @@ public class SWAuManager extends BaseCacheManager {
mContext.runOnUiThread(new Runnable() {
@Override
public void run() {
SurfaceView surfaceView = new SurfaceView(mContext);
surfaceView.setZOrderMediaOverlay(true);
TextureView surfaceView = new TextureView(mContext);
// surfaceView.setZOrderMediaOverlay(true);
frameLayout.addView(surfaceView);
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, Integer.parseInt(toUid));
mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
@@ -389,10 +389,10 @@ public class SWAuManager extends BaseCacheManager {
//设置对方主播视图
public void setupRemoteVideo(int uid) {
SurfaceView surfaceView = new SurfaceView(mContext);
surfaceView.setZOrderMediaOverlay(true);
TextureView surfaceView = new TextureView(mContext);
// surfaceView.setZOrderMediaOverlay(true);
audienceContainer.addView(surfaceView);
// 将 SurfaceView 对象传入声网实时互动 SDK设置远端视图
// 将 TextureView 对象传入声网实时互动 SDK设置远端视图
mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid));
}
@@ -422,7 +422,7 @@ public class SWAuManager extends BaseCacheManager {
public void preloadChannel(List<LiveBean> uids){
for (int i = 0; i <uids.size(); i++) {
int code = mRtcEngine.preloadChannel(CommonAppConfig.SWToken,getChannelName(uids.get(i).getUid()),Integer.parseInt(CommonAppConfig.getInstance().getUid()));
int code = mRtcEngine.preloadChannel(CommonAppConfig.SWToken,getChannelName(uids.get(i).getUid()),Integer.parseInt(CommonAppConfig.getInstance().getUid()));
L.eSw("设置秒开数据 uid"+uids.get(i).getUid()+" --- userName:"+uids.get(i).getUserNiceName()+" code "+code);
}
}

View File

@@ -1 +1 @@
apply plugin: 'com.android.library'
apply plugin: 'com.android.library'