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

调整模块间的引用
This commit is contained in:
zlzw 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 //SDK
//api 'io.agora.rtc:agora-special-full:4.2.6.245' //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 = [ 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")), buildTime : new Date().format("MM-dd HH:mm", TimeZone.getTimeZone("GMT+8")),

View File

@ -40,6 +40,7 @@ dependencies {
api "$AGORA_RTC_SDK" api "$AGORA_RTC_SDK"
} }
api project(path: ':FaceUnity') api project(path: ':FaceUnity')
api project(path: ':common')
} }
// Because the components are created only during the afterEvaluate phase, you must // 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.app.Activity;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
import android.view.SurfaceView; import android.view.TextureView;
import android.widget.FrameLayout; import android.widget.FrameLayout;
@ -166,8 +166,8 @@ public class SWAuManager extends BaseCacheManager {
*/ */
public void updateMyChannelView(FrameLayout frameLayout, int uid) { public void updateMyChannelView(FrameLayout frameLayout, int uid) {
mRtcEngine.setupLocalVideo(null); mRtcEngine.setupLocalVideo(null);
SurfaceView surfaceView = new SurfaceView(mContext); TextureView surfaceView = new TextureView(mContext);
surfaceView.setZOrderMediaOverlay(true); //surfaceView.setZOrderMediaOverlay(true);
frameLayout.addView(surfaceView); frameLayout.addView(surfaceView);
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid); VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid);
@ -185,8 +185,8 @@ public class SWAuManager extends BaseCacheManager {
} else { } else {
uid = Integer.parseInt(strUid); uid = Integer.parseInt(strUid);
} }
// 创建一个 SurfaceView 对象并将其作为 FrameLayout 的子对象 // 创建一个 TextureView 对象并将其作为 FrameLayout 的子对象
SurfaceView surfaceView = new SurfaceView(mContext); TextureView surfaceView = new TextureView(mContext);
audienceContainer.addView(surfaceView); audienceContainer.addView(surfaceView);
// 启用视频模块 // 启用视频模块
@ -228,8 +228,8 @@ public class SWAuManager extends BaseCacheManager {
@Override @Override
public void run() { public void run() {
L.eSw("onJoinChannelSuccess:" + channel + " uid " + uid + " elapsed: " + elapsed); L.eSw("onJoinChannelSuccess:" + channel + " uid " + uid + " elapsed: " + elapsed);
SurfaceView surfaceView = new SurfaceView(mContext); TextureView surfaceView = new TextureView(mContext);
surfaceView.setZOrderMediaOverlay(true); // surfaceView.setZOrderMediaOverlay(true);
pkContainer1.addView(surfaceView); pkContainer1.addView(surfaceView);
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, strUid); VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, strUid);
mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection); mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
@ -308,8 +308,8 @@ public class SWAuManager extends BaseCacheManager {
mContext.runOnUiThread(new Runnable() { mContext.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
SurfaceView surfaceView = new SurfaceView(mContext); TextureView surfaceView = new TextureView(mContext);
surfaceView.setZOrderMediaOverlay(true); // surfaceView.setZOrderMediaOverlay(true);
frameLayout.addView(surfaceView); frameLayout.addView(surfaceView);
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, Integer.parseInt(toUid)); VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, Integer.parseInt(toUid));
mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection); mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
@ -389,10 +389,10 @@ public class SWAuManager extends BaseCacheManager {
//设置对方主播视图 //设置对方主播视图
public void setupRemoteVideo(int uid) { public void setupRemoteVideo(int uid) {
SurfaceView surfaceView = new SurfaceView(mContext); TextureView surfaceView = new TextureView(mContext);
surfaceView.setZOrderMediaOverlay(true); // surfaceView.setZOrderMediaOverlay(true);
audienceContainer.addView(surfaceView); audienceContainer.addView(surfaceView);
// SurfaceView 对象传入声网实时互动 SDK设置远端视图 // TextureView 对象传入声网实时互动 SDK设置远端视图
mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid)); 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){ public void preloadChannel(List<LiveBean> uids){
for (int i = 0; i <uids.size(); i++) { 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); 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: 'img-optimizer' apply plugin: 'kotlin-android' android { compileSdkVersion rootProject.ext.android.compileSdkVersion buildToolsVersion rootProject.ext.android.buildToolsVersion aaptOptions.cruncherEnabled = false aaptOptions.useNewCruncher = false packagingOptions { pickFirst "lib/armeabi/libyuvutils.so" pickFirst "lib/arm64-v8a/libyuvutils.so" pickFirst "lib/armeabi-v7a/libyuvutils.so" pickFirst "lib/armeabi/libyuvtools.so" pickFirst "lib/arm64-v8a/libyuvtools.so" pickFirst "lib/armeabi-v7a/libyuvtools.so" exclude "lib/arm64-v8a/libmmcv_api_handgesture.so" exclude "lib/arm64-v8a/libmmcv_api_express.so" exclude "lib/arm64-v8a/libMediaEncoder.so" exclude "lib/arm64-v8a/libarcore_sdk_c.so" exclude "lib/arm64-v8a/libmediadecoder.so" exclude "lib/arm64-v8a/libMediaMuxer.so" exclude "lib/arm64-v8a/libarcore_sdk_jni.so" exclude "lib/arm64-v8a/libMediaUtils.so" exclude "lib/arm64-v8a/libcosmosffmpeg.so" } defaultConfig { minSdkVersion rootProject.ext.android.minSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion versionCode rootProject.ext.android.versionCode versionName rootProject.ext.android.versionName manifestPlaceholders = rootProject.ext.manifestPlaceholders ndk { abiFilters "armeabi-v7a", "arm64-v8a","x86","x86_64" } javaCompileOptions { annotationProcessorOptions { arguments = [AROUTER_MODULE_NAME: project.getName()] } } } aaptOptions { cruncherEnabled = false useNewCruncher = false } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } kotlinOptions { allWarningsAsErrors = true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } repositories { flatDir { dirs 'libs', '../libs' } mavenCentral() } dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.0.0' implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation (name:'../libs/beautysdk-202202241203',ext:'aar') implementation (name:'../libs/svgaplayer-release-v1.2.1',ext:'aar') //socket.io implementation('io.socket:socket.io-client:1.0.0') { exclude group: 'org.json', module: 'json' } //common api project(path:':lib_faceunity')//新娱美颜 api project(':Share')//分享 annotationProcessor rootProject.ext.dependencies["arouter-compiler"] //工具 api rootProject.ext.dependencies["blank-utilcode"] implementation 'com.eightbitlab:blurview:1.6.6' implementation 'com.google.code.gson:gson:2.8.6' implementation "com.getkeepsafe.relinker:relinker:1.4.4" //ExoPlayer,腾讯的播放器不支持无缝切换 implementation 'com.google.android.exoplayer:exoplayer:2.18.2' implementation 'com.google.android.exoplayer:exoplayer-core:2.18.2@aar' } apply plugin: 'com.android.library' apply plugin: 'img-optimizer' apply plugin: 'kotlin-android' android { compileSdkVersion rootProject.ext.android.compileSdkVersion buildToolsVersion rootProject.ext.android.buildToolsVersion aaptOptions.cruncherEnabled = false aaptOptions.useNewCruncher = false packagingOptions { pickFirst "lib/armeabi/libyuvutils.so" pickFirst "lib/arm64-v8a/libyuvutils.so" pickFirst "lib/armeabi-v7a/libyuvutils.so" pickFirst "lib/armeabi/libyuvtools.so" pickFirst "lib/arm64-v8a/libyuvtools.so" pickFirst "lib/armeabi-v7a/libyuvtools.so" exclude "lib/arm64-v8a/libmmcv_api_handgesture.so" exclude "lib/arm64-v8a/libmmcv_api_express.so" exclude "lib/arm64-v8a/libMediaEncoder.so" exclude "lib/arm64-v8a/libarcore_sdk_c.so" exclude "lib/arm64-v8a/libmediadecoder.so" exclude "lib/arm64-v8a/libMediaMuxer.so" exclude "lib/arm64-v8a/libarcore_sdk_jni.so" exclude "lib/arm64-v8a/libMediaUtils.so" exclude "lib/arm64-v8a/libcosmosffmpeg.so" } defaultConfig { minSdkVersion rootProject.ext.android.minSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion versionCode rootProject.ext.android.versionCode versionName rootProject.ext.android.versionName manifestPlaceholders = rootProject.ext.manifestPlaceholders ndk { abiFilters "armeabi-v7a", "arm64-v8a","x86","x86_64" } javaCompileOptions { annotationProcessorOptions { arguments = [AROUTER_MODULE_NAME: project.getName()] } } } aaptOptions { cruncherEnabled = false useNewCruncher = false } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } kotlinOptions { allWarningsAsErrors = true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } repositories { flatDir { dirs 'libs', '../libs' } mavenCentral() } dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.0.0' implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation (name:'../libs/beautysdk-202202241203',ext:'aar') implementation (name:'../libs/svgaplayer-release-v1.2.1',ext:'aar') //socket.io implementation('io.socket:socket.io-client:1.0.0') { exclude group: 'org.json', module: 'json' } //common api project(path:':lib_faceunity')//声网-新娱美颜 api project(path:':FaceUnity')//融云-新娱美颜 api project(path:':common')//公共库 api project(':Share')//分享 annotationProcessor rootProject.ext.dependencies["arouter-compiler"] //工具 api rootProject.ext.dependencies["blank-utilcode"] implementation 'com.eightbitlab:blurview:1.6.6' implementation 'com.google.code.gson:gson:2.8.6' implementation "com.getkeepsafe.relinker:relinker:1.4.4" }