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

View File

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

View File

@ -11,6 +11,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
@ -244,31 +245,34 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
.setParametersModel(openParametersModel
.setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal)));
if (mLivePlayViewHolder == null) {
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.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();
mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
mLiveAudienceViewHolder.addToParent();
mLiveRoomViewHolder.addToParent();
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);
//ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack);
mask.setVisibility(View.VISIBLE);
mLivePlayViewHolder.setCover(data.getThumb());
mLivePlayViewHolder.play(data.getPull());
mLiveRoomViewHolder.clearChat();
mLiveRoomViewHolder.setAvatar(data.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor());
mLiveRoomViewHolder.setName(data.getUserNiceName());
mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
mLiveRoomViewHolder.setTitle(data.getTitle());
mLiveRoomViewHolder.setAnchorGoodNumber(data.getGoodNum());
mLiveRoomViewHolder.clearGuardIcon();
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
@ -321,43 +325,20 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
IMLoginManager.get(mContext).setisNewUserOne(false);
//子线程执行退出操作
exitLiveRoom(false);
if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeFromParent();
mLiveAudienceViewHolder.removeCallbacks();
mLiveAudienceViewHolder.release();
}
mLiveAudienceViewHolder = null;
//断开socket
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
}
mSocketRyClient = null;
//结束播放
if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.removeFromParent();
mLivePlayViewHolder.stopPlay();
mLivePlayViewHolder.release();
}
mLivePlayViewHolder = null;
if (mSocketClient != null) {
mSocketClient.disConnect();
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) {
mLiveLinkMicPresenter.clearData();
mLiveLinkMicPresenter.release();
@ -372,6 +353,33 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
if (isQuit) {
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) {
LiveFloatView.getInstance()
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)