Merge branch 'dev_room'

# Conflicts:
#	live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
This commit is contained in:
zlzw 2022-11-14 15:27:55 +08:00
commit 6ac610e1aa
4 changed files with 65 additions and 43 deletions

View File

@ -409,6 +409,9 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
handler.postDelayed(runnable = new Runnable() { handler.postDelayed(runnable = new Runnable() {
@Override @Override
public void run() { public void run() {
if(!liveUid.equals(mLiveUid)){
return;
}
if (isattention == 0) { if (isattention == 0) {
LiveChatBean lvBean = new LiveChatBean(); LiveChatBean lvBean = new LiveChatBean();
lvBean.setType(-1); lvBean.setType(-1);
@ -418,6 +421,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
LiveChatBean lvBean2 = new LiveChatBean(); LiveChatBean lvBean2 = new LiveChatBean();
lvBean2.setType(-2); lvBean2.setType(-2);
LiveRoomViewHolder.insertChat(lvBean2, 1); LiveRoomViewHolder.insertChat(lvBean2, 1);
Log.i("chatMgs", liveUid+"|"+mLiveUid);
} }
}, 10000);//3秒后执行Runnable中的run方法 }, 10000);//3秒后执行Runnable中的run方法
} }

View File

@ -146,7 +146,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mPkContainer.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mPkContainer.getLayoutParams();
params.height = vHeight; params.height = vHeight;
mPkContainer.requestLayout(); mPkContainer.requestLayout();
mPlayer = new V2TXLivePlayerImpl(mContext);
mPlayer.setRenderView(mVideoView);
} }
@Override @Override
@ -192,12 +193,12 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
return; return;
} }
mPlayer = new V2TXLivePlayerImpl(mContext);
if (TextUtils.isEmpty(url) || mVideoView == null) { if (TextUtils.isEmpty(url) || mVideoView == null) {
return; return;
} }
//mPlayer.setCacheParams(1.0f, 5.0f); //mPlayer.setCacheParams(1.0f, 5.0f);
mVideoView.clearLastFrame(true);
mPlayer.setObserver(new V2TXLivePlayerObserver() { mPlayer.setObserver(new V2TXLivePlayerObserver() {
String TAG = "播放流"; String TAG = "播放流";
@ -292,7 +293,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
super.onReceiveSeiMessage(player, payloadType, data); super.onReceiveSeiMessage(player, payloadType, data);
} }
}); });
mPlayer.setRenderView(mVideoView);
purl = url; purl = url;
mPlayer.startPlay(url); mPlayer.startPlay(url);
onPrepared(); onPrepared();

View File

