diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 48fd10a09..b76de6904 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -683,10 +683,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } public void endLives() { - //断开socket - if (mSocketRyClient != null) { - mSocketRyClient.disConnect(); - } + RCRTCEngine.getInstance().getDefaultVideoStream().stopCamera(new IRCRTCResultCallback() { @Override @@ -762,10 +759,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketRyClient); - //断开socket - if (mSocketRyClient != null) { - mSocketRyClient.disConnect(); - } if (mLiveEndViewHolder == null) { mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot, mLiveBean.getUid()); @@ -786,8 +779,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } mLivePushViewHolder = null; mLiveLinkMicPresenter = null; - - release(); mStartLive = false; } else { @@ -848,6 +839,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveReadyViewHolder = null; mLivePushViewHolder = null; mLiveLinkMicPresenter = null; + //断开socket + if (mSocketRyClient != null) { + mSocketRyClient.disConnect(); + } super.release(); } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveFunctionAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveFunctionAdapter.java index 240b99a2a..2a5e6b757 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveFunctionAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveFunctionAdapter.java @@ -1,19 +1,20 @@ package com.yunbao.live.adapter; import android.content.Context; -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + import com.yunbao.common.Constants; +import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.live.R; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.bean.LiveFunctionBean; -import com.yunbao.common.interfaces.OnItemClickListener; import java.util.ArrayList; import java.util.List; @@ -35,23 +36,14 @@ public class LiveFunctionAdapter extends RecyclerView.Adapter(); mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_BEAUTY, R.mipmap.icon_live_func_beauty, R.string.live_beauty)); mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_CAMERA, R.mipmap.icon_live_func_camera, R.string.live_camera)); -// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_MIRROR, R.mipmap.icon_horizontally, R.string.live_camera_s)); - - // mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_FLASH, openFlash ? R.mipmap.icon_live_func_flash : R.mipmap.icon_live_func_flash_1, R.string.live_flash)); -// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_MUSIC, R.mipmap.icon_live_func_music, R.string.live_music)); -// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_SHARE, R.mipmap.icon_live_func_share, R.string.live_share)); - -// // TODO: 2019-11-15 -// if (hasGame) {//含有游戏 -// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_GAME, R.mipmap.icon_live_func_game, R.string.live_game)); -// } -// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_RED_PACK, R.mipmap.icon_live_func_rp, R.string.live_red_pack)); - mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_LINK_MIC, R.mipmap.icon_danrenpk, R.string.live_link_pk)); mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_DR, R.mipmap.icon_duorenpk, R.string.live_dr)); - mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_MIC, R.mipmap.icon_microphone, R.string.live_mic)); + if (!(context instanceof LiveRyAnchorActivity)) { + mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_MIC, R.mipmap.icon_microphone, R.string.live_mic)); + } - if(LiveRyAnchorActivity.mLivePushViewHolder!=null ) { + + if (LiveRyAnchorActivity.mLivePushViewHolder != null) { if (LiveRyAnchorActivity.leave == 0) { mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave, R.string.live_zslk)); } else { diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 9ab9ed94e..0b7e0ee58 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -1902,7 +1902,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { public void run() { // try { // Thread.sleep(4000); - if ( LiveAudienceActivity.getmLivePlayViewHolder() != null) { + if (mContext instanceof LiveAudienceActivity && LiveAudienceActivity.getmLivePlayViewHolder() != null) { LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview(); } // } catch (InterruptedException e) { diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index a433d55c2..c45b47fb3 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -62,7 +62,8 @@ public class SocketRyChatUtil { @Override public void onSuccess(Message message) { Log.i("tx", "发送成功"); - SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); + if (SocketRyClient.mSocketHandler != null) + SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); } @Override