add[声望升级-小游戏多人连麦]
This commit is contained in:
parent
95ded2f77c
commit
abfd15f751
@ -279,7 +279,7 @@ public class CreateSudGamePopup extends BottomPopupView {
|
|||||||
public void onSuccess(CreateSudRoomModel data) {
|
public void onSuccess(CreateSudRoomModel data) {
|
||||||
if (isHome) {
|
if (isHome) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
RouteUtil.forwardSudGameActivity(new Gson().toJson(data));
|
RouteUtil.forwardSudGameActivity(new Gson().toJson(data),true,isHome);
|
||||||
} else {
|
} else {
|
||||||
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data));
|
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data));
|
||||||
|
|
||||||
|
@ -43,6 +43,9 @@ public class GameMicManager {
|
|||||||
private RCRTCRoom mRtcRoom = null;
|
private RCRTCRoom mRtcRoom = null;
|
||||||
private String mRoomID = "";
|
private String mRoomID = "";
|
||||||
|
|
||||||
|
public void setmRoomID(String mRoomID) {
|
||||||
|
this.mRoomID = mRoomID;
|
||||||
|
}
|
||||||
|
|
||||||
private final IRCRTCRoomEventsListener roomEventsListener = new IRCRTCRoomEventsListener() {
|
private final IRCRTCRoomEventsListener roomEventsListener = new IRCRTCRoomEventsListener() {
|
||||||
/**
|
/**
|
||||||
@ -183,7 +186,7 @@ public class GameMicManager {
|
|||||||
public void refreshStreams(List<SudGameUserModel> personList) {
|
public void refreshStreams(List<SudGameUserModel> personList) {
|
||||||
|
|
||||||
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
|
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
|
||||||
|
if(mRtcRoom!=null){
|
||||||
for (SudGameUserModel sudGameUserModel : personList) {
|
for (SudGameUserModel sudGameUserModel : personList) {
|
||||||
List<RCRTCRemoteUser> rcrtcRemoteUsers = mRtcRoom.getRemoteUsers();
|
List<RCRTCRemoteUser> rcrtcRemoteUsers = mRtcRoom.getRemoteUsers();
|
||||||
|
|
||||||
@ -221,6 +224,7 @@ public class GameMicManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void refreshStreams(String userID, boolean mute, int position) {
|
public void refreshStreams(String userID, boolean mute, int position) {
|
||||||
|
|
||||||
@ -242,8 +246,6 @@ public class GameMicManager {
|
|||||||
mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() {
|
mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getView().onSubscribeSuccess(userID, mute, position);
|
getView().onSubscribeSuccess(userID, mute, position);
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
|
@ -49,6 +49,7 @@ public class RouteUtil {
|
|||||||
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
|
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
|
||||||
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
|
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
|
||||||
public static final String PATH_SudGameActivity="/live/SudGameActivity";
|
public static final String PATH_SudGameActivity="/live/SudGameActivity";
|
||||||
|
|
||||||
public static final String PATH_COMMUNITY_Activity="/main/MainHomeCommunityActivity";
|
public static final String PATH_COMMUNITY_Activity="/main/MainHomeCommunityActivity";
|
||||||
|
|
||||||
|
|
||||||
@ -61,9 +62,11 @@ public class RouteUtil {
|
|||||||
.withString(Constants.TO_UID, uid)
|
.withString(Constants.TO_UID, uid)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
public static void forwardSudGameActivity(String CreateSudRoom) {
|
public static void forwardSudGameActivity(String CreateSudRoom,boolean isAn,boolean isHome) {
|
||||||
ARouter.getInstance().build(PATH_SudGameActivity)
|
ARouter.getInstance().build(PATH_SudGameActivity)
|
||||||
.withString("CreateSudRoom", CreateSudRoom)
|
.withString("CreateSudRoom", CreateSudRoom)
|
||||||
|
.withBoolean("CreateIsAn", isAn)
|
||||||
|
.withBoolean("CreateIsHome", isHome)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
|||||||
createSudRoomModel.setSudGameName(model.getSudGameName());
|
createSudRoomModel.setSudGameName(model.getSudGameName());
|
||||||
if (isHome) {
|
if (isHome) {
|
||||||
if (TextUtils.equals(model.getLiveUid(), "0")) {
|
if (TextUtils.equals(model.getLiveUid(), "0")) {
|
||||||
RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel));
|
RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel),false,isHome);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String yes = "是";
|
String yes = "是";
|
||||||
@ -156,7 +156,7 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
|||||||
@Override
|
@Override
|
||||||
public void onCancel() {
|
public void onCancel() {
|
||||||
|
|
||||||
RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel));
|
RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel),false,isHome);
|
||||||
}
|
}
|
||||||
})).show();
|
})).show();
|
||||||
|
|
||||||
|
@ -53,6 +53,20 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IRtcEngineEventHandler mEventHandler = new IRtcEngineEventHandler() {
|
||||||
|
@Override
|
||||||
|
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||||
|
super.onJoinChannelSuccess(channel, uid, elapsed);
|
||||||
|
L.eSw("加入房间成功 channel"+channel+" uid"+uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserJoined(int uid, int elapsed) {
|
||||||
|
super.onUserJoined(uid, elapsed);
|
||||||
|
L.eSw("用户加入房间成功"+uid);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化声网SDK
|
* 初始化声网SDK
|
||||||
*/
|
*/
|
||||||
@ -76,8 +90,49 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
//mRtcEngine.startPreview();
|
//mRtcEngine.startPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化声网SDK-语音房
|
||||||
|
*/
|
||||||
|
public void initRtcEngineAudio(Activity mContext) {
|
||||||
|
this.mContext = mContext;
|
||||||
|
try {
|
||||||
|
// 创建 RtcEngineConfig 对象,并进行配置
|
||||||
|
RtcEngineConfig config = new RtcEngineConfig();
|
||||||
|
config.mContext = mContext;
|
||||||
|
config.mAppId = SWAuManager.shengwang_appId;
|
||||||
|
config.mEventHandler = mEventHandler;
|
||||||
|
// 创建并初始化 RtcEngine
|
||||||
|
mRtcEngine = (RtcEngineEx) RtcEngineEx.create(config);
|
||||||
|
mRtcEngine.enableAudio();
|
||||||
|
mRtcEngine.enableLocalAudio(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Check the error.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建语音房
|
||||||
|
* @param token
|
||||||
|
* @param channelName
|
||||||
|
* @param uid
|
||||||
|
*/
|
||||||
|
public void joinAudioRoom(String channelName,String token,int uid){
|
||||||
|
L.eSw("加入房间"+channelName+" uid"+uid);
|
||||||
|
// 创建 ChannelMediaOptions 对象,并进行配置
|
||||||
|
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||||
|
// 根据场景将用户角色设置为 AUDIENCE (观众)
|
||||||
|
options.clientRoleType = Constants.CLIENT_ROLE_AUDIENCE;
|
||||||
|
// 直播场景下,设置频道场景为 BROADCASTING (直播场景)
|
||||||
|
options.audienceLatencyLevel = Constants.CHANNEL_PROFILE_LIVE_BROADCASTING; // 觀眾走極速直播
|
||||||
|
options.autoSubscribeVideo = false;
|
||||||
|
options.autoSubscribeAudio = true;
|
||||||
|
mRtcEngine.joinChannel(token, channelName, uid, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新主播视图
|
* 更新主播视图
|
||||||
|
*
|
||||||
* @param frameLayout
|
* @param frameLayout
|
||||||
*/
|
*/
|
||||||
public void updateMyChannelView(FrameLayout frameLayout, int uid) {
|
public void updateMyChannelView(FrameLayout frameLayout, int uid) {
|
||||||
@ -114,7 +169,6 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
mRtcEngine.joinChannel(token, channelName, uid, options);
|
mRtcEngine.joinChannel(token, channelName, uid, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void joinExRoomEx(int strUid, String token, String channelName) {
|
public void joinExRoomEx(int strUid, String token, String channelName) {
|
||||||
// 创建 ChannelMediaOptions 对象,并进行配置
|
// 创建 ChannelMediaOptions 对象,并进行配置
|
||||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||||
@ -156,6 +210,7 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 与主播连麦
|
* 与主播连麦
|
||||||
|
*
|
||||||
* @param isUp true 上麦 false 下麦
|
* @param isUp true 上麦 false 下麦
|
||||||
*/
|
*/
|
||||||
public void setMicAn(boolean isUp) {
|
public void setMicAn(boolean isUp) {
|
||||||
@ -174,8 +229,13 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
mRtcEngine.updateChannelMediaOptions(options);
|
mRtcEngine.updateChannelMediaOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMicAudio(int toUid,boolean isEn) {
|
||||||
|
L.eSw("setMicAudio:toUid" +toUid+"isEn "+ isEn);
|
||||||
|
mRtcEngine.muteRemoteAudioStream(toUid,isEn);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* PK-加入对方主播直播间
|
* PK-加入对方主播直播间
|
||||||
|
*
|
||||||
* @param strUid
|
* @param strUid
|
||||||
* @param token
|
* @param token
|
||||||
* @param toUid
|
* @param toUid
|
||||||
@ -234,6 +294,7 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出对方直播间
|
* 退出对方直播间
|
||||||
|
*
|
||||||
* @param uid 自己的ID
|
* @param uid 自己的ID
|
||||||
* @param liveUid 对方直播间号
|
* @param liveUid 对方直播间号
|
||||||
*/
|
*/
|
||||||
|
@ -126,6 +126,7 @@ import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
|||||||
import com.yunbao.live.dialog.SignDialogFragment;
|
import com.yunbao.live.dialog.SignDialogFragment;
|
||||||
import com.yunbao.live.event.LinkMicTxAccEvent;
|
import com.yunbao.live.event.LinkMicTxAccEvent;
|
||||||
import com.yunbao.live.event.LiveAudienceEvent;
|
import com.yunbao.live.event.LiveAudienceEvent;
|
||||||
|
import com.yunbao.live.event.LiveOpenSuccessEvent;
|
||||||
import com.yunbao.live.http.ImHttpUtil;
|
import com.yunbao.live.http.ImHttpUtil;
|
||||||
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
||||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||||
@ -746,6 +747,14 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
manager.onLinkMicTxAccEvent(e);
|
manager.onLinkMicTxAccEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯sdk连麦时候切换低延时流
|
||||||
|
*/
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onLinkMicTxAccEvent(LiveOpenSuccessEvent e) {
|
||||||
|
manager.loadTimeoutRunnableGone();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 腾讯sdk时候主播连麦回调
|
* 腾讯sdk时候主播连麦回调
|
||||||
*
|
*
|
||||||
@ -1072,6 +1081,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
if (manager != null && manager.getsudGameMin()) {
|
if (manager != null && manager.getsudGameMin()) {
|
||||||
ToastUtil.show(WordUtil.isNewZh() ? "您已在游戏房间中" : "You are already in the game room");
|
ToastUtil.show(WordUtil.isNewZh() ? "您已在游戏房间中" : "You are already in the game room");
|
||||||
} else {
|
} else {
|
||||||
|
//直播间来的
|
||||||
new XPopup.Builder(mContext)
|
new XPopup.Builder(mContext)
|
||||||
.enableDrag(false)
|
.enableDrag(false)
|
||||||
// .dismissOnTouchOutside(false)
|
// .dismissOnTouchOutside(false)
|
||||||
@ -1874,6 +1884,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
if (manager != null && manager.getsudGameMin()) {
|
if (manager != null && manager.getsudGameMin()) {
|
||||||
ToastUtil.show(WordUtil.isNewZh() ? "您已在游戏房间中" : "You are already in the game room");
|
ToastUtil.show(WordUtil.isNewZh() ? "您已在游戏房间中" : "You are already in the game room");
|
||||||
} else {
|
} else {
|
||||||
|
//直播间来的
|
||||||
new XPopup.Builder(mContext)
|
new XPopup.Builder(mContext)
|
||||||
.enableDrag(false)
|
.enableDrag(false)
|
||||||
// .dismissOnTouchOutside(false)
|
// .dismissOnTouchOutside(false)
|
||||||
|
@ -5,6 +5,7 @@ import android.app.Activity;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@ -17,6 +18,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
@ -65,6 +67,10 @@ import cn.rongcloud.rtc.api.RCRTCRemoteUser;
|
|||||||
import cn.rongcloud.rtc.api.RCRTCRoom;
|
import cn.rongcloud.rtc.api.RCRTCRoom;
|
||||||
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
|
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
|
||||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||||
|
import io.agora.beautyapi.faceunity.agora.SWAuManager;
|
||||||
|
import io.rong.imlib.IRongCoreCallback;
|
||||||
|
import io.rong.imlib.IRongCoreEnum;
|
||||||
|
import io.rong.imlib.chatroom.base.RongChatRoomClient;
|
||||||
|
|
||||||
@Route(path = RouteUtil.PATH_SudGameActivity)
|
@Route(path = RouteUtil.PATH_SudGameActivity)
|
||||||
public class SudGameActivity extends AbsActivity implements GameMicManager.MeetingCallback {
|
public class SudGameActivity extends AbsActivity implements GameMicManager.MeetingCallback {
|
||||||
@ -85,6 +91,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
private ProcessResultUtil mProcessResultUtil;
|
private ProcessResultUtil mProcessResultUtil;
|
||||||
private List<String> muteUser = new ArrayList<>();
|
private List<String> muteUser = new ArrayList<>();
|
||||||
private boolean imOff;
|
private boolean imOff;
|
||||||
|
private boolean isSw = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -103,8 +110,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
|
|
||||||
private void initDate() {
|
private void initDate() {
|
||||||
|
|
||||||
LiveNetManager.get(mContext)
|
LiveNetManager.get(mContext).getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
|
||||||
.getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<CustomSidebarInfoModel> data) {
|
public void onSuccess(List<CustomSidebarInfoModel> data) {
|
||||||
for (CustomSidebarInfoModel datum : data) {
|
for (CustomSidebarInfoModel datum : data) {
|
||||||
@ -122,19 +128,19 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 设置禁用麦克风采集
|
// 设置禁用麦克风采集
|
||||||
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
|
//RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
|
||||||
ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
|
ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
|
||||||
gameCloseWheat.setVisibility(View.INVISIBLE);
|
gameCloseWheat.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
|
|
||||||
mProcessResultUtil = new ProcessResultUtil(this);
|
mProcessResultUtil = new ProcessResultUtil(this);
|
||||||
LiveNetManager.get(mContext)
|
LiveNetManager.get(mContext).getRoomMicStatus(new HttpCallback<RoomMicStatusModel>() {
|
||||||
.getRoomMicStatus(new HttpCallback<RoomMicStatusModel>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(RoomMicStatusModel data) {
|
public void onSuccess(RoomMicStatusModel data) {
|
||||||
gameMicManager = new GameMicManager();
|
gameMicManager = new GameMicManager();
|
||||||
gameMicManager.attachView(SudGameActivity.this);
|
gameMicManager.attachView(SudGameActivity.this);
|
||||||
gameMicManager.config(SudGameActivity.this);
|
gameMicManager.config(SudGameActivity.this);
|
||||||
|
//初始化声网引擎
|
||||||
|
SWAuManager.get().initRtcEngineAudio(mContext);
|
||||||
//语音
|
//语音
|
||||||
if (TextUtils.equals(data.getMicStatus(), "1")) {
|
if (TextUtils.equals(data.getMicStatus(), "1")) {
|
||||||
imOff = true;
|
imOff = true;
|
||||||
@ -166,8 +172,15 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
findViewById(R.id.game_review_input).setVisibility(View.GONE);
|
findViewById(R.id.game_review_input).setVisibility(View.GONE);
|
||||||
chatList.setVisibility(View.GONE);
|
chatList.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
gameMicManager.setmRoomID(mLiveUid);
|
||||||
|
if (isSw) {
|
||||||
|
SWAuManager.get().joinAudioRoom("v" + mLiveUid, CommonAppConfig.SWToken, Integer.parseInt(CommonAppConfig.getInstance().getUid()));
|
||||||
|
onJoinRoomSuccess(null);
|
||||||
|
onJoinSuccess();
|
||||||
|
} else {
|
||||||
gameMicManager.joinRoom(mLiveUid, imOff);
|
gameMicManager.joinRoom(mLiveUid, imOff);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
@ -181,15 +194,34 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
userList.setVisibility(View.GONE);
|
userList.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void onJoinSuccess() {
|
||||||
|
RongChatRoomClient.getInstance().joinChatRoom("v" + mLiveUid, -1, new IRongCoreCallback.OperationCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
Log.i("tx", "加入成功");
|
||||||
|
gameMicManager.enterRoom();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
|
||||||
|
Log.i("tx", "加入" + "失败" + coreErrorCode);
|
||||||
|
if (WordUtil.isNewZh()) {
|
||||||
|
ToastUtil.show("網絡不佳無法連接,請重新進入");
|
||||||
|
} else {
|
||||||
|
ToastUtil.show("The network is not connected, please re-enter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
|
||||||
LiveNetManager.get(mContext)
|
LiveNetManager.get(mContext).leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
||||||
.leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(HttpCallbackModel data) {
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
|
|
||||||
@ -200,11 +232,14 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if(isSw){
|
||||||
|
SWAuManager.get().exitChannelAll();
|
||||||
|
}
|
||||||
if (gameMicManager != null) {
|
if (gameMicManager != null) {
|
||||||
gameMicManager.leaveRoom();
|
gameMicManager.leaveRoom();
|
||||||
gameMicManager.detachView();
|
gameMicManager.detachView();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bus.getOff(this);
|
Bus.getOff(this);
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@ -225,8 +260,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
chatList = findViewById(R.id.chat_list);
|
chatList = findViewById(R.id.chat_list);
|
||||||
userList = findViewById(R.id.user_list);
|
userList = findViewById(R.id.user_list);
|
||||||
//聊天栏
|
//聊天栏
|
||||||
FrameLayout.LayoutParams params1 = (FrameLayout.LayoutParams)
|
FrameLayout.LayoutParams params1 = (FrameLayout.LayoutParams) chatList.getLayoutParams();
|
||||||
chatList.getLayoutParams();
|
|
||||||
params1.topMargin = DpUtil.dp2px(65);
|
params1.topMargin = DpUtil.dp2px(65);
|
||||||
chatList.setLayoutParams(params1);
|
chatList.setLayoutParams(params1);
|
||||||
|
|
||||||
@ -245,7 +279,13 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
@Override
|
@Override
|
||||||
public void unMute(String userID, int position) {
|
public void unMute(String userID, int position) {
|
||||||
if (!TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), userID)) {
|
if (!TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), userID)) {
|
||||||
|
if (isSw) {
|
||||||
|
//靜音
|
||||||
|
SWAuManager.get().setMicAudio(Integer.parseInt(userID), false);
|
||||||
|
onSubscribeSuccess(userID, false, position);
|
||||||
|
} else {
|
||||||
gameMicManager.refreshStreams(userID, false, position);
|
gameMicManager.refreshStreams(userID, false, position);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.show(WordUtil.isNewZh() ? "無法對本人靜音" : "Unable to mute myself");
|
ToastUtil.show(WordUtil.isNewZh() ? "無法對本人靜音" : "Unable to mute myself");
|
||||||
}
|
}
|
||||||
@ -256,11 +296,16 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
public void mute(String userID, int position) {
|
public void mute(String userID, int position) {
|
||||||
muteUser.add(userID);
|
muteUser.add(userID);
|
||||||
if (!TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), userID)) {
|
if (!TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), userID)) {
|
||||||
|
if (isSw) {
|
||||||
|
//开启声音
|
||||||
|
SWAuManager.get().setMicAudio(Integer.parseInt(userID), true);
|
||||||
|
onSubscribeSuccess(userID, true, position);
|
||||||
|
} else {
|
||||||
gameMicManager.refreshStreams(userID, true, position);
|
gameMicManager.refreshStreams(userID, true, position);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.show(WordUtil.isNewZh() ? "無法對本人靜音" : "Unable to mute myself");
|
ToastUtil.show(WordUtil.isNewZh() ? "無法對本人靜音" : "Unable to mute myself");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -292,9 +337,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
|
|
||||||
new XPopup.Builder(mContext)
|
new XPopup.Builder(mContext).enableDrag(false).asCustom(new LiveSudGameHistoryPopup(mContext, customSidebarChildModels)).show();
|
||||||
.enableDrag(false)
|
|
||||||
.asCustom(new LiveSudGameHistoryPopup(mContext, customSidebarChildModels)).show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -306,16 +349,27 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
if (publishDefault) {
|
if (publishDefault) {
|
||||||
disable = true;
|
disable = true;
|
||||||
// 设置禁用麦克风采集
|
// 设置禁用麦克风采集
|
||||||
|
if (isSw) {
|
||||||
|
//下麥
|
||||||
|
SWAuManager.get().setMicAn(false);
|
||||||
|
onUnPublishStreamsSuccess();
|
||||||
|
} else {
|
||||||
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
|
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
|
||||||
// ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
|
// ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
|
||||||
gameMicManager.unPublishStreams();
|
gameMicManager.unPublishStreams();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (sudGameUserListAdapter.isMicMax()) {
|
if (sudGameUserListAdapter.isMicMax()) {
|
||||||
ToastUtil.show(WordUtil.isNewZh() ? "上麥人數最大7人" : "The maximum number of people on the microphone is 7");
|
ToastUtil.show(WordUtil.isNewZh() ? "上麥人數最大7人" : "The maximum number of people on the microphone is 7");
|
||||||
|
} else {
|
||||||
|
//上麦
|
||||||
|
if (isSw) {
|
||||||
|
SWAuManager.get().setMicAn(true);
|
||||||
|
onPublishSuccess();
|
||||||
} else {
|
} else {
|
||||||
gameMicManager.publishDefaultAVStream();
|
gameMicManager.publishDefaultAVStream();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() {
|
mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() {
|
||||||
@ -326,8 +380,6 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(gameCloseWheat, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(gameCloseWheat, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@ -341,10 +393,13 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
if (disable) {
|
if (disable) {
|
||||||
disable = false;
|
disable = false;
|
||||||
// 设置禁用麦克风采集
|
// 设置禁用麦克风采集
|
||||||
|
if (isSw) {
|
||||||
|
SWAuManager.get().setMicAn(true);
|
||||||
|
} else {
|
||||||
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
|
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
|
||||||
|
}
|
||||||
ImgLoader.display(mContext, R.mipmap.icon_game_open_wheat, gameCloseWheat);
|
ImgLoader.display(mContext, R.mipmap.icon_game_open_wheat, gameCloseWheat);
|
||||||
LiveNetManager.get(mContext)
|
LiveNetManager.get(mContext).onMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
||||||
.onMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(HttpCallbackModel data) {
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
|
|
||||||
@ -359,10 +414,13 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
} else {
|
} else {
|
||||||
disable = true;
|
disable = true;
|
||||||
// 设置禁用麦克风采集
|
// 设置禁用麦克风采集
|
||||||
|
if(isSw){
|
||||||
|
SWAuManager.get().setMicAn(false);
|
||||||
|
}else{
|
||||||
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
|
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
|
||||||
|
}
|
||||||
ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
|
ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
|
||||||
LiveNetManager.get(mContext)
|
LiveNetManager.get(mContext).offMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
||||||
.offMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(HttpCallbackModel data) {
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
|
|
||||||
@ -387,15 +445,12 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.game_review_input), new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.game_review_input), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
new XPopup.Builder(mContext)
|
new XPopup.Builder(mContext).enableDrag(false).asCustom(new SudGameInputPopupWindow(mContext, new SudGameInputPopupWindow.SudGameInputCallBack() {
|
||||||
.enableDrag(false)
|
|
||||||
.asCustom(new SudGameInputPopupWindow(mContext, new SudGameInputPopupWindow.SudGameInputCallBack() {
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String textMessage) {
|
public void sendMessage(String textMessage) {
|
||||||
gameMicManager.sendMessage(textMessage);
|
gameMicManager.sendMessage(textMessage);
|
||||||
}
|
}
|
||||||
}))
|
})).show();
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -406,9 +461,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
gameContainer.removeAllViews();
|
gameContainer.removeAllViews();
|
||||||
} else { // 把游戏View添加到容器内
|
} else { // 把游戏View添加到容器内
|
||||||
gameContainer.addView(view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
gameContainer.addView(view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 加载游戏,参数定义可查看BaseGameViewModel.switchGame()方法注释
|
// 加载游戏,参数定义可查看BaseGameViewModel.switchGame()方法注释
|
||||||
@ -483,9 +536,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1);
|
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1);
|
||||||
break;
|
break;
|
||||||
case SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN:
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN:
|
||||||
LiveNetManager.get(mContext).gameStartCheckRemainingBalance(mCreateSudRoomModel.getSudGameId(),
|
LiveNetManager.get(mContext).gameStartCheckRemainingBalance(mCreateSudRoomModel.getSudGameId(), mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<CheckRemainingBalance>() {
|
||||||
mCreateSudRoomModel.getSudGameRoomId(), new
|
|
||||||
HttpCallback<CheckRemainingBalance>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(CheckRemainingBalance data) {
|
public void onSuccess(CheckRemainingBalance data) {
|
||||||
if (data.getStatus() == 1) {
|
if (data.getStatus() == 1) {
|
||||||
@ -506,7 +557,6 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
LiveNetManager.get(mContext).deductMoney(mCreateSudRoomModel.getSudGameRoomId());
|
LiveNetManager.get(mContext).deductMoney(mCreateSudRoomModel.getSudGameRoomId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -514,7 +564,6 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
LiveNetManager.get(mContext).getRoomMicData(mLiveUid, new HttpCallback<List<SudGameUserModel>>() {
|
LiveNetManager.get(mContext).getRoomMicData(mLiveUid, new HttpCallback<List<SudGameUserModel>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<SudGameUserModel> data) {
|
public void onSuccess(List<SudGameUserModel> data) {
|
||||||
|
|
||||||
gameMicManager.refreshStreams(data);
|
gameMicManager.refreshStreams(data);
|
||||||
sudGameUserListAdapter.refreshSudGameUserList(data, muteUser);
|
sudGameUserListAdapter.refreshSudGameUserList(data, muteUser);
|
||||||
}
|
}
|
||||||
@ -548,8 +597,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
LiveNetManager.get(mContext)
|
LiveNetManager.get(mContext).joinMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
||||||
.joinMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(HttpCallbackModel data) {
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
|
|
||||||
@ -628,8 +676,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
|||||||
gameCloseWheat.setVisibility(View.INVISIBLE);
|
gameCloseWheat.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
LiveNetManager.get(mContext)
|
LiveNetManager.get(mContext).leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
||||||
.leaveMic(mLiveUid, new HttpCallback<HttpCallbackModel>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(HttpCallbackModel data) {
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
|
|
||||||
|
@ -215,6 +215,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
|
|||||||
public void onSuccess(List<CustomSidebarInfoModel> data) {
|
public void onSuccess(List<CustomSidebarInfoModel> data) {
|
||||||
for (CustomSidebarInfoModel datum : data) {
|
for (CustomSidebarInfoModel datum : data) {
|
||||||
if (datum.getType().equals("6")) {
|
if (datum.getType().equals("6")) {
|
||||||
|
//直播间来的
|
||||||
new XPopup.Builder(mContext)
|
new XPopup.Builder(mContext)
|
||||||
.enableDrag(false)
|
.enableDrag(false)
|
||||||
.moveUpToKeyboard(false)
|
.moveUpToKeyboard(false)
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.yunbao.live.event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cxf on 2019/3/25.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class LiveOpenSuccessEvent {
|
||||||
|
|
||||||
|
}
|
@ -102,6 +102,7 @@ import com.yunbao.live.dialog.BlowkissDialog;
|
|||||||
import com.yunbao.live.dialog.NewUserDialog;
|
import com.yunbao.live.dialog.NewUserDialog;
|
||||||
import com.yunbao.live.event.LinkMicTxAccEvent;
|
import com.yunbao.live.event.LinkMicTxAccEvent;
|
||||||
import com.yunbao.live.event.LiveAudienceEvent;
|
import com.yunbao.live.event.LiveAudienceEvent;
|
||||||
|
import com.yunbao.live.event.LiveOpenSuccessEvent;
|
||||||
import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
|
import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
|
||||||
import com.yunbao.live.presenter.LiveLinkMicPresenter;
|
import com.yunbao.live.presenter.LiveLinkMicPresenter;
|
||||||
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
|
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
|
||||||
@ -442,7 +443,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
||||||
}
|
}
|
||||||
enterRoomNew();
|
enterRoomNew();
|
||||||
|
Bus.get().post(new LiveOpenSuccessEvent());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -835,6 +836,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void loadTimeoutRunnableGone(){
|
||||||
|
if(liveHandler!=null){
|
||||||
|
liveHandler.postDelayed(loadTimeoutRunnableGone, 1_000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void removeLiveEnd() {
|
public void removeLiveEnd() {
|
||||||
if (mLiveEndViewHolder != null) {
|
if (mLiveEndViewHolder != null) {
|
||||||
mLiveEndViewHolder.removeFromParent();
|
mLiveEndViewHolder.removeFromParent();
|
||||||
|
Loading…
Reference in New Issue
Block a user