@ -1056,7 +1056,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}); });
} }
public void clearChat(){
if(mLiveChatAdapter!=null){
mLiveChatAdapter.clear();
}
}
public void clearGuardIcon(){
if(userGuard!=null){
userGuard.setImageResource(R.mipmap.img_guardian_empty);
}
}
public synchronized void showStart(StarChallengeStatusModel data) { public synchronized void showStart(StarChallengeStatusModel data) {
boolean upData = false; boolean upData = false;
if (mBannerList2 != null && mBannerList2.size() == 0) { if (mBannerList2 != null && mBannerList2.size() == 0) {

View File

@ -11,6 +11,7 @@ import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.os.Handler; import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -244,31 +245,34 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
.setParametersModel(openParametersModel .setParametersModel(openParametersModel
.setmLiveType(mLiveType) .setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal))); .setmLiveTypeVal(mLiveTypeVal)));
if (mLivePlayViewHolder == null) {
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mLiveBean.getLandscape()); mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mLiveBean.getLandscape());
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager());
mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
mLivePlayViewHolder.addToParent(); mLivePlayViewHolder.addToParent();
mLivePlayViewHolder.subscribeActivityLifeCycle(); mLivePlayViewHolder.subscribeActivityLifeCycle();
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager());
mLiveRoomViewHolder.subscribeActivityLifeCycle(); mLiveRoomViewHolder.subscribeActivityLifeCycle();
mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
mLiveAudienceViewHolder.addToParent(); mLiveAudienceViewHolder.addToParent();
mLiveRoomViewHolder.addToParent(); mLiveRoomViewHolder.addToParent();
mLiveAudienceViewHolder.subscribeActivityLifeCycle(); mLiveAudienceViewHolder.subscribeActivityLifeCycle();
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView()); }
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
//直播间背景 //直播间背景
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600); ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600);
//ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack); //ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack);
mask.setVisibility(View.VISIBLE); mask.setVisibility(View.VISIBLE);
mLivePlayViewHolder.setCover(data.getThumb()); mLivePlayViewHolder.setCover(data.getThumb());
mLivePlayViewHolder.play(data.getPull()); mLivePlayViewHolder.play(data.getPull());
mLiveRoomViewHolder.clearChat();
mLiveRoomViewHolder.setAvatar(data.getAvatar()); mLiveRoomViewHolder.setAvatar(data.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor()); mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor());
mLiveRoomViewHolder.setName(data.getUserNiceName()); mLiveRoomViewHolder.setName(data.getUserNiceName());
mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip()); mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
mLiveRoomViewHolder.setTitle(data.getTitle()); mLiveRoomViewHolder.setTitle(data.getTitle());
mLiveRoomViewHolder.setAnchorGoodNumber(data.getGoodNum()); mLiveRoomViewHolder.setAnchorGoodNumber(data.getGoodNum());
mLiveRoomViewHolder.clearGuardIcon();
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
@ -321,43 +325,20 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
IMLoginManager.get(mContext).setisNewUserOne(false); IMLoginManager.get(mContext).setisNewUserOne(false);
//子线程执行退出操作 //子线程执行退出操作
exitLiveRoom(false); exitLiveRoom(false);
if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeFromParent();
mLiveAudienceViewHolder.removeCallbacks();
mLiveAudienceViewHolder.release();
}
mLiveAudienceViewHolder = null;
//断开socket //断开socket
if (mSocketRyClient != null) { if (mSocketRyClient != null) {
mSocketRyClient.disConnect(); mSocketRyClient.disConnect();
}
mSocketRyClient = null; mSocketRyClient = null;
//结束播放
if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.removeFromParent();
mLivePlayViewHolder.stopPlay();
mLivePlayViewHolder.release();
} }
mLivePlayViewHolder = null;
if (mSocketClient != null) { if (mSocketClient != null) {
mSocketClient.disConnect(); mSocketClient.disConnect();
mSocketClient = null; mSocketClient = null;
} }
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.removeFromParent();
mLiveRoomViewHolder.clearData();
mLiveRoomViewHolder.countDownTimerTrickery = null;
mLiveRoomViewHolder = null;
}
if (mLiveEndViewHolder != null) {
mLiveEndViewHolder.removeFromParent();
mLiveEndViewHolder.release();
mLiveEndViewHolder = null;
}
if (mLiveLinkMicPresenter != null) { if (mLiveLinkMicPresenter != null) {
mLiveLinkMicPresenter.clearData(); mLiveLinkMicPresenter.clearData();
mLiveLinkMicPresenter.release(); mLiveLinkMicPresenter.release();
@ -372,6 +353,33 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
if (isQuit) { if (isQuit) {
isQuitF = true; isQuitF = true;
if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeFromParent();
mLiveAudienceViewHolder.removeCallbacks();
mLiveAudienceViewHolder.release();
}
//结束播放
if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.removeFromParent();
mLivePlayViewHolder.stopPlay();
mLivePlayViewHolder.release();
}
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.removeFromParent();
mLiveRoomViewHolder.clearData();
mLiveRoomViewHolder.countDownTimerTrickery = null;
}
if (mLiveEndViewHolder != null) {
mLiveEndViewHolder.removeFromParent();
mLiveEndViewHolder.release();
}
mLiveAudienceViewHolder = null;
mLivePlayViewHolder = null;
mLiveRoomViewHolder = null;
mLiveEndViewHolder = null;
mLiveLinkMicPresenter=null;
mLiveLinkMicAnchorPresenter=null;
mLiveRyLinkMicPkPresenter=null;
if (PermissionUtils.checkPermission(mContext) && !kick) { if (PermissionUtils.checkPermission(mContext) && !kick) {
LiveFloatView.getInstance() LiveFloatView.getInstance()
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal) .cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)