diff --git a/config.gradle b/config.gradle index 65bb82468..0ce0c9db2 100644 --- a/config.gradle +++ b/config.gradle @@ -27,6 +27,6 @@ ext { // true表示谷歌支付 false isGooglePlay : true, //是否上报异常日志 - isUploadLog : true + isUploadLog : false ] } \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index f2230631f..c18162203 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -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(); } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index f667d1f5b..e841c0598 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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) { diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index b3c61b5a9..fccb40f99 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -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,27 +253,30 @@ 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()); + mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip()); + mLiveRoomViewHolder.setTitle(data.getTitle()); - //直播间背景 - 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.setAvatar(data.getAvatar()); - mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor()); - mLiveRoomViewHolder.setName(data.getUserNiceName()); - mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip()); - mLiveRoomViewHolder.setTitle(data.getTitle()); + mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); - mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); + mLiveRoomViewHolder.setLiveUid(data.getUid()); - mLiveRoomViewHolder.setLiveUid(data.getUid()); - - mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this); - if (mLiveLinkMicPresenter != null) { - mLiveLinkMicPresenter.setSocketClient(mSocketClient); + mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this); + if (mLiveLinkMicPresenter != null) { + mLiveLinkMicPresenter.setSocketClient(mSocketClient); + } } //心愿单 LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() { @@ -299,8 +304,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } }); enterRoom(); - mLiveRoomViewHolder.initHourRankList(); - mLiveRoomViewHolder.showLiveRoomActivityBanner(); + 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; } - 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)