修复安卓用户主播关播后在关播顶面显示主播最后一真画面。

修复安卓主播关播后还在一直推流。
This commit is contained in:
zlzw 2024-06-18 17:39:05 +08:00
parent d8e9cc2189
commit 48e3ff46ab
3 changed files with 29 additions and 7 deletions

View File

@ -2,8 +2,16 @@ package io.agora.beautyapi.faceunity.agora;
import android.app.Activity;
import android.content.Context;
import android.opengl.EGL14;
import android.opengl.EGLConfig;
import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.opengl.GLES20;
import android.util.Log;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.widget.FrameLayout;
@ -98,7 +106,7 @@ public class SWAuManager extends BaseCacheManager {
*/
public void initRtcEngine(Activity mContext) {
this.mContext = mContext;
if(mRtcEngine==null){
if (mRtcEngine == null) {
try {
// 创建 RtcEngineConfig 对象并进行配置
RtcEngineConfig config = new RtcEngineConfig();
@ -122,7 +130,7 @@ public class SWAuManager extends BaseCacheManager {
public void initRtcEngineAudio(Activity mContext) {
this.mContext = mContext;
try {
if(mRtcEngine==null){
if (mRtcEngine == null) {
RtcEngineConfig config = new RtcEngineConfig();
config.mContext = mContext;
config.mAppId = CommonAppConfig.getSwAppId();
@ -354,7 +362,7 @@ public class SWAuManager extends BaseCacheManager {
}
public static String getChannelName(String liveUid) {
if ( liveUid != null &&liveUid.contains("g")) {
if (liveUid != null && liveUid.contains("g")) {
return liveUid;
} else {
return CommonAppConfig.SWChannelPrefix + liveUid;
@ -416,14 +424,26 @@ public class SWAuManager extends BaseCacheManager {
this.linkUserContainer = linkUserContainer;
}
public void release() {
if (audienceContainer != null) {
TextureView childAt = (TextureView) audienceContainer.getChildAt(0);
if (childAt != null && childAt.getSurfaceTexture() != null) {
childAt.setVisibility(View.GONE);
childAt.invalidate();
audienceContainer.removeAllViews();
}
}
}
public interface SwListener {
void onUserOffline(int liveUid);
}
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()));
L.eSw("设置秒开数据 uid"+uids.get(i).getUid()+" --- userName:"+uids.get(i).getUserNiceName()+" code "+code);
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()));
L.eSw("设置秒开数据 uid" + uids.get(i).getUid() + " --- userName:" + uids.get(i).getUserNiceName() + " code " + code);
}
}
}

View File

@ -630,6 +630,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
mEnd = true;
mStarted = false;
Bus.getOff(this);
swAuManager.release();
EventBus.getDefault().unregister(this);
//swAuManager.exitChannelAll();
L.e(TAG, "release------->");

View File

@ -549,6 +549,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
public void release() {
super.release();
Bus.getOff(this);
onDestroy();
LiveHttpUtil.cancel(LiveHttpConsts.LINK_MIC_TX_MIX_STREAM);
rtcRoom = null;
}