修复一处闪退问题
新增统一连麦状态管理类 修复连麦过程中可以通过回到桌面-重进APP,从而可以进入其他直播间问题(方案:连麦中点击其他直播间先询问是否退出连麦)
This commit is contained in:
parent
a2ad006a7e
commit
86a0a19fec
@ -1,8 +1,7 @@
|
|||||||
package com.yunbao.live.activity;
|
package com.yunbao.live.activity;
|
||||||
|
|
||||||
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
@ -93,6 +92,7 @@ import com.yunbao.live.http.ImHttpUtil;
|
|||||||
import com.yunbao.live.http.LiveHttpConsts;
|
import com.yunbao.live.http.LiveHttpConsts;
|
||||||
import com.yunbao.live.http.LiveHttpUtil;
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||||
|
import com.yunbao.live.utils.MicStatusManager;
|
||||||
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
||||||
import com.yunbao.live.views.PortraitLiveManager;
|
import com.yunbao.live.views.PortraitLiveManager;
|
||||||
|
|
||||||
@ -222,11 +222,11 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
|
||||||
if (Micing == 1) {
|
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
|
||||||
|
|
||||||
manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal);
|
manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal);
|
||||||
verticalViewPager.setEnableScroll(false);
|
verticalViewPager.setEnableScroll(false);
|
||||||
} else if (Micing == 2) {
|
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
|
||||||
verticalViewPager.setEnableScroll(false);
|
verticalViewPager.setEnableScroll(false);
|
||||||
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
|
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
|
||||||
|
|
||||||
@ -490,9 +490,9 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
try {
|
try {
|
||||||
manager.onBackPressed();
|
manager.onBackPressed();
|
||||||
if (Micing == 1) {
|
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
|
||||||
manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal);
|
manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal);
|
||||||
} else if (Micing == 2) {
|
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
|
||||||
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
|
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
|
||||||
} else {
|
} else {
|
||||||
manager.onRemove(true);
|
manager.onRemove(true);
|
||||||
@ -1165,6 +1165,17 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
|
|
||||||
public static void forward(Context context, LiveBean liveBean, int liveType,
|
public static void forward(Context context, LiveBean liveBean, int liveType,
|
||||||
int liveTypeVal, String key, Map<String, String> map, int position, int liveSdk) {
|
int liveTypeVal, String key, Map<String, String> map, int position, int liveSdk) {
|
||||||
|
if (MicStatusManager.getInstance().getMicStatus() != MicStatusManager.MIC_TYPE_DEFAULT &&
|
||||||
|
!MicStatusManager.getInstance().getMicLiveId().equals(liveBean.getUid())) {
|
||||||
|
Log.i("连麦",MicStatusManager.getInstance().toString()+" | "+liveBean.getUid());
|
||||||
|
DialogUitl.showSimpleDialog(context, "當前正在連麥中,是否退出連麥", new DialogUitl.SimpleCallback() {
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
|
MicStatusManager.getInstance().downMic();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
Intent intent = new Intent(context, LiveAudienceActivity.class);
|
Intent intent = new Intent(context, LiveAudienceActivity.class);
|
||||||
intent.putExtra(Constants.LIVE_BEAN, liveBean);
|
intent.putExtra(Constants.LIVE_BEAN, liveBean);
|
||||||
intent.putExtra(Constants.LIVE_TYPE, liveType);
|
intent.putExtra(Constants.LIVE_TYPE, liveType);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.yunbao.live.dialog;
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
|
|
||||||
|
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
@ -37,6 +35,7 @@ import com.yunbao.live.bean.LiveUserGiftBean;
|
|||||||
import com.yunbao.live.bean.MicUserBean;
|
import com.yunbao.live.bean.MicUserBean;
|
||||||
import com.yunbao.live.http.LiveHttpUtil;
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||||
|
import com.yunbao.live.utils.MicStatusManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -238,7 +237,7 @@ public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements Vi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MicUserBean> processData(String[] info) {
|
public List<MicUserBean> processData(String[] info) {
|
||||||
Log.e("tag222", Tips + "ssss" + Micing);
|
Log.e("tag222", Tips + "ssss" + MicStatusManager.getInstance().toString());
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
List<MicUserBean> data = new ArrayList<>();
|
List<MicUserBean> data = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.yunbao.live.dialog;
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
|
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@ -38,13 +36,13 @@ import com.yunbao.live.bean.MicUserBean;
|
|||||||
import com.yunbao.live.http.LiveHttpUtil;
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
import com.yunbao.live.socket.SocketSendBean;
|
import com.yunbao.live.socket.SocketSendBean;
|
||||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||||
|
import com.yunbao.live.utils.MicStatusManager;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.rong.imkit.IMCenter;
|
|
||||||
import io.rong.imlib.IRongCallback;
|
import io.rong.imlib.IRongCallback;
|
||||||
import io.rong.imlib.RongIMClient;
|
import io.rong.imlib.RongIMClient;
|
||||||
import io.rong.imlib.model.Conversation;
|
import io.rong.imlib.model.Conversation;
|
||||||
@ -149,20 +147,20 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
|
|||||||
mRefreshView = mRootView.findViewById(R.id.refreshView);
|
mRefreshView = mRootView.findViewById(R.id.refreshView);
|
||||||
view_no = mRootView.findViewById(R.id.view_no);
|
view_no = mRootView.findViewById(R.id.view_no);
|
||||||
apply_btn = mRootView.findViewById(R.id.apply_btn);
|
apply_btn = mRootView.findViewById(R.id.apply_btn);
|
||||||
if (Micing == 0) {
|
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_DEFAULT) {
|
||||||
apply_btn.setBackgroundResource(R.drawable.background_0fdab8);
|
apply_btn.setBackgroundResource(R.drawable.background_0fdab8);
|
||||||
apply_btn.setText(R.string.apply_for_lianmai);
|
apply_btn.setText(R.string.apply_for_lianmai);
|
||||||
} else if (Micing == 1) {
|
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
|
||||||
apply_btn.setBackgroundResource(R.drawable.background_00a0e9);
|
apply_btn.setBackgroundResource(R.drawable.background_00a0e9);
|
||||||
apply_btn.setText(R.string.cancel_application);
|
apply_btn.setText(R.string.cancel_application);
|
||||||
} else if (Micing == 2) {
|
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
|
||||||
apply_btn.setBackgroundResource(R.drawable.background_eb6877);
|
apply_btn.setBackgroundResource(R.drawable.background_eb6877);
|
||||||
apply_btn.setText(R.string.quit_mic);
|
apply_btn.setText(R.string.quit_mic);
|
||||||
}
|
}
|
||||||
apply_btn.setOnClickListener(new View.OnClickListener() {
|
apply_btn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (Micing == 0) {
|
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_DEFAULT) {
|
||||||
LiveAudienceActivity.mProcessResultUtil.requestPermissions(new String[]{
|
LiveAudienceActivity.mProcessResultUtil.requestPermissions(new String[]{
|
||||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||||
@ -207,7 +205,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
|
|||||||
ToastUtil.show("");
|
ToastUtil.show("");
|
||||||
apply_btn.setBackgroundResource(R.drawable.background_00a0e9);
|
apply_btn.setBackgroundResource(R.drawable.background_00a0e9);
|
||||||
apply_btn.setText(R.string.cancel_application);
|
apply_btn.setText(R.string.cancel_application);
|
||||||
Micing = 1;
|
MicStatusManager.getInstance().setMicData(MicStatusManager.MIC_TYPE_REQUEST,mLiveUid);
|
||||||
dismiss();
|
dismiss();
|
||||||
io.rong.imlib.model.Message ids[] = {message};
|
io.rong.imlib.model.Message ids[] = {message};
|
||||||
RongIMClient.getInstance().deleteRemoteMessages(conversationType,message.getTargetId(),ids, null);
|
RongIMClient.getInstance().deleteRemoteMessages(conversationType,message.getTargetId(),ids, null);
|
||||||
@ -227,7 +225,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (Micing == 1) {
|
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
|
||||||
//取消申請
|
//取消申請
|
||||||
dismiss();
|
dismiss();
|
||||||
//用户申请联麦
|
//用户申请联麦
|
||||||
@ -253,7 +251,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||||
Log.e("ry", "发送成功");
|
Log.e("ry", "发送成功");
|
||||||
Micing = 0;
|
MicStatusManager.getInstance().clear();
|
||||||
dismiss();
|
dismiss();
|
||||||
io.rong.imlib.model.Message ids[] = {message};
|
io.rong.imlib.model.Message ids[] = {message};
|
||||||
RongIMClient.getInstance().deleteRemoteMessages(conversationType,message.getTargetId(),ids, null);
|
RongIMClient.getInstance().deleteRemoteMessages(conversationType,message.getTargetId(),ids, null);
|
||||||
@ -268,7 +266,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (Micing == 2) {
|
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
|
||||||
//退出连麦
|
//退出连麦
|
||||||
DialogUitl.showSimpleDialog(mContext, "連麥中,退出將斷開語音連麥!", new DialogUitl.SimpleCallback() {
|
DialogUitl.showSimpleDialog(mContext, "連麥中,退出將斷開語音連麥!", new DialogUitl.SimpleCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -319,11 +317,11 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MicUserBean> processData(String[] info) {
|
public List<MicUserBean> processData(String[] info) {
|
||||||
Log.e("tag222", Tips + "ssss" + Micing);
|
Log.e("tag222", Tips + "ssss" + MicStatusManager.getInstance().toString());
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
List<MicUserBean> data = new ArrayList<>();
|
List<MicUserBean> data = new ArrayList<>();
|
||||||
if (Tips.equals("2")) {
|
if (Tips.equals("2")) {
|
||||||
if (Micing == 1) {
|
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
|
||||||
MicUserBean micuser = new MicUserBean();
|
MicUserBean micuser = new MicUserBean();
|
||||||
micuser.setAvatar(CommonAppConfig.getInstance().getUserBean().getAvatar());
|
micuser.setAvatar(CommonAppConfig.getInstance().getUserBean().getAvatar());
|
||||||
micuser.setUserNiceName(CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
micuser.setUserNiceName(CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||||
@ -335,7 +333,9 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data = JSON.parseArray(obj.getString("userlist"), MicUserBean.class);
|
data = JSON.parseArray(obj.getString("userlist"), MicUserBean.class);
|
||||||
data.remove(0);
|
if(data.size()!=0) {
|
||||||
|
data.remove(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (data.size() > 0 && pg == 1) {
|
if (data.size() > 0 && pg == 1) {
|
||||||
nums = 0;
|
nums = 0;
|
||||||
|
@ -20,6 +20,7 @@ import com.yunbao.live.event.LiveAudienceEvent;
|
|||||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||||
import com.yunbao.live.http.LiveHttpUtil;
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||||
|
import com.yunbao.live.utils.MicStatusManager;
|
||||||
import com.yunbao.live.views.LivePlayRyViewHolder;
|
import com.yunbao.live.views.LivePlayRyViewHolder;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@ -87,12 +88,12 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
|||||||
if (liveBean1 == null) {
|
if (liveBean1 == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (LivePlayRyViewHolder.Micing == 1) {
|
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
||||||
.setMicIng(1)
|
.setMicIng(1)
|
||||||
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal));
|
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal));
|
||||||
} else if (LivePlayRyViewHolder.Micing == 2) {
|
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
||||||
.setMicIng(2)
|
.setMicIng(2)
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.yunbao.live.utils;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.yunbao.common.CommonAppConfig;
|
||||||
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.http.HttpClient;
|
||||||
|
import com.yunbao.live.activity.LiveActivity;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一管理连麦状态
|
||||||
|
*/
|
||||||
|
public class MicStatusManager {
|
||||||
|
public static final int MIC_TYPE_DEFAULT = 0;//默认状态,未连麦
|
||||||
|
public static final int MIC_TYPE_REQUEST = 1;//请求连麦中
|
||||||
|
public static final int MIC_TYPE_OPEN = 2;//连麦中
|
||||||
|
private static MicStatusManager manager;
|
||||||
|
private int micStatus;//连麦状态
|
||||||
|
private String micLiveId;//主播uid
|
||||||
|
|
||||||
|
public static MicStatusManager getInstance() {
|
||||||
|
if (manager == null) {
|
||||||
|
manager = new MicStatusManager();
|
||||||
|
}
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MicStatusManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMicData(int micStatus, String micLiveId) {
|
||||||
|
this.micLiveId = micLiveId;
|
||||||
|
this.micStatus = micStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
micStatus = 0;
|
||||||
|
micLiveId = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMicStatus() {
|
||||||
|
return micStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMicLiveId() {
|
||||||
|
return micLiveId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "MicStatusManager{" +
|
||||||
|
"micStatus=" + micStatus +
|
||||||
|
", micLiveId='" + micLiveId + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 断开连麦
|
||||||
|
*/
|
||||||
|
public void downMic() {
|
||||||
|
HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
|
||||||
|
.params("roomid", micLiveId)
|
||||||
|
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||||
|
.execute(new HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
Log.e("ry", code + "退出多人");
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
EventBus.getDefault().post("endMic");
|
||||||
|
}
|
||||||
|
}
|
@ -37,6 +37,7 @@ import com.yunbao.common.utils.ToastUtil;
|
|||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.activity.LiveActivity;
|
import com.yunbao.live.activity.LiveActivity;
|
||||||
|
import com.yunbao.live.utils.MicStatusManager;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@ -101,7 +102,6 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
|
|
||||||
|
|
||||||
//0未申请1申请中2连麦中
|
//0未申请1申请中2连麦中
|
||||||
public static int Micing = 0;
|
|
||||||
RCRTCRoom rcrtcRoom;
|
RCRTCRoom rcrtcRoom;
|
||||||
String purl;
|
String purl;
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLiveBeanLandscape(int landscape) {
|
public void setLiveBeanLandscape(int landscape) {
|
||||||
LivePlayRyViewHolder.landscape =landscape;
|
LivePlayRyViewHolder.landscape = landscape;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -579,7 +579,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
ry_view.removeAllViews();
|
ry_view.removeAllViews();
|
||||||
onPrepared();
|
onPrepared();
|
||||||
rcrtcRoom = null;
|
rcrtcRoom = null;
|
||||||
Micing = 0;
|
MicStatusManager.getInstance().clear();
|
||||||
ToastUtil.show("已成功退出語音連麥");
|
ToastUtil.show("已成功退出語音連麥");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -818,7 +818,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
Log.e("ry", "订阅资源成功");
|
Log.e("ry", "订阅资源成功");
|
||||||
Micing = 2;
|
MicStatusManager.getInstance().setMicData(MicStatusManager.MIC_TYPE_OPEN,LiveActivity.mLiveUid);
|
||||||
AudioManager audioManager = (AudioManager) contexts.getSystemService(Context.AUDIO_SERVICE);
|
AudioManager audioManager = (AudioManager) contexts.getSystemService(Context.AUDIO_SERVICE);
|
||||||
RCRTCEngine.getInstance().enableSpeaker(true);
|
RCRTCEngine.getInstance().enableSpeaker(true);
|
||||||
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||||
|
@ -133,6 +133,7 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
|
|||||||
import com.yunbao.live.presenter.LiveGiftAnimPresenter;
|
import com.yunbao.live.presenter.LiveGiftAnimPresenter;
|
||||||
import com.yunbao.live.presenter.LiveLightAnimPresenter;
|
import com.yunbao.live.presenter.LiveLightAnimPresenter;
|
||||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||||
|
import com.yunbao.live.utils.MicStatusManager;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@ -3489,12 +3490,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
if (liveBean1 == null) {
|
if (liveBean1 == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (LivePlayRyViewHolder.Micing == 1) {
|
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
||||||
.setMicIng(1)
|
.setMicIng(1)
|
||||||
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal));
|
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal));
|
||||||
} else if (LivePlayRyViewHolder.Micing == 2) {
|
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
||||||
.setMicIng(2)
|
.setMicIng(2)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.yunbao.live.views;
|
package com.yunbao.live.views;
|
||||||
|
|
||||||
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
|
|
||||||
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
|
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -87,6 +86,7 @@ import com.yunbao.live.socket.SocketRyChatUtil;
|
|||||||
import com.yunbao.live.socket.SocketRyClient;
|
import com.yunbao.live.socket.SocketRyClient;
|
||||||
import com.yunbao.live.socket.SocketSendBean;
|
import com.yunbao.live.socket.SocketSendBean;
|
||||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||||
|
import com.yunbao.live.utils.MicStatusManager;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
DialogUitl.showSimpleDialog(mContext, null, "您已申請,退出將取消語音連麥申請!", false, new DialogUitl.SimpleCallback3() {
|
DialogUitl.showSimpleDialog(mContext, null, "您已申請,退出將取消語音連麥申請!", false, new DialogUitl.SimpleCallback3() {
|
||||||
@Override
|
@Override
|
||||||
public void onConfirmClick(Dialog dialog) {
|
public void onConfirmClick(Dialog dialog) {
|
||||||
Micing = 0;
|
MicStatusManager.getInstance().clear();
|
||||||
//用户申请联麦
|
//用户申请联麦
|
||||||
final SocketSendBean msg = new SocketSendBean()
|
final SocketSendBean msg = new SocketSendBean()
|
||||||
.param("_method_", Constants.LIAN_MAI)
|
.param("_method_", Constants.LIAN_MAI)
|
||||||
@ -590,7 +590,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
Log.e("ry", "退出多人房间成功");
|
Log.e("ry", "退出多人房间成功");
|
||||||
|
|
||||||
if (isBackPressed) {
|
if (isBackPressed) {
|
||||||
Micing = 0;
|
MicStatusManager.getInstance().clear();
|
||||||
((LiveAudienceActivity) mContext).closeRoom();
|
((LiveAudienceActivity) mContext).closeRoom();
|
||||||
} else {
|
} else {
|
||||||
EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
|
EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
|
||||||
|
Loading…
Reference in New Issue
Block a user