直播间内存优化稳定到0.7G左右
This commit is contained in:
parent
50f83939cc
commit
7e169e882d
@ -27,6 +27,6 @@ ext {
|
||||
// true表示谷歌支付 false
|
||||
isGooglePlay : true,
|
||||
//是否上报异常日志
|
||||
isUploadLog : true
|
||||
isUploadLog : false
|
||||
]
|
||||
}
|
@ -196,7 +196,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
public void play(String url) {
|
||||
Log.e("purl121", url);
|
||||
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null || true) {
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -207,7 +207,6 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
//mPlayer.setCacheParams(1.0f, 5.0f);
|
||||
if(mPlayer.isPlaying()){
|
||||
mPlayer.stop();
|
||||
mPlayer.release();
|
||||
}
|
||||
purl = url;
|
||||
MediaItem item = MediaItem.fromUri(url);
|
||||
@ -240,7 +239,6 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stop();
|
||||
mPlayer.release();
|
||||
}
|
||||
stopPlay2();
|
||||
}
|
||||
|
@ -1051,7 +1051,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void clearChat(){
|
||||
if(mLiveChatAdapter!=null){
|
||||
mLiveChatAdapter.clear();
|
||||
}
|
||||
}
|
||||
public synchronized void showStart(StarChallengeStatusModel data) {
|
||||
boolean upData = false;
|
||||
if (mBannerList2 != null && mBannerList2.size() == 0) {
|
||||
|
@ -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;
|
||||
@ -220,7 +221,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
liveBack = mRootContainer.findViewById(R.id.live_back);
|
||||
mask = mRootContainer.findViewById(R.id.mask);
|
||||
}
|
||||
|
||||
private static boolean test=true;
|
||||
@Override
|
||||
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
|
||||
openParametersModel = new OpenParametersModel();
|
||||
@ -238,7 +239,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
.setParametersModel(openParametersModel
|
||||
.setmLiveType(mLiveType)
|
||||
.setmLiveTypeVal(mLiveTypeVal)));
|
||||
if (mLivePlayViewHolder == null) {
|
||||
if (mLivePlayViewHolder == null && test) {
|
||||
test=false;
|
||||
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0));
|
||||
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);
|
||||
@ -251,14 +253,16 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveAudienceViewHolder.addToParent();
|
||||
mLiveRoomViewHolder.addToParent();
|
||||
mLiveAudienceViewHolder.subscribeActivityLifeCycle();
|
||||
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this);
|
||||
}
|
||||
|
||||
if(true) {
|
||||
//直播间背景
|
||||
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());
|
||||
@ -273,6 +277,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
if (mLiveLinkMicPresenter != null) {
|
||||
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
||||
}
|
||||
}
|
||||
//心愿单
|
||||
LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() {
|
||||
@Override
|
||||
@ -299,9 +304,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
});
|
||||
enterRoom();
|
||||
if(true) {
|
||||
mLiveRoomViewHolder.initHourRankList();
|
||||
mLiveRoomViewHolder.showLiveRoomActivityBanner();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@ -316,43 +323,20 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
IMLoginManager.get(mContext).setisNewUserOne(false);
|
||||
//子线程执行退出操作
|
||||
exitLiveRoom();
|
||||
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();
|
||||
@ -367,6 +351,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)) {
|
||||
LiveFloatView.getInstance()
|
||||
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
|
||||
|
Loading…
Reference in New Issue
Block a user