add[声望升级-AB面]

This commit is contained in:
Martin 2024-05-18 14:36:35 +08:00
parent 93dbee14b3
commit 6a4ac35203
97 changed files with 12448 additions and 2740 deletions

View File

@ -50,7 +50,7 @@ import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.live.socket.SocketReceiveBean;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.views.PortraitLiveManager;
import com.yunbao.live.views.RecommendLiveRoomProvider;
@ -209,8 +209,8 @@ public class AppContext extends CommonAppContext {
if (content.getContent().contains("_method_")) {
msg.obj = content.getContent();
//观众页面
if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
SocketRyClient.mSocketHandler.sendMessage(msg);
if (SocketSwClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
SocketSwClient.mSocketHandler.sendMessage(msg);
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class);
JSONObject map = received.getMsg().getJSONObject(0);
@ -222,8 +222,8 @@ public class AppContext extends CommonAppContext {
Bus.get().post(sudGameSocketImEvent);
}
//主播页面
if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.sendMessage(msg);
if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.sendMessage(msg);
}
} else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息

View File

@ -267,13 +267,15 @@ public class Constants {
public static final String LIVE_PK_RANDOM_START="RankingStartRandomPK";
public static final int LIVE_SDK_KSY = 0;//金山推流
public static final int LIVE_SDK_TX = 1;//腾讯推流
public static final int LIVE_SDK_SW = 2;//声网
public static final String LIVE_SDK_IS_SW = "liveSdkIsSw"; //是否是聲網
public static final int LINK_MIC_TYPE_NORMAL = 0;//观众与主播连麦
public static final int LINK_MIC_TYPE_ANCHOR = 1;//主播与主播连麦
public static final String SOCKET_LIVE_ANCHOR_PK_DIALOG="GuildCompetitionNotice";//公会赛弹窗
//视频举报获取位置
public static int xIndex = 0;
public static int yindex = 0;

View File

@ -424,7 +424,7 @@ public class WebViewActivity extends AbsActivity {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}
@ -440,7 +440,7 @@ public class WebViewActivity extends AbsActivity {
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
}
finish();
}

View File

@ -1,5 +1,6 @@
package com.yunbao.common.bean;
import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
/**
@ -24,6 +25,9 @@ public class AiAutomaticSpeechModel extends BaseModel {
//气泡背景
@SerializedName("system_bubble")
private String systemBubble;
@SerializedName("icon_en")
@JSONField(name = "icon_en")
private String iconEn;
public String getNameColor() {
return nameColor;
@ -47,6 +51,16 @@ public class AiAutomaticSpeechModel extends BaseModel {
return content;
}
public String getIconEn() {
return iconEn;
}
public AiAutomaticSpeechModel setIconEn(String iconEn) {
this.iconEn = iconEn;
return this;
}
public AiAutomaticSpeechModel setContent(String content) {
this.content = content;
return this;

View File

@ -13,6 +13,16 @@ public class CheckLiveModel extends BaseModel {
private String typeMsg;
@SerializedName("live_sdk")
private String liveSdk;
@SerializedName("is_shengwang")
private String isShengwang;
public String getIsShengwang() {
return isShengwang;
}
public void setIsShengwang(String isShengwang) {
this.isShengwang = isShengwang;
}
public static CheckLiveModel objectFromData(String str) {

View File

@ -41,6 +41,7 @@ public class EnterRoomNewModel extends BaseModel {
private SudGameDateModel sudGameDateModel;
@SerializedName("quick_gift_remaining_quantity")
private int quickGiftRemainingQuantity;//剩余的小PD礼物数量
@SerializedName("if_viewing_duration_complete")
private int ifViewingDurationComplete;//通过观看时间获取小PD礼物的次数
@SerializedName("sendMoneyLongStatus")

View File

@ -115,6 +115,35 @@ public class SendBlindGiftEvent extends BaseModel {
private String liveGiftNotify;
@SerializedName("userNiceName")
private String userNiceName;
@SerializedName("special_gift")
private int specialGift;
@SerializedName("special_gift_name")
private String specialGiftName;
@SerializedName("special_gift_name_en")
private String specialGiftNameEn;
public int getSpecialGift() {
return specialGift;
}
public void setSpecialGift(int specialGift) {
this.specialGift = specialGift;
}
public String getSpecialGiftName() {
return specialGiftName;
}
public void setSpecialGiftName(String specialGiftName) {
this.specialGiftName = specialGiftName;
}
public String getSpecialGiftNameEn() {
return specialGiftNameEn;
}
public void setSpecialGiftNameEn(String specialGiftNameEn) {
this.specialGiftNameEn = specialGiftNameEn;
}
public String getUserNiceName() {
return userNiceName;

View File

@ -764,7 +764,7 @@ public class LiveHttpUtil {
* @param file 封面图片文件
* @param callback
*/
public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, int clarityType, HttpCallback callback) {
public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, int clarityType,boolean isSw, HttpCallback callback) {
PostRequest<JsonBean> request = HttpClient.getInstance().post("Live.createRoom2", LiveHttpConsts.CREATE_ROOM)
.params("title", title)
@ -773,6 +773,7 @@ public class LiveHttpUtil {
.params("landscape", "2")
.params("class_type", "0")
.params("type_val", typeVal)
.params("is_shengwang",isSw?1:0)
.params("clarityType", clarityType);
if (file != null) {
request.params("file", file);
@ -817,6 +818,15 @@ public class LiveHttpUtil {
.execute(callback);
}
/**
* 获取是否是声网开播
* @param callback
*/
public static void getIsSw(HttpCallback callback) {
HttpClient.getInstance().get("Tx.setRtcFirm", "Tx.setRtcFirm")
.execute(callback);
}
/**
* 腾讯sdk 跟主播连麦时获取主播的低延时流
*/

View File

@ -15,9 +15,13 @@ import com.bumptech.glide.request.RequestOptions;
import com.iflytek.cloud.SpeechConstant;
import com.iflytek.cloud.SpeechUtility;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.R;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.event.RongIMConnectionStatusEvent;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import org.greenrobot.eventbus.EventBus;
@ -25,6 +29,7 @@ import io.rong.imkit.GlideKitImageEngine;
import io.rong.imkit.IMCenter;
import io.rong.imkit.RongIM;
import io.rong.imkit.config.RongConfigCenter;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
@ -112,12 +117,31 @@ public class RongcloudIMManager {
}
public static void connectIM(Context context) {
connectIM(context, new RongIMClient.ConnectCallback() {
@Override
public void onSuccess(String t) {
}
@Override
public void onError(RongIMClient.ConnectionErrorCode e) {
}
@Override
public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) {
}
});
}
/**
* 连接融云服务器
*
* @param context
*/
public static void connectIM(Context context) {
public static void connectIM(Context context, RongIMClient.ConnectCallback callback) {
MessageIMManager.get(context).addImRongCloudObserver();
MessageIMManager.get(context).getSystemMessages();
IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo();
@ -129,6 +153,7 @@ public class RongcloudIMManager {
RongIM.connect(IMToken, 0, new RongIMClient.ConnectCallback() {
@Override
public void onSuccess(String s) {
callback.onSuccess(s);
//连接成功如果 onDatabaseOpened() 时没有页面跳转也可在此时进行跳转
Log.e(CLASSNAME, "onSuccess:" + s);
isReady = true;
@ -138,6 +163,7 @@ public class RongcloudIMManager {
@Override
public void onError(RongIMClient.ConnectionErrorCode connectionErrorCode) {
callback.onError(connectionErrorCode);
if (connectionErrorCode.equals(RongIMClient.ConnectionErrorCode.RC_CONN_TOKEN_EXPIRE)) {
// APP 服务请求新 token获取到新 token 后重新 connect()
Log.e(CLASSNAME, "onError:(从 APP 服务请求新 token" + RongIMClient.ConnectionErrorCode.RC_CONN_TOKEN_EXPIRE);
@ -152,6 +178,7 @@ public class RongcloudIMManager {
@Override
public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus databaseOpenStatus) {
callback.onDatabaseOpened(databaseOpenStatus);
if (RongIMClient.DatabaseOpenStatus.DATABASE_OPEN_SUCCESS.equals(databaseOpenStatus)) {
//本地数据库打开跳转到会话列表页面
Log.e(CLASSNAME, "onDatabaseOpened:(本地数据库打开)" + databaseOpenStatus);
@ -225,4 +252,66 @@ public class RongcloudIMManager {
}
/**
* 发送消息失败重连次数超过3就重新登录
*/
private static int reconnectIndex = 0;
public static void sendMessage(final Message message, final String pushContent, final String pushData, final IRongCallback.ISendMessageCallback callback) {
RongIMClient.getInstance().sendMessage(message, pushContent, pushData, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
if (callback != null) {
callback.onAttached(message);
}
}
@Override
public void onSuccess(Message message) {
reconnectIndex = 0;
if (callback != null) {
callback.onSuccess(message);
}
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
if (reconnectIndex > 2) {
reconnectIndex = 0;
ToastUtil.show(WordUtil.getNewString(R.string.login_invalid));
EventBus.getDefault().post(new RongIMConnectionStatusEvent());
return;
}
if (errorCode.code == 33000) {
reconnectIndex++;
connectIM(AppManager.getInstance().getMainActivity(), new RongIMClient.ConnectCallback() {
@Override
public void onSuccess(String t) {
sendMessage(message, pushContent, pushData, callback);
}
@Override
public void onError(RongIMClient.ConnectionErrorCode e) {
sendMessage(message, pushContent, pushData, callback);
}
@Override
public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) {
if (RongIMClient.DatabaseOpenStatus.DATABASE_OPEN_ERROR.equals(code)) {
sendMessage(message, pushContent, pushData, callback);
}
}
});
} else {
if (callback != null) {
callback.onError(message, errorCode);
}
}
}
});
}
}

View File

@ -34,6 +34,15 @@ public class AppManager {
activityStack.add(activity);
}
public Activity getMainActivity() {
for (Activity activity : activityStack) {
if (activity.getClass().getSimpleName().contains("MainActivity")) {
return activity;
}
}
return null;
}
/**
* 移除Activity
*/

View File

@ -358,6 +358,7 @@ public class DialogUitl {
private boolean mCancelable;
private boolean mBackgroundDimEnabled;//显示区域以外是否使用黑色半透明背景
private boolean mInput;//是否是输入框的
private boolean isShowCancelButton=true;
private String mHint;
private int mInputType;
private int mLength;
@ -454,6 +455,11 @@ public class DialogUitl {
return this;
}
public Builder setShowCancelButton(boolean showCancelButton) {
isShowCancelButton = showCancelButton;
return this;
}
public Dialog build() {
final Dialog dialog = new Dialog(mContext, mBackgroundDimEnabled ? R.style.dialog : R.style.dialog2);
if (mView != 0) {
@ -498,6 +504,9 @@ public class DialogUitl {
if (!TextUtils.isEmpty(mCancelString)) {
btnCancel.setText(mCancelString);
}
if(!isShowCancelButton){
btnCancel.setVisibility(View.GONE);
}
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View v) {

View File

@ -285,7 +285,7 @@ public class JavascriptInterfaceUtils {
liveBean.setGiftId(giftId);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (!"".endsWith(Constants.mStream)) {
@ -295,7 +295,7 @@ public class JavascriptInterfaceUtils {
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
}
androidGoBack();
}

View File

@ -33,6 +33,7 @@ public class LiveRoomCheckLivePresenter {
private LiveBean mLiveBean;
private ActionListener mActionListener;
private int mLiveSdk;
private boolean isSw;
//搜索页面不提示密码
public static boolean isRoom = false;
@ -50,7 +51,7 @@ public class LiveRoomCheckLivePresenter {
@Override
public void forwardNormalRoom(CheckLiveModel model) {
if (actionListener != null) {
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk(),model.getIsShengwang().equals("1"));
}
}
@ -74,7 +75,7 @@ public class LiveRoomCheckLivePresenter {
if (model.getTypeMsg().equalsIgnoreCase(password)) {
dialog.dismiss();
if (actionListener != null) {
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk(),model.getIsShengwang().equals("1"));
}
} else {
ToastUtil.show(mContext.getString(R.string.live_password_error));
@ -93,7 +94,7 @@ public class LiveRoomCheckLivePresenter {
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
if (actionListener != null) {
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk(),model.getIsShengwang().equals("1"));
}
} else {
ToastUtil.show(msg);
@ -139,6 +140,7 @@ public class LiveRoomCheckLivePresenter {
mLiveTypeMsg = obj.getString("type_msg");
if (CommonAppConfig.LIVE_SDK_CHANGED) {
mLiveSdk = obj.getIntValue("live_sdk");
isSw= obj.getString("is_shengwang").equals("1");
} else {
mLiveSdk = CommonAppConfig.LIVE_SDK_USED;
}
@ -263,17 +265,16 @@ public class LiveRoomCheckLivePresenter {
*/
private void enterLiveRoom() {
if (mActionListener != null) {
mActionListener.onLiveRoomChanged(mLiveBean, mLiveType, mLiveTypeVal, mLiveSdk);
mActionListener.onLiveRoomChanged(mLiveBean, mLiveType, mLiveTypeVal, mLiveSdk,isSw);
}
}
public interface ActionListener {
void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk);
void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk,boolean isSw);
}
public interface NewActionListener {
void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk);
void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw);
void onCheckError(String contextError);
}

View File

@ -46,23 +46,25 @@ public class RouteUtil {
public static final String PATH_RED_PACKET_LIST = "/main/RedPacketListActivity";
public static final String PATH_RED_PACKET_INFO = "/main/RedPacketInfoActivity";
public static final String PATH_RED_PACKET_USER = "/main/RedPacketUsersActivity";
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
public static final String PATH_SudGameActivity="/live/SudGameActivity";
public static final String PATH_SELECT_AVATAR = "/main/UserAvatarSelectActivity";
public static final String PATH_BattlePassActivity = "/main/BattlePassActivity";
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";
public static void forwardCommunityActivity() {
ARouter.getInstance().build(PATH_COMMUNITY_Activity)
.navigation();
}
public static void forwardFansActivity(String uid) {
ARouter.getInstance().build(PATH_FANSACTIVITY)
.withString(Constants.TO_UID, uid)
.navigation();
}
public static void forwardSudGameActivity(String CreateSudRoom,boolean isAn,boolean isHome) {
public static void forwardSudGameActivity(String CreateSudRoom, boolean isAn, boolean isHome) {
ARouter.getInstance().build(PATH_SudGameActivity)
.withString("CreateSudRoom", CreateSudRoom)
.withBoolean("CreateIsAn", isAn)
@ -218,7 +220,7 @@ public class RouteUtil {
* 跳转到充值页面
*/
public static void forwardMyCoin(Context context) {
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=zhifu&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=zhifu&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
ARouter.getInstance().build(PATH_COIN).withString("url", url).navigation();
}
@ -250,7 +252,7 @@ public class RouteUtil {
/**
* 打开直播页面
*/
public static void forwardLiveAudienceActivity(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) {
public static void forwardLiveAudienceActivity(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal, boolean isSw) {
if (MicStatusManager.getInstance().isMic(mLiveBean.getUid())) {
MicStatusManager.getInstance().showDownMicDialog(CommonAppContext.activityWeakReference.get());
return;
@ -260,7 +262,9 @@ public class RouteUtil {
.withParcelable(Constants.LIVE_BEAN, mLiveBean)
.withInt(Constants.LIVE_TYPE, mLiveType)
.withInt(Constants.LIVE_SDK, mLiveSDK)
.withBoolean(Constants.LIVE_SDK_IS_SW, isSw)
.withInt(Constants.LIVE_TYPE_VAL, mLiveTypeVal);
if (mLiveBean.getParams() != null) {
for (String key : mLiveBean.getParams().keySet()) {
postcard.withString(key, mLiveBean.getParams().get(key));
@ -269,14 +273,14 @@ public class RouteUtil {
postcard.navigation();
}
public static void forwardGiftWallActivity(String mStream, String mAnchorName, String mLiveUid, String mAvatarUrl, int isAttention,boolean isLive) {
public static void forwardGiftWallActivity(String mStream, String mAnchorName, String mLiveUid, String mAvatarUrl, int isAttention, boolean isLive) {
ARouter.getInstance().build(PATH_GIFT_WALL)
.withString(Constants.LIVE_UID, mLiveUid)
.withString(Constants.STREAM, mStream)
.withString("mAnchorName", mAnchorName)
.withString("mAvatarUrl", mAvatarUrl)
.withInt("isAttention", isAttention)
.withBoolean("isLive",isLive)
.withBoolean("isLive", isLive)
.navigation();
}
@ -354,7 +358,7 @@ public class RouteUtil {
/**
* 战令
*/
public static void forwardBattlePass(){
public static void forwardBattlePass() {
ARouter.getInstance().build(PATH_BattlePassActivity)
.navigation();
}

View File

@ -131,8 +131,8 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {

View File

@ -336,7 +336,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
RouteUtil.forwardLiveAudienceActivity(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal);
RouteUtil.forwardLiveAudienceActivity(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal,mLiveSDK == Constants.LIVE_SDK_SW);
} else {
//判断是否有直播悬浮窗有直接关闭

View File

@ -97,10 +97,15 @@
<activity
android:name=".activity.SystemMessageActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.LiveSwAnchorActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.LiveRyAnchorActivity"
android:screenOrientation="portrait" />
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />

View File

@ -83,10 +83,12 @@ import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveSwLinkMicPkPresenter;
import com.yunbao.live.socket.SocketClient;
import com.yunbao.live.socket.SocketMessageListener;
import com.yunbao.live.socket.SocketRyChatUtil;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.utils.LoadDian9TuUtil;
import com.yunbao.live.views.AbsLiveViewHolder;
import com.yunbao.live.views.LiveAddImpressViewHolder;
@ -125,9 +127,13 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
protected LiveEndViewHolder mLiveEndViewHolder;
protected LiveLinkMicPresenter mLiveLinkMicPresenter;//观众与主播连麦逻辑
protected LiveLinkMicAnchorPresenter mLiveLinkMicAnchorPresenter;//主播与主播连麦逻辑
protected LiveLinkMicPkPresenter mLiveLinkMicPkPresenter;//主播与主播PK逻辑
public static LiveRyLinkMicPkPresenter mLiveRyLinkMicPkPresenter;//主播与主播PK逻辑
protected LiveLinkMicPkPresenter mLiveLinkMicPkPresenter;//主播与主播PK逻辑 腾讯
public static LiveRyLinkMicPkPresenter mLiveRyLinkMicPkPresenter;//主播与主播PK逻辑 融云
public static LiveSwLinkMicPkPresenter mLiveSwLinkMicPkPresenter;//主播与主播PK逻辑 声网
public SocketClient mSocketClient;
public SocketSwClient mSocketSwClient;
public SocketRyClient mSocketRyClient;
protected LiveBean mLiveBean;
@ -160,6 +166,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
protected List<LiveUserGiftBean> mAudienceList = new ArrayList<>();
protected LiveMicAnchorDialogFragment.OnMicListener micListener = null;
public boolean isSw;
@Override
protected void main() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@ -393,18 +401,29 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
}
@Override
public void onEndPk(long leftUid, long rightUid, long left, long right, LivePKUserListBean bean) {
if (mLiveRyLinkMicPkPresenter != null) {
L.eSw("onEndPk 结束PK mLiveRyLinkMicPkPresenter");
if (mLiveUid.equals(leftUid + "")) {
mLiveRyLinkMicPkPresenter.onPkProgressEnd(left, right, bean);
} else {
mLiveRyLinkMicPkPresenter.onPkProgressEnd(right, left, bean);
}
}
if (mLiveSwLinkMicPkPresenter != null) {
L.eSw("onEndPk 结束PK mLiveSwLinkMicPkPresenter");
if (mLiveUid.equals(leftUid + "")) {
mLiveSwLinkMicPkPresenter.onPkProgressEnd(left, right, bean);
} else {
mLiveSwLinkMicPkPresenter.onPkProgressEnd(right, left, bean);
}
}
}
/**
@ -669,6 +688,10 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1);
}
if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.onLinkMicPkClose(1);
}
// }
@ -728,7 +751,14 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
@Override
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname, String isLadders) {
if (mContext instanceof LiveAudienceActivity) return;
L.eSw( "pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders);
L.eSw("pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders);
if (isSw) {
if (mLiveSwLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveSwLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
pr = new pkRunnable(pkUid, pkhead, pkname, isLadders);
mHandler.postDelayed(pr, 4000);//3秒后执行Runnable中的run方法
}
} else {
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
pr = new pkRunnable(pkUid, pkhead, pkname, isLadders);
@ -736,6 +766,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
}
}
}
public Handler mHandler = new Handler();
public pkRunnable pr;
@ -774,6 +805,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(i);
} else if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
} else if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.onLinkMicPkClose(i);
}
}
@ -812,6 +845,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} else if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo();
} else if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo();
}
}
@ -1336,8 +1372,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
if (outRankHideFirst) {
//获取隐身的用户的ID
LiveNetManager.get(mContext)
.getNobleRankHideUserList(new com.yunbao.common.http.base.HttpCallback<NobleRankHideUserListModel>() {
LiveNetManager.get(mContext).getNobleRankHideUserList(new com.yunbao.common.http.base.HttpCallback<NobleRankHideUserListModel>() {
@Override
public void onSuccess(NobleRankHideUserListModel data) {
outRankHide = data.getInRankHide();
@ -1672,15 +1707,14 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
micListener = fragment.getMicListener();
fragment.setMicQueueList(mMicQueueList);
fragment.setAudienceList(mAudienceList);
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment");
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment");
}
/**
* 获取连麦列表
*/
public void showMicList(String uid, LiveRoomViewHolder mLiveRoomViewHolder) {
LiveNetManager.get(mContext)
.getDRMicUserList(uid, new com.yunbao.common.http.base.HttpCallback<List<LinkMicUserBean>>() {
LiveNetManager.get(mContext).getDRMicUserList(uid, new com.yunbao.common.http.base.HttpCallback<List<LinkMicUserBean>>() {
@Override
public void onSuccess(List<LinkMicUserBean> data) {
if (mLiveRoomViewHolder != null) {

View File

@ -282,7 +282,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
+ CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid
+ "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0");
ZhuangBanActivity.forward(mContext, url, false,0);
ZhuangBanActivity.forward(mContext, url, false, 0);
break;
case Constants.LIVE_FUNC_LINK_MIC://连麦
openLinkMicAnchorWindow();
@ -632,6 +632,9 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
// } else {
// SocketRyChatUtil.closeLive(mLiveUid, mSocketRyClient);
//断开socket
if (mSocketSwClient != null) {
mSocketSwClient.disConnect();
}
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
}

View File

@ -31,7 +31,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils;
import com.facebook.appevents.AppEventsLogger;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.enums.PopupPosition;
@ -188,6 +187,7 @@ public class LiveAudienceActivity extends LiveActivity {
private boolean liveIndex = true;
private boolean isPk = false;
private boolean isRadPacetModle = false;
public boolean isSw;
@Override
public <T extends View> T findViewById(@IdRes int id) {
@ -209,6 +209,7 @@ public class LiveAudienceActivity extends LiveActivity {
mProcessResultUtil = new ProcessResultUtil(this);
Intent intent = getIntent();
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
isSw = intent.getBooleanExtra(Constants.LIVE_SDK_IS_SW, false);
L.e(TAG, "直播sdk----->" + (mLiveSDK == Constants.LIVE_SDK_KSY ? "金山云" : "腾讯云"));
mLiveType = intent.getIntExtra(Constants.LIVE_TYPE, Constants.LIVE_TYPE_NORMAL);
mLiveTypeVal = intent.getIntExtra(Constants.LIVE_TYPE_VAL, 0);
@ -300,8 +301,7 @@ public class LiveAudienceActivity extends LiveActivity {
Log.e(TAG, "mCurrentItem:" + mCurrentItem);
if (mCurrentItem == itemModelList.size() - 1) {
if (isRadPacetModle) {//从红包专区进去的走红包专区列表
MainNetManager.get(mContext)
.getRedPacket(new com.yunbao.common.http.base.HttpCallback<List<AnchorRecommendItemModel>>() {
MainNetManager.get(mContext).getRedPacket(new com.yunbao.common.http.base.HttpCallback<List<AnchorRecommendItemModel>>() {
@Override
public void onSuccess(List<AnchorRecommendItemModel> data) {
if (TextUtils.equals(data.get(0).getUid(), mLiveBean.getUid())) {
@ -317,8 +317,7 @@ public class LiveAudienceActivity extends LiveActivity {
}
});
} else {
MainNetManager.get(mContext)
.anchorRecommendType("30", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
MainNetManager.get(mContext).anchorRecommendType("30", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
if (TextUtils.equals(data.getList().get(0).getUid(), mLiveBean.getUid())) {
@ -404,7 +403,7 @@ public class LiveAudienceActivity extends LiveActivity {
mHandler.removeCallbacks(pr);
pr = null;
}
manager.onAdd(mLiveBean, mLiveType, mLiveTypeVal, mLiveSDK);
manager.onAdd(mLiveBean, mLiveType, mLiveTypeVal, mLiveSDK, isSw);
//加载完页面后再后台静默下载礼物svga
downloadAllGift();
@ -413,7 +412,7 @@ public class LiveAudienceActivity extends LiveActivity {
} else {
new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
liveIndex = false;
try {
mLiveSDK = Integer.parseInt(liveSdk);
@ -441,7 +440,7 @@ public class LiveAudienceActivity extends LiveActivity {
}
mViewGroup.addView(manager.getRootView());
manager.onAdd(mLiveBean, liveType, mLiveTypeVal, mLiveSDK);
manager.onAdd(mLiveBean, liveType, mLiveTypeVal, mLiveSDK, isSw);
//加载完页面后再后台静默下载礼物svga
downloadAllGift();
over();
@ -483,12 +482,7 @@ public class LiveAudienceActivity extends LiveActivity {
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
return;
}
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
.setmLiveUid(mLiveUid)
.setmStream(mStream)
.setPk(isPk)
.setLiveGuardInfo(mLiveGuardInfo));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP).setmLiveUid(mLiveUid).setmStream(mStream).setPk(isPk).setLiveGuardInfo(mLiveGuardInfo));
});
}
@ -496,13 +490,7 @@ public class LiveAudienceActivity extends LiveActivity {
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
return;
}
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
.setmLiveUid(mLiveUid)
.setmStream(mStream)
.setPk(isPk)
.setLiveGuardInfo(mLiveGuardInfo)
.setmWishGiftId(giftId));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP).setmLiveUid(mLiveUid).setmStream(mStream).setPk(isPk).setLiveGuardInfo(mLiveGuardInfo).setmWishGiftId(giftId));
}
public void openGiftWindow(String giftId, String for_by) {
@ -511,14 +499,7 @@ public class LiveAudienceActivity extends LiveActivity {
}
new Handler(Looper.getMainLooper()).post(() -> {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
.setmLiveUid(mLiveUid)
.setmStream(mStream)
.setPk(isPk)
.setLiveGuardInfo(mLiveGuardInfo)
.setmWishGiftId(giftId)
.setUname("1"));//setUname==by
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP).setmLiveUid(mLiveUid).setmStream(mStream).setPk(isPk).setLiveGuardInfo(mLiveGuardInfo).setmWishGiftId(giftId).setUname("1"));//setUname==by
});
}
@ -573,7 +554,7 @@ public class LiveAudienceActivity extends LiveActivity {
@Override
public void onLinkDRMicPkApplyOk(UserBean u) {
L.eSw("onLinkDRMicPkApplyOk:"+u.getId());
L.eSw("onLinkDRMicPkApplyOk:" + u.getId());
//多人PK 连麦
//manager.getmLivePlayViewHolder().setDrMicInfo(u);
}
@ -591,13 +572,7 @@ public class LiveAudienceActivity extends LiveActivity {
@Override
public void onBackPressed() {
if (manager != null && manager.getsudGameMin()) {
new XPopup.Builder(mContext)
.asCustom(new HintCustomPopup(mContext,
mContext.getString(com.yunbao.common.R.string.dialog_tip),
mContext.getString(com.yunbao.common.R.string.the_live_room))
.setLiveOpenOk(mContext.getString(com.yunbao.common.R.string.confirm))
.setLiveOpenCancel(mContext.getString(com.yunbao.common.R.string.cancel))
.setCallBack(new HintCustomPopup.HintCustomCallBack() {
new XPopup.Builder(mContext).asCustom(new HintCustomPopup(mContext, mContext.getString(com.yunbao.common.R.string.dialog_tip), mContext.getString(com.yunbao.common.R.string.the_live_room)).setLiveOpenOk(mContext.getString(com.yunbao.common.R.string.confirm)).setLiveOpenCancel(mContext.getString(com.yunbao.common.R.string.cancel)).setCallBack(new HintCustomPopup.HintCustomCallBack() {
@Override
public void onSure() {
MobclickAgent.onEvent(mContext, "live_room_close", "退出直播间");
@ -646,8 +621,7 @@ public class LiveAudienceActivity extends LiveActivity {
}
public void end() {
if (manager != null)
manager.end();
if (manager != null) manager.end();
}
/**
@ -702,24 +676,21 @@ public class LiveAudienceActivity extends LiveActivity {
* 计时收费更新主播映票数
*/
public void roomChargeUpdateVotes() {
if (manager != null)
manager.sendUpdateVotesMessage();
if (manager != null) manager.sendUpdateVotesMessage();
}
/**
* 暂停播放
*/
public void pausePlay() {
if (manager != null)
manager.pausePlay();
if (manager != null) manager.pausePlay();
}
/**
* 恢复播放
*/
public void resumePlay() {
if (manager != null)
manager.resumePlay();
if (manager != null) manager.resumePlay();
}
public CountDownTimer getCountDownTimer() {
@ -730,8 +701,7 @@ public class LiveAudienceActivity extends LiveActivity {
* 充值成功
*/
public void onChargeSuccess() {
if (manager != null)
manager.onChargeSuccess();
if (manager != null) manager.onChargeSuccess();
}
public void setCoinNotEnough(boolean coinNotEnough) {
@ -835,12 +805,11 @@ public class LiveAudienceActivity extends LiveActivity {
mStream = liveBean.getStream();
mAncherName = liveBean.getUserNiceName();
mAncherIcon = liveBean.getAvatar();
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK);
//暂时 true
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK, isSw);
}
}
}
}
@Override
@ -855,14 +824,12 @@ public class LiveAudienceActivity extends LiveActivity {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.setFansGroup("0");
}
is_fans = "2";
}
}
GiftCacheUtil.getInstance().restart();
if (manager.isEnterRoom()) {
new Handler(Looper.getMainLooper()).postDelayed(() -> OpenAdManager.getInstance().show(OpenAdManager.TYPE_LIVE,
LiveGuardInfo.isGuard(mLiveGuardInfo)), 400);
new Handler(Looper.getMainLooper()).postDelayed(() -> OpenAdManager.getInstance().show(OpenAdManager.TYPE_LIVE, LiveGuardInfo.isGuard(mLiveGuardInfo)), 400);
}
}
@ -874,8 +841,7 @@ public class LiveAudienceActivity extends LiveActivity {
private void adjustFullScreen(Configuration config) {
final WindowInsetsControllerCompat insetsController = ViewCompat.getWindowInsetsController(getWindow().getDecorView());
if (insetsController == null)
return;
if (insetsController == null) return;
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
insetsController.hide(WindowInsetsCompat.Type.systemBars());
} else {
@ -949,7 +915,7 @@ public class LiveAudienceActivity extends LiveActivity {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
if (liveBean == null) {
return;
}
@ -974,18 +940,15 @@ public class LiveAudienceActivity extends LiveActivity {
public void informationTransfer(CustomDrawerPopupEvent event) {
//跳转贵族
if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.noble))) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.NOBLE));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.NOBLE));
//跳转守护
} else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.guard_guard))) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GUARD));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GUARD));
manager.onGuardRed();
//跳转粉丝团
} else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.fan_club))) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.FAN_CLUB));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.FAN_CLUB));
}
}
@ -1011,69 +974,53 @@ public class LiveAudienceActivity extends LiveActivity {
@Override
public void evenTheWheat() {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI));
}
@Override
public void effectsSetting() {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.EFFECTS_SETTINGS));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.EFFECTS_SETTINGS));
}
@Override
public void slideSetting() {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.SLIDE_SETTINGS));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SLIDE_SETTINGS));
}
@Override
public void floatSetting() {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.FLOAT_SETTING));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.FLOAT_SETTING));
}
@Override
public void systemNotice() {
Bus.get().post(new LiveAudienceEvent()
.setBean(mLiveBean)
.setType(LiveAudienceEvent.LiveAudienceType.NOTICE));
Bus.get().post(new LiveAudienceEvent().setBean(mLiveBean).setType(LiveAudienceEvent.LiveAudienceType.NOTICE));
}
@Override
public void changeVideo() {
Bus.get().post(new LiveAudienceEvent()
.setBean(mLiveBean)
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO));
Bus.get().post(new LiveAudienceEvent().setBean(mLiveBean).setType(LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO));
}
@Override
public void online() {
Bus.get().post(new LiveAudienceEvent()
.setBean(mLiveBean)
.setType(LiveAudienceEvent.LiveAudienceType.ONLINE));
Bus.get().post(new LiveAudienceEvent().setBean(mLiveBean).setType(LiveAudienceEvent.LiveAudienceType.ONLINE));
}
@Override
public void reportLayout() {
Bus.get().post(new LiveAudienceEvent()
.setBean(mLiveBean)
.setType(LiveAudienceEvent.LiveAudienceType.REPORT));
Bus.get().post(new LiveAudienceEvent().setBean(mLiveBean).setType(LiveAudienceEvent.LiveAudienceType.REPORT));
}
@Override
public void share() {
Bus.get().post(new LiveAudienceEvent()
.setBean(mLiveBean)
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_SHARE));
Bus.get().post(new LiveAudienceEvent().setBean(mLiveBean).setType(LiveAudienceEvent.LiveAudienceType.LIVE_SHARE));
}
@Override
public void changeFontSize() {
Bus.get().post(new LiveAudienceEvent()
.setBean(mLiveBean)
.setType(LiveAudienceEvent.LiveAudienceType.FONT_SIZE));
Bus.get().post(new LiveAudienceEvent().setBean(mLiveBean).setType(LiveAudienceEvent.LiveAudienceType.FONT_SIZE));
}
@Override
@ -1082,23 +1029,17 @@ public class LiveAudienceActivity extends LiveActivity {
ToastUtil.show(WordUtil.isNewZh() ? "您已在游戏房间中" : "You are already in the game room");
} else {
//直播间来的
new XPopup.Builder(mContext)
.enableDrag(false)
new XPopup.Builder(mContext).enableDrag(false)
// .dismissOnTouchOutside(false)
// .dismissOnBackPressed(false)
.moveUpToKeyboard(false)
.asCustom(new SudGameListPopup(mContext, interactionID, child, mLiveUid))
.moveUpToKeyboard(false).asCustom(new SudGameListPopup(mContext, interactionID, child, mLiveUid))
.show();
}
}
});
new XPopup.Builder(mContext)
.hasShadowBg(false)
.isDestroyOnDismiss(true)
.isLightStatusBar(false)
.popupPosition(PopupPosition.Right)//右边
new XPopup.Builder(mContext).hasShadowBg(false).isDestroyOnDismiss(true).isLightStatusBar(false).popupPosition(PopupPosition.Right)//右边
.hasStatusBarShadow(true) //启用状态栏阴影
.setPopupCallback(new XPopupCallback() {
@Override
@ -1144,9 +1085,7 @@ public class LiveAudienceActivity extends LiveActivity {
public void onClickOutside(BasePopupView popupView) {
}
})
.asCustom(customDrawerPopupView)
.show();
}).asCustom(customDrawerPopupView).show();
}
break;
@ -1196,15 +1135,9 @@ public class LiveAudienceActivity extends LiveActivity {
//粉絲團粉絲團
//不是粉絲
if (LiveAudienceActivity.is_fans == null || "2".equals(LiveAudienceActivity.is_fans)) {
bundle.putString(Constants.URL,
(CommonAppConfig.HOST + "/h5/live/joinFansClub.html" +
"?uid=" + userInfo.getId() +
"&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid) + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
bundle.putString(Constants.URL, (CommonAppConfig.HOST + "/h5/live/joinFansClub.html" + "?uid=" + userInfo.getId() + "&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid) + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
} else {
bundle.putString(Constants.URL,
(CommonAppConfig.HOST + "/h5/live/fansClub.html" +
"?uid=" + userInfo.getId() +
"&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid) + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
bundle.putString(Constants.URL, (CommonAppConfig.HOST + "/h5/live/fansClub.html" + "?uid=" + userInfo.getId() + "&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid) + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
}
bundle.putString("liveUid", mLiveUid);
bundle.putString("anchorName", mAncherName);
@ -1214,25 +1147,18 @@ public class LiveAudienceActivity extends LiveActivity {
break;
case GUARD:
if (event.getObject() == null) {
openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
openNewGuardListWindow(mContext instanceof LiveSwAnchorActivity);
} else {
openNewBuyGuardWindow(true);
}
break;
case LIVE_WKS://周星榜
String weeklyStarUrl = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid="
+ userInfo.getId() +
"&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
String weeklyStarUrl = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid=" + userInfo.getId() + "&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
ZhuangBanActivity.forward(mContext, weeklyStarUrl, false, 1);
break;
case NOBLE:
Constants.isTitle = true;
String nobleUrl = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + userInfo.getUserNicename()
+ "&usernobId=" + userInfo.getNobleId()
+ "&token=" + userInfo.getToken()
+ "&anchorUid=" + mLiveBean.getUid()
+ "&ancherName=" + mLiveBean.getUserNiceName()
+ "&uid=" + userInfo.getId() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
String nobleUrl = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + userInfo.getUserNicename() + "&usernobId=" + userInfo.getNobleId() + "&token=" + userInfo.getToken() + "&anchorUid=" + mLiveBean.getUid() + "&ancherName=" + mLiveBean.getUserNiceName() + "&uid=" + userInfo.getId() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
ZhuangBanActivity.forward(mContext, nobleUrl, false, 1);
break;
case LIAN_MAI:
@ -1246,9 +1172,7 @@ public class LiveAudienceActivity extends LiveActivity {
manager.micIngTypeTwo(event.getBean(), event.getLiveType(), event.getLiveTypeVal());
} else {
//获取房间连麦状态
HttpClient.getInstance().get("live.getDrLm", "live.getDrLm")
.params("uid", mLiveUid, true)
.execute(new HttpCallback() {
HttpClient.getInstance().get("live.getDrLm", "live.getDrLm").params("uid", mLiveUid, true).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
@ -1285,31 +1209,20 @@ public class LiveAudienceActivity extends LiveActivity {
}
break;
case OPEN_PARAMETERS:
mDanmuPrice = TextUtils.equals(event.getParametersModel().getmDanmuPrice(), mDanmuPrice) ?
mDanmuPrice : event.getParametersModel().getmDanmuPrice();
mSocketUserType = TextUtils.equals(String.valueOf(mSocketUserType), String.valueOf(event.getParametersModel().getmSocketUserType())) ?
mSocketUserType : event.getParametersModel().getmSocketUserType();
mChatLevel = TextUtils.equals(String.valueOf(mChatLevel), String.valueOf(event.getParametersModel().getmChatLevel())) ?
mChatLevel : event.getParametersModel().getmChatLevel();
mDanMuLevel = TextUtils.equals(String.valueOf(mDanMuLevel), String.valueOf(event.getParametersModel().getmDanMuLevel())) ?
mDanMuLevel : event.getParametersModel().getmDanMuLevel();
mLiveType = TextUtils.equals(String.valueOf(mLiveType), String.valueOf(event.getParametersModel().getmLiveType())) ?
mLiveType : event.getParametersModel().getmLiveType();
mLiveTypeVal = TextUtils.equals(String.valueOf(mLiveTypeVal), String.valueOf(event.getParametersModel().getmLiveTypeVal())) ?
mLiveTypeVal : event.getParametersModel().getmLiveTypeVal();
mLiveGuardInfo = event.getParametersModel().getmLiveGuardInfo() == null ?
mLiveGuardInfo : event.getParametersModel().getmLiveGuardInfo();
liveBg = TextUtils.equals(String.valueOf(liveBg), String.valueOf(event.getParametersModel().getLiveBg())) ?
liveBg : event.getParametersModel().getLiveBg();
is_fans = TextUtils.equals(String.valueOf(is_fans), String.valueOf(event.getParametersModel().getIs_fans())) ?
is_fans : event.getParametersModel().getIs_fans();
fansNum = TextUtils.equals(String.valueOf(fansNum), String.valueOf(event.getParametersModel().getFansNum())) ?
fansNum : event.getParametersModel().getFansNum();
mDanmuPrice = TextUtils.equals(event.getParametersModel().getmDanmuPrice(), mDanmuPrice) ? mDanmuPrice : event.getParametersModel().getmDanmuPrice();
mSocketUserType = TextUtils.equals(String.valueOf(mSocketUserType), String.valueOf(event.getParametersModel().getmSocketUserType())) ? mSocketUserType : event.getParametersModel().getmSocketUserType();
mChatLevel = TextUtils.equals(String.valueOf(mChatLevel), String.valueOf(event.getParametersModel().getmChatLevel())) ? mChatLevel : event.getParametersModel().getmChatLevel();
mDanMuLevel = TextUtils.equals(String.valueOf(mDanMuLevel), String.valueOf(event.getParametersModel().getmDanMuLevel())) ? mDanMuLevel : event.getParametersModel().getmDanMuLevel();
mLiveType = TextUtils.equals(String.valueOf(mLiveType), String.valueOf(event.getParametersModel().getmLiveType())) ? mLiveType : event.getParametersModel().getmLiveType();
mLiveTypeVal = TextUtils.equals(String.valueOf(mLiveTypeVal), String.valueOf(event.getParametersModel().getmLiveTypeVal())) ? mLiveTypeVal : event.getParametersModel().getmLiveTypeVal();
mLiveGuardInfo = event.getParametersModel().getmLiveGuardInfo() == null ? mLiveGuardInfo : event.getParametersModel().getmLiveGuardInfo();
liveBg = TextUtils.equals(String.valueOf(liveBg), String.valueOf(event.getParametersModel().getLiveBg())) ? liveBg : event.getParametersModel().getLiveBg();
is_fans = TextUtils.equals(String.valueOf(is_fans), String.valueOf(event.getParametersModel().getIs_fans())) ? is_fans : event.getParametersModel().getIs_fans();
fansNum = TextUtils.equals(String.valueOf(fansNum), String.valueOf(event.getParametersModel().getFansNum())) ? fansNum : event.getParametersModel().getFansNum();
break;
case ACTIVITY_CENTER://活动中心
String url = CommonAppConfig.HOST + "/h5/live/hallOfFame/index.html?g=Appapi&m=Turntable&a=tricky";
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
Log.i("tag", url);
Intent intent = new Intent(mContext, ZhuangBanActivity.class);
intent.putExtra("url", url);
@ -1331,10 +1244,7 @@ public class LiveAudienceActivity extends LiveActivity {
break;
case POPULAR:
url = CommonAppConfig.HOST + "/h5/activity/PopularityTask/index.html";
url += "?anchorUid=" + mLiveUid
+ "&stream=" + mStream
+ "&uid=" + CommonAppConfig.getInstance().getUid()
+ "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
url += "?anchorUid=" + mLiveUid + "&stream=" + mStream + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
bundle.putString("url", url);
bundle.putInt("show_type", 0);
@ -1407,16 +1317,13 @@ public class LiveAudienceActivity extends LiveActivity {
}
if (micListener != null) {
micListener.updateMicList(mMicQueueList);
DialogUitl.showSimpleDialog(mContext,
String.format(mContext.getString(R.string.live_mic_user_apply), ((LinkMicUserBean) event.getObject()).getUserNicename()),
new DialogUitl.SimpleCallback() {
DialogUitl.showSimpleDialog(mContext, String.format(mContext.getString(R.string.live_mic_user_apply), ((LinkMicUserBean) event.getObject()).getUserNicename()), new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
openMicWindow(2);
dialog.dismiss();
}
}
);
});
}
break;
case LINK_MIC_CANCEL:
@ -1485,12 +1392,7 @@ public class LiveAudienceActivity extends LiveActivity {
showMsgRed(-1);
break;
case LIVE_SHARE:
new SharePopDialog(mContext)
.setUid(CommonAppConfig.getInstance().getUid())
.setAnchorId(event.getBean().getUid())
.setAnchorName(event.getBean().getUserNiceName())
.setAnchorAvatar(event.getBean().getAvatar())
.showDialog();
new SharePopDialog(mContext).setUid(CommonAppConfig.getInstance().getUid()).setAnchorId(event.getBean().getUid()).setAnchorName(event.getBean().getUserNiceName()).setAnchorAvatar(event.getBean().getAvatar()).showDialog();
break;
case WISH_LIST_PROGRESS:
if (manager != null) {
@ -1631,22 +1533,14 @@ public class LiveAudienceActivity extends LiveActivity {
if (type.equals(bean.getType())) {
switch (type) {
case "1":
startActivity(new Intent(mContext, SystemMessageActivity.class)
.putExtra("type", bean.getType())
.putExtra("uid", "")
.putExtra("title", bean.getTitle())
.putExtra("headImg", ""));
startActivity(new Intent(mContext, SystemMessageActivity.class).putExtra("type", bean.getType()).putExtra("uid", "").putExtra("title", bean.getTitle()).putExtra("headImg", ""));
break;
case "3":
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
if (bean.getLink() != null && !"".equals(bean.getLink())) {
WebViewActivity.forward(mContext, bean.getLink(), true);
} else {
startActivity(new Intent(mContext, SystemMessageActivity.class)
.putExtra("type", bean.getType())
.putExtra("uid", "")
.putExtra("title", "")
.putExtra("headImg", ""));
startActivity(new Intent(mContext, SystemMessageActivity.class).putExtra("type", bean.getType()).putExtra("uid", "").putExtra("title", "").putExtra("headImg", ""));
}
break;
@ -1676,8 +1570,7 @@ public class LiveAudienceActivity extends LiveActivity {
map.put("num", "9");
map.put("live_recommend", "sidebar");
//推荐位
MainNetManager.get(mContext)
.anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
MainNetManager.get(mContext).anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
list.clear();
@ -1765,11 +1658,7 @@ public class LiveAudienceActivity extends LiveActivity {
case 0:
if (liveSudGamePopupXPopup == null) {
liveSudGamePopupXPopup = new LiveSudGamePopup(mContext, event.getCreateSudRoomModel());
new XPopup.Builder(mContext)
.enableDrag(false)
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(liveSudGamePopupXPopup).show();
new XPopup.Builder(mContext).enableDrag(false).dismissOnTouchOutside(false).dismissOnBackPressed(false).asCustom(liveSudGamePopupXPopup).show();
} else {
if (liveSudGamePopupXPopup != null) {
liveSudGamePopupXPopup.dialog.show();
@ -1865,17 +1754,14 @@ public class LiveAudienceActivity extends LiveActivity {
if (!TextUtils.isEmpty(event.getRightsInterests())) {
//跳转贵族
if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.noble))) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.NOBLE));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.NOBLE));
//跳转守护
} else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.guard_guard))) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GUARD));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GUARD));
manager.onGuardRed();
//跳转粉丝团
} else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.fan_club))) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.FAN_CLUB));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.FAN_CLUB));
}
}
//互动游戏
@ -1885,12 +1771,10 @@ public class LiveAudienceActivity extends LiveActivity {
ToastUtil.show(WordUtil.isNewZh() ? "您已在游戏房间中" : "You are already in the game room");
} else {
//直播间来的
new XPopup.Builder(mContext)
.enableDrag(false)
new XPopup.Builder(mContext).enableDrag(false)
// .dismissOnTouchOutside(false)
// .dismissOnBackPressed(false)
.moveUpToKeyboard(false)
.asCustom(new SudGameListPopup(mContext, event.getInteractionID(), event.getChild(), mLiveUid))
.moveUpToKeyboard(false).asCustom(new SudGameListPopup(mContext, event.getInteractionID(), event.getChild(), mLiveUid))
.show();
}
@ -1948,9 +1832,7 @@ public class LiveAudienceActivity extends LiveActivity {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
new XPopup.Builder(mContext)
.asCustom(new DragonExpirePopup(mContext, mLiveUid, maturityDateRemindModel, mStream))
.show();
new XPopup.Builder(mContext).asCustom(new DragonExpirePopup(mContext, mLiveUid, maturityDateRemindModel, mStream)).show();
}
}, 3000);
@ -1997,8 +1879,7 @@ public class LiveAudienceActivity extends LiveActivity {
private void checkMsgRed() {
LiveNetManager.get(mContext)
.getContactMsg(1, new com.yunbao.common.http.base.HttpCallback<List<LiveUserMailBoxModel>>() {
LiveNetManager.get(mContext).getContactMsg(1, new com.yunbao.common.http.base.HttpCallback<List<LiveUserMailBoxModel>>() {
@Override
public void onSuccess(List<LiveUserMailBoxModel> data) {
Log.i(TAG, "onSuccess: " + data.size());

View File

@ -3,7 +3,6 @@ package com.yunbao.live.activity;
import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE;
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE;
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK_RANDOM;
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_dr_pk_nub;
@ -71,6 +70,7 @@ import com.yunbao.common.manager.IMRTCManager;
import com.yunbao.common.manager.MicUserManager;
import com.yunbao.common.manager.MicedUserManager;
import com.yunbao.common.manager.RandomPkManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.BitmapUtil;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DateFormatUtil;
@ -102,11 +102,12 @@ import com.yunbao.live.interfaces.LiveFunctionClickListener;
import com.yunbao.live.interfaces.LivePushListener;
import com.yunbao.live.music.LiveMusicDialogFragment;
import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveSwLinkMicPkPresenter;
import com.yunbao.live.socket.SocketRyChatUtil;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.views.LiveEndViewHolder;
import com.yunbao.live.views.LiveMusicViewHolder;
@ -193,7 +194,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
if (RandomPkManager.getInstance().isRankModel()) {
msg1.put("is_ladders", "https://downs.yaoulive.com/rank_top_box.png");
}
linkMicAnchorApply(pkUid, pkUid, true);
linkMicAnchorApply(pkUid, pkUid, msg1.toString());
}
@Override
@ -222,6 +223,27 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
Bus.getOn(this);
Intent intent = getIntent();
initFaceManager();
RCRTCEngine.getInstance().registerStatusReportListener(new IRCRTCStatusReportListener() {
@Override
public void onConnectionStats(StatusReport statusReport) {
//视频发送信息
for (Map.Entry<String, StatusBean> entry : statusReport.statusVideoSends.entrySet()) {
StatusBean statusBean = entry.getValue();
//获取userID
String userId = statusBean.uid;
//获取视频 宽x高@帧率
String resolution = statusBean.frameWidth + "x" + statusBean.frameHeight + "@" + statusBean.frameRate;
//获取码率
long bitRate = statusBean.bitRate;
//丢包率
long lossRate = statusBean.packetLostRate;
//带宽
String googAvailableSendBandwidth = statusReport.googAvailableSendBandwidth;
// Log.e("网速和内存", "获取视频:" + resolution + " 丢包率:" + lossRate + " 带宽:" + googAvailableSendBandwidth);
}
}
});
leave_img = findViewById(R.id.leave_img);
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
@ -251,13 +273,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
RandomPkManager.getInstance().addOnRandomPkTimer(onRandomPkTimer);
manager.setOnMirrorChanged(new FaceManager.OnMirrorChanged() {
@Override
public void onChange(boolean falg) {
mLivePushViewHolder.setEnableBeauty(falg);
}
});
//添加开播前设置控件
mLiveReadyViewHolder = new LiveNewReadyRyViewHolder(mContext, mContainer, mLiveSDK);
mLiveReadyViewHolder.setManager(manager);
@ -294,8 +309,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
private void initFaceManager() {
manager = new FaceManager();
manager.initFURender(mContext);
//暂时去掉
//manager.drawRongFrame(mContext);
manager.drawRongFrame(mContext);
}
public boolean isStartPreview() {
@ -406,7 +420,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
LiveRyLinkMicPkPresenter.mApplyUid = CommonAppConfig.getInstance().getUid();
btn_start_dr_pk.setVisibility(View.VISIBLE);
// dr_pk_view.setVisibility(View.VISIBLE);
final SocketSendBean msg1 = new SocketSendBean()
@ -419,7 +432,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
Message message = Message.obtain("g" + mLiveUid, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
@ -708,6 +721,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
fragment.show(getSupportFragmentManager(), "LiveLinkMicListDialogFragment");*/
FreePkDialogFragment fragment = new FreePkDialogFragment();
fragment.setDrPkNum(pk_nub);
fragment.setLiveUid(mLiveUid);
fragment.show(getSupportFragmentManager(), "LiveLinkMicListDialogFragment");
}
@ -725,6 +739,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
public void openRandomPkWindow() {
RandomPkDialogFragment fragment = new RandomPkDialogFragment();
Bundle bundle = new Bundle();
bundle.putBoolean("isSw",false);
fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "RandomPkDialogFragment");
}
@ -959,7 +974,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
JSONObject obj = JSON.parseObject(info[0]);
JSONObject datas = obj.getJSONObject("data");
try {
SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketRyClient);
SocketRyChatUtil.closeLive(datas.getString("votes"), datas.getString("length"), datas.getString("nums"), mLiveUid, mSocketSwClient);
} catch (Exception e) {
e.printStackTrace();
}
@ -1045,8 +1060,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLivePushViewHolder = null;
mLiveLinkMicPresenter = null;
//断开socket
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
if (mSocketSwClient != null) {
mSocketSwClient.disConnect();
}
super.release();
}
@ -1203,7 +1218,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
*/
public void linkMicAnchorApply(String pkUid, String stream) {
JSONObject msg1 = buildLinkMicJSON();
linkMicAnchorApply(pkUid, stream, false);
linkMicAnchorApply(pkUid, stream, msg1.toString());
}
public JSONObject buildLinkMicJSON() {
@ -1215,7 +1230,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
return msg1;
}
public void linkMicAnchorApply(final String pkUid, String stream, boolean extra) {
public void linkMicAnchorApply(final String pkUid, String stream, String extra) {
LiveHttpUtil.livePkCheckLive(pkUid, stream, mStream, new HttpCallback() {
@Override
@ -1224,46 +1239,38 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
JSONObject obj = JSON.parseObject(info[0]);
if (obj != null) {
if (obj.getString("ispk").equals("0")) {
final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LINK_MIC_PK)
.param("action", 1)
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
.param("pkuid", pkUid)
.param("uid", CommonAppConfig.getInstance().getUid())
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
//判断是否是随机PK
if(extra){
msg1.param("random_pk", "1");
msg1.param("msgtype","11");
if (RandomPkManager.getInstance().isRankModel()) {
msg1.param("is_ladders", "https://downs.yaoulive.com/rank_top_box.png");
}
}
msg1.create();
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain("g" + pkUid, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
IMRTCManager.getInstance().requestJoinOtherRoom(pkUid, true, extra, new IRCRTCResultCallback() {
@Override
public void onAttached(io.rong.imlib.model.Message message) {
}
public void onSuccess() {
// ToastUtil.show("邀请 " + pkUid + " 发送成功");
runOnUiThread(new Runnable() {
@Override
public void onSuccess(io.rong.imlib.model.Message message) {
Log.e("tx", "发送成功");
}
@Override
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
Log.e("tx", "发送失败" + errorCode.getMessage());
public void run() {
dismiss();
}
});
}
@Override
public void onFailed(RTCErrorCode rtcErrorCode) {
runOnUiThread(new Runnable() {
@Override
public void run() {
dismiss();
}
});
//todo 安卓端状态码说明文档https://docs.rongcloud.cn/v4/views/rtc/call/code/android.html
Log.e("ry", rtcErrorCode + "aaaaaa" + CommonAppConfig.getInstance().getUid() + "VDSSSS" + pkUid);
if (WordUtil.isNewZh()) {
ToastUtil.show("邀请 " + pkUid + " 发送失败 " + rtcErrorCode);
} else {
ToastUtil.show("invite " + pkUid + " failed:" + rtcErrorCode);
}
}
});
} else {
ToastUtil.show("主播正在PK稍後再試");
if (RandomPkManager.getInstance().isRandomModel()) {
@ -1289,6 +1296,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
if (mLiveAnchorViewHolder != null) {
mLiveAnchorViewHolder.setYaoqing(pkUid);
}
}
/**
@ -1308,39 +1316,34 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
if (obj != null) {
if (obj.getString("ispk").equals("0")) {
// TODO: 2024/4/19 邀请主播进行多人连麦
final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LIVE_DRPK)
.param("action", 1)
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
.param("pkuid", pkUid)
.param("uid", CommonAppConfig.getInstance().getUid())
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
msg1.create();
String targetId = "g" + pkUid;
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
IMRTCManager.getInstance().requestJoinOtherRoom(pkUid, true, extra, new IRCRTCResultCallback() {
@Override
public void onAttached(Message message) {
public void onSuccess() {
if (!extra.equals(SOCKET_LIVE_DRPK_RANDOM)) {
if (WordUtil.isNewZh()) {
ToastUtil.show("邀请 " + pkUid + " 发送成功");
} else {
ToastUtil.show("invite " + pkUid + " successful");
}
}
runOnUiThread(new Runnable() {
@Override
public void run() {
dismiss();
}
});
}
@Override
public void onSuccess(Message message) {
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(message.toString() + "");
}
}
public void onFailed(RTCErrorCode rtcErrorCode) {
runOnUiThread(new Runnable() {
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
Log.e("tx", "aaa" + errorCode.toString());
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
public void run() {
dismiss();
}
});
//todo 安卓端状态码说明文档https://docs.rongcloud.cn/v4/views/rtc/call/code/android.html
Log.e("ry", rtcErrorCode + "aaaaaa" + CommonAppConfig.getInstance().getUid() + "VDSSSS" + pkUid);
}
});
} else {
@ -1411,7 +1414,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
//多人PK接受
@Override
public void onLinkDRMicPkApplyOk(UserBean u) {
L.eSw("onLinkDRMicPkApplyOk111111");
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkDRMicPkApplyOk(u);
}
@ -1672,8 +1674,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
break;
case DISCONNEXT_PK_TIME:
if (mLivePushViewHolder != null) {
//mLivePushViewHolder.changeToBig();
mLivePushViewHolder.anchorClose();
mLivePushViewHolder.changeToBig();
mLiveRyLinkMicPkPresenter.leaveDRRoom();
}
break;
@ -1721,6 +1722,15 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
liveInputDialogFragment.setArguments(liveInputBundle);
liveInputDialogFragment.show(getSupportFragmentManager(), "LiveInputDialogFragment");
break;
case LIVE_DIALOG_ANCHOR_TIPS:
new DialogUitl.Builder(mContext)
.setContent(event.getObject().toString())
.setConfirmString(WordUtil.isNewZh() ? "確定" : "confirm")
.setCancelable(true)
.setShowCancelButton(false)
.build()
.show();
break;
}
}
@ -1859,6 +1869,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
.setIcon("https://downs.yaoulive.com/xzs_tab.png")
.setNameColor("#f19ec2")
.setSystemBubble("https://downs.yaoulive.com/xzs_qipao.9.png")
.setIconEn("https://downs.yaoulive.com/Robot_en.png")
.setUserName("")
.setContent(content);
SocketSendBean msg =
@ -1872,7 +1883,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
@ -1880,8 +1891,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
@Override
public void onSuccess(Message message) {
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}

File diff suppressed because it is too large Load Diff

View File

@ -213,7 +213,7 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
return;
}
String title = mEditTitle.getText().toString().trim();
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, null,0, new HttpCallback() {
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, null,0,false, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, final String[] info) {
if (code == 0 && info.length > 0) {

View File

@ -197,8 +197,8 @@ public class PDLIiveChatActivity extends FragmentActivity {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -172,7 +172,7 @@ public class WebViewActivityMedal extends AbsActivity {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}
@ -180,7 +180,7 @@ public class WebViewActivityMedal extends AbsActivity {
MicStatusManager.getInstance().showDownMicDialog(mContext);
return;
}
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
finish();
}

View File

@ -409,7 +409,7 @@ public class ZhuangBanActivity extends AbsActivity {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}
@ -426,7 +426,7 @@ public class ZhuangBanActivity extends AbsActivity {
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
finish();
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
}
finish();
}

View File

@ -21,7 +21,6 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.dialog.AbsDialogFragment;
@ -37,6 +36,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.utils.LiveTextRender;
import java.net.MalformedURLException;
@ -173,7 +173,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<UserBean> {
/**
* 发送IM消息
*
* @param action 4为同意请求1为邀请其余见 {@link com.yunbao.live.socket.SocketRyClient} Constants.LIAN_MAI解析
* @param action 4为同意请求1为邀请其余见 {@link SocketSwClient} Constants.LIAN_MAI解析
*/
void applyMic(UserBean bean, int action, SocketSendBean msg) {
msg.param("action", action);

View File

@ -22,6 +22,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import java.util.Arrays;
import java.util.HashMap;
@ -35,6 +36,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
private static final int ITEM = 2;
private int freePkNum;//PK次数
private int mDrPkNum = -1;//多人PK剩余次数-1则认为是单人PK
private String liveUid;
public void setFreePkNum(int freePkNum) {
this.freePkNum = freePkNum;
@ -48,6 +50,10 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
this.mDrPkNum = mDrPkNum;
}
public void setLiveUid(String liveUid) {
this.liveUid = liveUid;
}
@NonNull
@Override
public HeadViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -128,8 +134,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
ToastUtil.show(mContext.getString(R.string.free_pk_num_null));
// return;
}
LiveHttpUtil.getMicList(LiveRyAnchorActivity.mLiveUid, 0, new com.yunbao.common.http.HttpCallback() {
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));
@ -142,8 +147,14 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
ToastUtil.show("invite " + bean.getUserNiceName() + " successful");
}
mOnItemClickListener.onItemClick(bean, -1);
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
if(mContext instanceof LiveSwAnchorActivity){
((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
false);
}else{
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
);
}
return;
}
if (mDrPkNum <= 0) {
@ -156,7 +167,11 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
}
yaoqing.put(bean.getId(), bean.getId());
if (yaoqing.size() < 5) {
if(mContext instanceof LiveSwAnchorActivity){
((LiveSwAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
}else{
((LiveRyAnchorActivity) mContext).linkDrMicAnchorApply(bean.getId(), bean.getId());
}
} else {
ToastUtil.show(WordUtil.isNewZh() ? "多人PK最大參與人數為4人" : "The maximum number of participants in a multiplayer PK is 4 people");
}

View File

@ -13,7 +13,7 @@ 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.activity.LiveSwAnchorActivity;
import com.yunbao.live.bean.LiveFunctionBean;
import java.util.ArrayList;
@ -38,11 +38,10 @@ public class LiveFunctionAdapter extends RecyclerView.Adapter<LiveFunctionAdapte
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_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));
if (!(context instanceof LiveRyAnchorActivity)) {
if (!(context instanceof LiveSwAnchorActivity)) {
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_MIC, R.mipmap.icon_microphone, R.string.live_mic));
}
if (leave == 0) {
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave, R.string.live_zslk));
} else {

View File

@ -58,6 +58,8 @@ public class LiveChatBean {
private String giftname_en;
private String toUid;
private String medal_new_en;
public int getNORMAL() {
return NORMAL;
}
@ -206,6 +208,14 @@ public class LiveChatBean {
return this;
}
public String getMedal_new_en() {
return medal_new_en;
}
public void setMedal_new_en(String medal_new_en) {
this.medal_new_en = medal_new_en;
}
public String getHot_card() {
return hot_card;
}

View File

@ -58,6 +58,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
private DataHelper helper;
private int tabStatus;
private int mDrPkNum = -1;//多人PK剩余次数-1时认为是单人PK
private String liveUid;
@Override
@ -102,6 +103,10 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
this.mDrPkNum = mDrPkNum;
}
public void setLiveUid(String liveUid) {
this.liveUid = liveUid;
}
private void initView() {
tabLayout = (TabLayout) findViewById(R.id.menu_tab);
reset = findViewById(R.id.menu_reset);
@ -152,6 +157,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
mRecyclerView.setRefreshEnable(false);
mRecyclerView.setEmptyLayoutId(R.layout.view_live_search_list_empty);
adapter.setDrPkNum(mDrPkNum);
adapter.setLiveUid(liveUid);
adapter.setFreePkRecyclerListener(new FreePkRecyclerAdapter.FreePkRecyclerListener() {
@Override
public void onClose() {

View File

@ -32,10 +32,8 @@ import com.xw.repo.BubbleSeekBar;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.adapter.BeautyAdapter;
import com.yunbao.live.bean.BeautyFaceBean;

View File

@ -12,8 +12,7 @@ import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.adapter.LiveFunctionAdapter;
import com.yunbao.live.interfaces.LiveFunctionClickListener;
@ -88,7 +87,7 @@ public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnI
// if(isRy == false) {
// ((LiveAnchorActivity) mContext).setBtnFunctionDark();
// }else{
((LiveRyAnchorActivity) mContext).setBtnFunctionDark();
((LiveSwAnchorActivity) mContext).setBtnFunctionDark();
// }
super.onDestroy();
}

View File

@ -46,7 +46,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -326,8 +326,8 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override
@ -388,7 +388,7 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
onTrickerySendGiftInto(new JsWishBean(event.getData()));
}
} else if (TextUtils.equals(event.getMethod(), "androidMethodClickUser")) {
if (!(mContext instanceof LiveRyAnchorActivity)) {
if (!(mContext instanceof LiveSwAnchorActivity)) {
//点击用户头像
if (!TextUtils.isEmpty(event.getUserId()) && !TextUtils.isEmpty(event.getLiveId())) {
showUserDialog(event.getUserId(), event.getLiveId());
@ -404,7 +404,7 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
} else if (TextUtils.equals(event.getMethod(), "androidGoBack")) {
dismiss();
} else if (TextUtils.equals(event.getMethod(), "androidMethodLookToLive")) {
if (mContext instanceof LiveRyAnchorActivity) {
if (mContext instanceof LiveSwAnchorActivity) {
return;
}
if (TextUtils.equals(roomId, event.getLiveId())) {

View File

@ -49,7 +49,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.http.LiveHttpUtil;
@ -249,7 +249,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}
@ -329,7 +329,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
}
} else if (TextUtils.equals(event.getMethod(), "androidMethodClickUser")) {
//点击用户头像
if (!(mContext instanceof LiveRyAnchorActivity)) {
if (!(mContext instanceof LiveSwAnchorActivity)) {
//点击用户头像
if (!TextUtils.isEmpty(event.getUserId()) && !TextUtils.isEmpty(event.getLiveId())) {
showUserDialog(event.getUserId(), event.getLiveId());
@ -346,7 +346,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
} else if (TextUtils.equals(event.getMethod(), "androidGoBack")) {
dismiss();
} else if (TextUtils.equals(event.getMethod(), "androidMethodLookToLive")) {
if (mContext instanceof LiveRyAnchorActivity) {
if (mContext instanceof LiveSwAnchorActivity) {
return;
}
if (TextUtils.equals(roomId, event.getLiveId())) {

View File

@ -45,7 +45,7 @@ import com.yunbao.common.views.weight.AtTextWatcher;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.views.OlineListActivity;
import org.greenrobot.eventbus.Subscribe;
@ -119,7 +119,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
RadioButton radioButton = mRootView.findViewById(id);
radioHornTypes.add(radioButton);
}
if (mContext instanceof LiveRyAnchorActivity) {
if (mContext instanceof LiveSwAnchorActivity) {
findViewById(R.id.btn_2).setVisibility(View.GONE);
findViewById(R.id.btn_1).setVisibility(View.GONE);
} else {

View File

@ -31,6 +31,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.adapter.LivePkAdapter;
import com.yunbao.live.bean.LivePkBean;
import com.yunbao.live.event.LiveAudienceEvent;
@ -351,20 +352,25 @@ public class LiveLinkMicListDialogFragment extends AbsDialogFragment implements
.setType(LiveAudienceEvent.LiveAudienceType.UN_LEAVELIVE));
if(bundle.getBoolean("isDRPK", false) == true) {
// ToastUtil.show("多人");
if(mContext instanceof LiveSwAnchorActivity){
((LiveSwAnchorActivity) mContext).linkDrMicAnchorApply(bean.getUid(), bean.getStream());
}else{
((LiveRyAnchorActivity) mContext).linkDrMicAnchorApply(bean.getUid(), bean.getStream());
}
}else {
// ToastUtil.show("单人");
if(mContext instanceof LiveSwAnchorActivity){
((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getUid(), bean.getStream());
}else{
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getUid(), bean.getStream());
}
}
}else{
((LiveAnchorActivity) mContext).linkMicAnchorApply(bean.getUid(), bean.getStream());
if(mContext instanceof LiveSwAnchorActivity){
((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getUid(), bean.getStream());
}else{
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getUid(), bean.getStream());
}
}
dismiss();
}

View File

@ -26,16 +26,19 @@ import android.widget.TextView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.dialog.SudGameListPopup;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.LiveAnchorMessageCustomPopup;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.interfaces.LiveFunctionClickListener;
import java.util.List;
@ -149,7 +152,11 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
// if(isRy == false) {
// ((LiveAnchorActivity) mContext).setBtnFunctionDark();
// }else{
if (mContext instanceof LiveSwAnchorActivity) {
((LiveSwAnchorActivity) mContext).setBtnFunctionDark();
} else {
((LiveRyAnchorActivity) mContext).setBtnFunctionDark();
}
// }
super.onDestroy();
}
@ -170,7 +177,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
mFunctionClickListener.onClick(LIVE_FUNC_CAMERA);
} else if (id == R.id.live_tool_leave) {
if (isPk) {
ToastUtil.show(WordUtil.isNewZh()?"PK中禁止离开":"Do not leave in PK");
ToastUtil.show(WordUtil.isNewZh() ? "PK中禁止离开" : "Do not leave in PK");
return;
}
mFunctionClickListener.onClick(LIVE_FUNC_ZSLK);
@ -186,9 +193,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
mFunctionClickListener.onClick(LIVE_ROBOT);
dismiss();
} else if (id == R.id.message_linear) {
new XPopup.Builder(getContext())
.asCustom(new LiveAnchorMessageCustomPopup(getContext(), liveUid))
.show();
new XPopup.Builder(getContext()).asCustom(new LiveAnchorMessageCustomPopup(getContext(), liveUid)).show();
dismiss();
} else if (id == R.id.broadcast_data) {
//主播数据
@ -204,21 +209,31 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
} else if (id == R.id.live_tool_call_me) {
new LiveAnchorEditCallMeDialog(mContext).setLiveUid(liveUid).showDialog();
} else if (id == R.id.live_tool_anchor_say) {
new LiveAnchorSayPopDialog(mContext).setLiveUid(liveUid).setOnItemClickListener((bean, position)
-> mLiveRoomHandler.postDelayed(() -> ((LiveRyAnchorActivity) (mContext)).mLiveRoomViewHolder.initAnchorSayData(), 1000)).showDialog();
new LiveAnchorSayPopDialog(mContext).setLiveUid(liveUid).setOnItemClickListener(new OnItemClickListener<LiveAnchorSayModel>() {
@Override
public void onItemClick(LiveAnchorSayModel bean, int position) {
mLiveRoomHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (mContext instanceof LiveSwAnchorActivity) {
((LiveSwAnchorActivity) (mContext)).mLiveRoomViewHolder.initAnchorSayData();
} else {
((LiveRyAnchorActivity) (mContext)).mLiveRoomViewHolder.initAnchorSayData();
}
}
}, 1000);
}
}).showDialog();
} else if (id == R.id.live_tool_qa) {
new LiveAnchorCreateQADialog(mContext).setLiveUid(liveUid).showDialog();
} else if (id == R.id.live_tool_game) {
LiveNetManager.get(mContext)
.getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
LiveNetManager.get(mContext).getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
@Override
public void onSuccess(List<CustomSidebarInfoModel> data) {
for (CustomSidebarInfoModel datum : data) {
if (datum.getType().equals("6")) {
//直播间来的
new XPopup.Builder(mContext)
.enableDrag(false)
.moveUpToKeyboard(false)
new XPopup.Builder(mContext).enableDrag(false).moveUpToKeyboard(false)
// .dismissOnTouchOutside(false)
// .dismissOnBackPressed(false)
.asCustom(new SudGameListPopup(mContext, 0, datum.getChild(), liveUid))

View File

@ -42,7 +42,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.adapter.GuardRightAdapter;
import com.yunbao.live.adapter.LiveNewGuardBuyItemsAdapter;
import com.yunbao.live.bean.GuardBuyBean;
@ -305,7 +305,7 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
private void gotoBack() {
dismiss();
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveSwAnchorActivity);
}
/**

View File

@ -25,7 +25,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.adapter.LiveNewWishListAdapter;
import com.yunbao.live.bean.LiveWishlistBean;
import com.yunbao.live.event.LiveAudienceEvent;
@ -119,7 +119,7 @@ public class LiveNewWishListDialogFragment extends AbsDialogFragment implements
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
ToastUtil.show(WordUtil.isNewZh() ? "修改成功" : "Success");
dismiss();
} else {
ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg));
@ -178,17 +178,16 @@ public class LiveNewWishListDialogFragment extends AbsDialogFragment implements
}
/**
* 心愿单打开礼物窗口
*/
public void openGiftWindow() {
LiveGiftDialogFragment4Wishlist fragment = new LiveGiftDialogFragment4Wishlist();
Log.e("ry",getTag());
if(getTag().equals("TX")) {
Log.e("ry", getTag());
if (mContext instanceof LiveSwAnchorActivity) {
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
} else {
fragment.show(((LiveAnchorActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}else{
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}
}

View File

@ -145,7 +145,7 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}

View File

@ -52,7 +52,7 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveReportActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.utils.LiveTextRender;
@ -663,7 +663,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}
@ -722,7 +722,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else if (i == R.id.btn_guard) {
if (TextUtils.equals(mLiveUid, "uid")) return;
MobclickAgent.onEvent(mContext, "anchor_avatar_guard", "守护按钮");
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity, mToUid);
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveSwAnchorActivity, mToUid);
} else if (i == R.id.btn_live) {
gotoLive(mToUid);
} else if (i == R.id.noble_icon_layout) {

View File

@ -36,7 +36,7 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.adapter.UserMoreInfoAdapter;
import com.yunbao.live.bean.LiveGuardInfo;
import com.yunbao.common.http.LiveHttpUtil;
@ -144,7 +144,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
((LiveActivity) mContext).openLuckGiftTip();
} else if (Tips.equals("2")) {
dismiss();
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveSwAnchorActivity);
} else if (Tips.equals("3")) {
dismiss();
((LiveActivity) mContext).openFansWindow();

View File

@ -22,6 +22,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.adapter.LiveWishListAdapter;
import com.yunbao.live.bean.LiveWishlistBean;
import com.yunbao.common.http.LiveHttpConsts;
@ -192,8 +193,8 @@ public class LiveWishListDialogFragment extends AbsDialogFragment implements OnI
public void openGiftWindow() {
LiveGiftDialogFragment4Wishlist fragment = new LiveGiftDialogFragment4Wishlist();
Log.e("ry",getTag());
if(getTag().equals("TX")) {
fragment.show(((LiveAnchorActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
if(mContext instanceof LiveSwAnchorActivity){
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}else{
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}

View File

@ -23,6 +23,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.common.manager.RandomPkManager;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.common.http.LiveHttpUtil;
import java.util.Arrays;
@ -36,6 +37,7 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
private TextView mPkBtnTitle;
private TextView mPkBtnDesc;
private ImageView mRandomPkSwitch;
private boolean isSw ;
private final RandomPkManager.OnRandomPkTimer randomPkTimer = new RandomPkManager.OnRandomPkTimer() {
@ -124,6 +126,7 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
isSw = getArguments().getBoolean("isSw");
initView();
initData();
RandomPkManager.debugUid = null;
@ -260,14 +263,13 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
} else {
ToastUtil.show("The random PK switch is not enabled");
}
return;
}
if ((mPkBtn.getTag() != null && (boolean) mPkBtn.getTag()) || RandomPkManager.getInstance().isRequestPk()) {
RandomPkManager.getInstance().exitPk();
return;
}
LiveHttpUtil.getMicList(LiveRyAnchorActivity.mLiveUid, 0, new HttpCallback() {
LiveHttpUtil.getMicList(isSw?LiveSwAnchorActivity.mLiveUid: LiveRyAnchorActivity.mLiveUid, 0, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info));

View File

@ -489,7 +489,8 @@ public class LiveAudienceEvent extends BaseModel {
UPDATE_FANS_TASK_STATUS(74, "更新粉丝任务状态"),
SUD_GAME_CREATE_ROOM(75, "主播创建sud游戏"),
PK_RANK_START(76, "PK排位赛开始"),
GuardSpecialEffect(77, "PK排位赛开始");
GuardSpecialEffect(77, "PK排位赛开始"),
LIVE_DIALOG_ANCHOR_TIPS(78, "主播公会赛tips");
private int type;
private String name;

View File

@ -452,7 +452,7 @@ public class LiveGiftAnimPresenter {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ import io.rong.message.TextMessage;
public class SocketRyChatUtil {
//关闭直播
public static void closeLive(final String votes, final String length, final String nums, final String mLiveUid, SocketRyClient client) {
public static void closeLive(final String votes, final String length, final String nums, final String mLiveUid, SocketSwClient client) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_LIVE_END)
@ -64,8 +64,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null)
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null)
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
@Override
@ -128,8 +128,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
LiveNetManager.get(CommonAppContext.sInstance)
.addChatCount(LiveActivity.mStream, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
@ -212,11 +212,10 @@ public class SocketRyChatUtil {
if (code == 0) {
EventBus.getDefault().post("stop_svga_new_user_double1");
}
}
});
if (SocketRyClient.mSocketHandler != null)
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null)
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
@Override
@ -264,8 +263,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@ -401,8 +400,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@ -471,8 +470,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@ -518,8 +517,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@ -555,8 +554,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@ -598,8 +597,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null)
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null)
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
@Override
@ -635,8 +634,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@ -675,8 +674,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}
@ -779,8 +778,8 @@ public class SocketRyChatUtil {
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
if (SocketRyClient.mSocketHandler != null) {
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
if (SocketSwClient.mSocketHandler != null) {
SocketSwClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
}
}

View File

@ -2,10 +2,7 @@ package com.yunbao.live.socket;
import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
import static com.blankj.utilcode.util.ViewUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER;
import static com.yunbao.common.Constants.isAnchor;
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot;
@ -22,7 +19,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils;
import com.google.gson.Gson;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
@ -30,7 +26,6 @@ import com.yunbao.common.bean.AiAutomaticSpeechModel;
import com.yunbao.common.bean.FansModel;
import com.yunbao.common.bean.GuardMaturityDateRemindModel;
import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.PkRankBean;
@ -51,7 +46,6 @@ import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.event.SendMoneyLongEndEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMRTCManager;
import com.yunbao.common.manager.MicUserManager;
import com.yunbao.common.manager.MicedUserManager;
@ -59,7 +53,6 @@ import com.yunbao.common.manager.NewLevelManager;
import com.yunbao.common.manager.RandomPkManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
@ -80,7 +73,7 @@ import com.yunbao.live.event.LiveAnchorEvent;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.views.LiveEndViewHolder;
import com.yunbao.live.views.LivePlayKsyViewHolder;
import com.yunbao.live.views.LivePlayRyViewHolder;
import com.yunbao.live.views.LivePlaySwViewHolder;
import com.yunbao.live.views.LivePushRyViewHolder;
import com.yunbao.live.views.LiveRoomViewHolder;
@ -92,26 +85,21 @@ import java.util.List;
import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.base.RTCErrorCode;
import io.agora.beautyapi.faceunity.agora.SWManager;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.IRongCoreCallback;
import io.rong.imlib.IRongCoreEnum;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.chatroom.base.RongChatRoomClient;
import io.rong.imlib.model.Conversation;
import io.rong.message.TextMessage;
public class SocketRyClient {
private final String TAG = "socket";
private String mLiveUid;
private String mStream;
public static SocketRyClient.SocketHandler mSocketHandler;
public static SocketHandler mSocketHandler;
private Context mContext;
public SocketRyClient(String mLiveUid, SocketMessageListener listener, Activity mContext) {
this.mContext = mContext;
mSocketHandler = new SocketRyClient.SocketHandler(listener);
mSocketHandler = new SocketHandler(listener);
mSocketHandler.setLiveUid(mLiveUid);
RongChatRoomClient.getInstance().joinChatRoom("g" + mLiveUid, -1, new IRongCoreCallback.OperationCallback() {
@Override
@ -208,7 +196,6 @@ public class SocketRyClient {
//用户连麦
case Constants.LIAN_MAI:
int actions = map.getIntValue("action");
L.eSw("用户连麦:actions"+actions);
//主播邀请用户连麦消息
if (actions == 1) {
EventBus.getDefault().post("inviteMic");
@ -217,7 +204,10 @@ public class SocketRyClient {
EventBus.getDefault().post("UsertoRY");
} else if (actions == 5) {
JSONObject mic_data = map.getJSONObject("ct");
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_MIC_LIST).setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_MIC_LIST)
.setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class))
);
MicedUserManager.get().upDataMicUserList(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class));
} else if (actions == 6) {
if (WordUtil.isNewZh()) {
@ -226,9 +216,10 @@ public class SocketRyClient {
ToastUtil.show("The host has disabled the voice connection function");
}
EventBus.getDefault().post("endMic");
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CLOSE).setObject(map.toJavaObject(LinkMicUserBean.class)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CLOSE)
.setObject(map.toJavaObject(LinkMicUserBean.class)));
} else if (actions == 8) {
//提下買退出
if (WordUtil.isNewZh()) {
ToastUtil.show("您已被移出多人語音連麥");
} else {
@ -236,16 +227,24 @@ public class SocketRyClient {
}
EventBus.getDefault().post("endMic");
} else if (actions == 3) {
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC).setObject(map.toJavaObject(LinkMicUserBean.class)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC)
.setObject(map.toJavaObject(LinkMicUserBean.class))
);
MicUserManager.get().upDataMicUser(map);
} else if (actions == 7) {//取消连麦
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CANCEL));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CANCEL)
);
MicUserManager.get().removeMiscUser(map);
}
break;
case Constants.UP_USER_LIST:
mListener.onUpUserList(map.getJSONObject("ct"));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_AUDIENCE_LIST).setObject(JSON.parseArray(map.getJSONObject("ct").getString("userlist"), LiveUserGiftBean.class)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_AUDIENCE_LIST)
.setObject(JSON.parseArray(map.getJSONObject("ct").getString("userlist"), LiveUserGiftBean.class))
);
break;
case Constants.CARD:
// LiveLinkMicPresenter.setHD(map.getString("ct"));
@ -264,7 +263,9 @@ public class SocketRyClient {
} else {
if (!WordUtil.isNewZh() && map.getString("ct").contains("退出比賽") && map.getString("ct").contains("獲得勝利")) {
String ctTmp = map.getString("ct");
ctTmp = ctTmp.replace("由於", "Due to").replace("退出比賽", "withdrawing from the competition").replace("獲得勝利", "won");
ctTmp = ctTmp.replace("由於", "Due to")
.replace("退出比賽", "withdrawing from the competition")
.replace("獲得勝利", "won");
map.put("ct", ctTmp);
}
systemChatMessage2(map.getString("ct"));
@ -276,15 +277,15 @@ public class SocketRyClient {
if (LivePlayKsyViewHolder.leave != null) {
LivePlayKsyViewHolder.leave.setVisibility(View.VISIBLE);
}
if (LivePlayRyViewHolder.leave != null) {
LivePlayRyViewHolder.leave.setVisibility(View.VISIBLE);
if (LivePlaySwViewHolder.leave != null) {
LivePlaySwViewHolder.leave.setVisibility(View.VISIBLE);
}
} else if (action21 == 13 && map.getString("ct").contains("回來")) {
if (LivePlayKsyViewHolder.leave != null) {
LivePlayKsyViewHolder.leave.setVisibility(View.GONE);
}
if (LivePlayRyViewHolder.leave != null) {
LivePlayRyViewHolder.leave.setVisibility(View.GONE);
if (LivePlaySwViewHolder.leave != null) {
LivePlaySwViewHolder.leave.setVisibility(View.GONE);
}
}
break;
@ -313,7 +314,6 @@ public class SocketRyClient {
// break;
case Constants.SOCKET_LIVE_DRPK_RANDOM:
case Constants.SOCKET_LIVE_DRPK://多人PK
L.eSw("map"+new Gson().toJson(map));
int action3 = map.getIntValue("action");
//收到多人PK邀请
if (action3 == 1) {
@ -324,65 +324,59 @@ public class SocketRyClient {
}
//收到对方同意多人PK邀请
else if (action3 == 2) {
if("0".equals(map.getString("msgtype"))){
return;
}
UserBean u = new UserBean();
// u.setUserNiceName(map.getString("uname"));
u.setId(map.getString("pkuid"));
L.eSw("action3 == 2:"+u.getId());
L.eSw("收到对方同意多人PK邀请");
mListener.onLinkDRMicPkApplyOk(u);
SWManager.get().setDimensions(3);//退出直播间将分别率设置为 VD_840x480
// UserBean u = new UserBean();
//// u.setUserNiceName(map.getString("uname"));
// u.setId(map.getString("uid"));
// mListener.onLinkDRMicPkApplyOk(u);
} else if (action3 == 6) {//开始Pk
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
}
// LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, map.getIntValue("drpk_time"));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LEAVE_PK_SCORE).setPkScores(map.getJSONArray("userlist")).setUid(mLiveUid).setTime(map.getIntValue("drpk_time")));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LEAVE_PK_SCORE)
.setPkScores(map.getJSONArray("userlist"))
.setUid(mLiveUid)
.setTime(map.getIntValue("drpk_time")));
if (livePushRyViewHolder == null) {
// LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW)
);
}
} else if (action3 == 5) {
// endDRGif();
LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE);
if (LiveRyAnchorActivity.mLiveAnchorViewHolder != null) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
params.topMargin = 0;
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LEAVE_DR_ROOM));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LEAVE_DR_ROOM));
isDRPK = 0;
} else {
// LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview();
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_END_VIEW));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_END_VIEW)
);
}
SWManager.get().setDimensions(0);//退出直播间将分别率设置为 VD_840x480
//創建了多人房間
} else if (action3 == 3) {
L.eSw("創建了多人房間action3 == 3");
/* if (LiveAudienceActivity.getmLivePlayViewHolder() != null) {
LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
}*/
if(livePushRyViewHolder==null){
if("4".equals(map.getString("msgtype"))){
return;
}
UserBean u = new UserBean();
// u.setUserNiceName(map.getString("uname"));
u.setId(map.getString("uid"));
if(StringUtil.isEmpty(u.getId())){
return;
}
L.eSw("通知用户 action3 == 3:"+u.getId());
mListener.onLinkDRMicPKToUser(u);
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW)
);
isDRPK = 1;
}
} else if (action3 == 10) {
//显示pk分数
if (!map.getString("uid").equals(CommonAppConfig.getInstance().getUid())) {
// LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW)
);
}
}
@ -395,7 +389,7 @@ public class SocketRyClient {
receiveGiftBean.setSendtype(map.getIntValue("action"));
receiveGiftBean.setAllServerNotify(true);
mListener.onSys(receiveGiftBean);
} else if (action2 == 61) {//赠送礼物
} else if (action2 == 61) {//赠送礼物 超级头条
sendGiftByNotify(map);
} else if (action2 == 62) {//购买守护
// buyGuardByNotify(map);
@ -408,7 +402,7 @@ public class SocketRyClient {
buyZuoJiByNotify(map);
} else if (action2 == 66) {//购买贵族
buyVipByNotify(map);
} else if (action2 == 88) {
} else if (action2 == 88) {//盲盒
JSONObject mCt = map.getJSONObject("ct");
String boxType = map.getString("box_type");
String boxTypeName = "";
@ -419,19 +413,39 @@ public class SocketRyClient {
} else {
boxTypeName = WordUtil.isNewZh() ? "PD盲盒" : "PD blind box";
}
AllServerNotifyEvent allServerNotifyEvent = new AllServerNotifyEvent().setBlindBoxId(map.getString("blind_box_id")).setBoxType(boxType).setBoxTypeName(boxTypeName).setDressName(WordUtil.isNewZh() ? map.getString("dress_name") : TextUtils.isEmpty(map.getString("dress_nameen")) ? map.getString("dress_name") : map.getString("dress_nameen")).setGiftNotification(map.getString("gift_notification")).setGiftName(WordUtil.isNewZh() ? mCt.getString("giftname") : mCt.getString("giftnameen")).setUserNiceName(map.getString("uname")).setGiftIcon(map.getString("gifticon")).setAnchorName(map.getString("ancherName")).setDisplaySrc(map.getString("display_src"));
AllServerNotifyEvent allServerNotifyEvent
= new AllServerNotifyEvent()
.setBlindBoxId(map.getString("blind_box_id"))
.setBoxType(boxType)
.setBoxTypeName(boxTypeName)
.setDressName(WordUtil.isNewZh() ? map.getString("dress_name") : TextUtils.isEmpty(map.getString("dress_nameen")) ? map.getString("dress_name") : map.getString("dress_nameen"))
.setGiftNotification(map.getString("gift_notification"))
.setGiftName(WordUtil.isNewZh() ? mCt.getString("giftname") : mCt.getString("giftnameen"))
.setUserNiceName(map.getString("uname"))
.setGiftIcon(map.getString("gifticon"))
.setAnchorName(map.getString("ancherName"))
.setDisplaySrc(map.getString("display_src"));
Log.e("AllServerNotifyEvent", allServerNotifyEvent.toString());
Log.e("AllServerNotifyEvent", map.toJSONString());
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.BLIND_BOX).setAllServerNotifyEvent(allServerNotifyEvent));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.BLIND_BOX)
.setAllServerNotifyEvent(allServerNotifyEvent));
} else if (action2 == 89) {//红包
JSONObject mCt = map.getJSONObject("ct");
AllServerNotifyEvent allServerNotifyEvent = new AllServerNotifyEvent().setUserNiceName(mCt.getString("user_nicename")).setGiftName(WordUtil.isNewZh() ? map.getString("giftname") : map.getString("giftname_en")).setGiftIcon(mCt.getString("gifticon")).setRedPacket(true);
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.BLIND_BOX).setAllServerNotifyEvent(allServerNotifyEvent));
AllServerNotifyEvent allServerNotifyEvent
= new AllServerNotifyEvent()
.setUserNiceName(mCt.getString("user_nicename"))
.setGiftName(WordUtil.isNewZh() ? map.getString("giftname") : map.getString("giftname_en"))
.setGiftIcon(mCt.getString("gifticon"))
.setRedPacket(true);
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.BLIND_BOX)
.setAllServerNotifyEvent(allServerNotifyEvent));
} else if (action2 == 90) {
NewAllServerNotifyGuardEvent notifyGuardEvent = GsonUtils.fromJson(map.toString(), NewAllServerNotifyGuardEvent.class);
Bus.get().post(notifyGuardEvent);
buyGuardInSameRoom(map);
} else if (action2 == 91) {
} else if (action2 == 91) {//通用模板
AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent = GsonUtils.fromJson(map.toString(), AllServerNotifyFFGGGDJANEvent.class);
Bus.get().post(notifyFFGGGDJANEvent);
}
@ -459,7 +473,12 @@ public class SocketRyClient {
mListener.onAnchorInvalid();
}
//主播强制下播
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_END).setVotes(map.getString("votes")).setLength(map.getString("length")).setNums(map.getIntValue("nums")).setUname(map.getString("uname")));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_END)
.setVotes(map.getString("votes"))
.setLength(map.getString("length"))
.setNums(map.getIntValue("nums"))
.setUname(map.getString("uname")));
break;
case Constants.SOCKET_CHANGE_LIVE://主播切换计时收费类型
mListener.onChangeTimeCharge(map.getIntValue("type_val"));
@ -484,7 +503,7 @@ public class SocketRyClient {
case Constants.SOCKET_BUY_GUARD://购买守护
buyGuardInSameRoom(map);
break;
case Constants.SOCKET_LINK_MIC://连麦-old
case Constants.SOCKET_LINK_MIC://连麦
processLinkMic(map);
break;
case Constants.SOCKET_LINK_MIC_ANCHOR://主播连麦
@ -600,7 +619,9 @@ public class SocketRyClient {
List<MsgModel> msg = model.getMsg();
if (msg.size() > 0) {
// EventBus.getDefault().post(msg.get(0));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.TRUMPET_NOTIFY).setMsgModel(msg.get(0)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.TRUMPET_NOTIFY)
.setMsgModel(msg.get(0)));
}
break;
case Constants.RECOMMEND_CARD_NOTIFY://推荐卡消息通知
@ -608,7 +629,9 @@ public class SocketRyClient {
List<MsgModel> recommendCardNotifyMsg = recommendCardNotifyModel.getMsg();
if (recommendCardNotifyMsg.size() > 0) {
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.RECOMMEND_CARD_NOTIFY).setMsgModel(recommendCardNotifyMsg.get(0)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.RECOMMEND_CARD_NOTIFY)
.setMsgModel(recommendCardNotifyMsg.get(0)));
}
break;
case Constants.STAR_CHALLENGE_UPDATE://星级助力
@ -625,21 +648,29 @@ public class SocketRyClient {
case Constants.AI_AUTOMATIC_SPEECH_LIVE:
//{"name_color":"#f19ec2","ai_name":"助手小小P","content":"@1 ","user_name":"1","icon":"https://downs.yaoulive.com/xzs_tab.png","system_bubble":"https://downs.yaoulive.com/xzs_qipao.9.png"}
AiAutomaticSpeechModel aiAutomaticSpeechModel = GsonUtils.fromJson(map.getString("ct"), AiAutomaticSpeechModel.class);
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.AI_AUTOMATIC_SPEECH).setAiAutomaticSpeechModel(aiAutomaticSpeechModel));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.AI_AUTOMATIC_SPEECH)
.setAiAutomaticSpeechModel(aiAutomaticSpeechModel));
break;
case Constants.STAR_CHALLENGE_UPGRADE_NOTIFY:
SocketModel starChallengeUpgradeNotify = GsonUtils.fromJson(socketMsg, SocketModel.class);
List<MsgModel> starChallengeUpgradeNotifyMsg = starChallengeUpgradeNotify.getMsg();
if (starChallengeUpgradeNotifyMsg.size() > 0) {
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.STAR_CHALLENGE_UPGRADE_NOTIFY).setMsgModel(starChallengeUpgradeNotifyMsg.get(0)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.STAR_CHALLENGE_UPGRADE_NOTIFY)
.setMsgModel(starChallengeUpgradeNotifyMsg.get(0)));
}
break;
case Constants.LuckyAngel:
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LUCKY_ANGEL).setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LUCKY_ANGEL)
.setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class)));
break;
case Constants.Lucky100Check:
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LUCKY_100_CHECK).setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LUCKY_100_CHECK)
.setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class)));
break;
case Constants.PK_RANK_UPDATE:
Log.i("PK排位", map.toString());
@ -649,68 +680,117 @@ public class SocketRyClient {
pkRankBean.setName(item.getString("new_rank_name"));
pkRankBean.setImg(item.getString("new_rank_img"));
pkRankBean.setNewRankNameEn(item.getString("new_rank_name_en"));
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_UPDATE).setObject(pkRankBean));
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_UPDATE)
.setObject(pkRankBean));
break;
case Constants.CUSTOM_FULL_SERVICE_NOTIFY:
Log.e("全服通知", map.toString());
CustomFullServiceNotifyEvent customFullServiceNotifyEvent = GsonUtils.fromJson(map.toString(), CustomFullServiceNotifyEvent.class);
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.CUSTOM_FULL_SERVICE_NOTIFY).setCustomFullServiceNotifyEvent(customFullServiceNotifyEvent));
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.CUSTOM_FULL_SERVICE_NOTIFY)
.setCustomFullServiceNotifyEvent(customFullServiceNotifyEvent));
break;
case Constants.XYD_COMPLETE:
// xydComplete(map);
XydCompleteModel xydCompleteModel = GsonUtils.fromJson(map.toString(), XydCompleteModel.class);
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.XYD_COMPLETE).setXydCompleteModel(xydCompleteModel).setLiveReceiveGiftBean(JSON.parseObject(map.toString(), LiveReceiveGiftBean.class)));
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.XYD_COMPLETE)
.setXydCompleteModel(xydCompleteModel)
.setLiveReceiveGiftBean(JSON.parseObject(map.toString(), LiveReceiveGiftBean.class)));
break;
case "GuardSpecialEffect":
LiveReceiveGiftBean giftBean = JSON.parseObject(map.toString(), LiveReceiveGiftBean.class);
giftBean.setMedal_name(map.getString("medal_name"));
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GuardSpecialEffect).setLiveReceiveGiftBean(giftBean));
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GuardSpecialEffect)
.setLiveReceiveGiftBean(giftBean));
break;
case Constants.WISH_LIST_PROGRESS:
StringBuffer conString = new StringBuffer();
conString.append(WordUtil.isNewZh() ? map.getString("msg") : map.getString("msg_en"));
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.WISH_LIST_PROGRESS).setWishListProgress(new WishModel().setWishlistProgress(map.getString("wishlist_progress")).setWishlistIcon(map.getString("wishlist_icon")).setWishlistName(map.getString("wishlist_name")).setWishlistNum(map.getString("wishlist_num")).setGiftType(map.getInteger("giftId")).setLuid(conString.toString())).setUname(map.getString("userName")).setLiveType(Integer.parseInt(map.getString("level"))));
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.WISH_LIST_PROGRESS)
.setWishListProgress(new WishModel()
.setWishlistProgress(map.getString("wishlist_progress"))
.setWishlistIcon(map.getString("wishlist_icon"))
.setWishlistName(map.getString("wishlist_name"))
.setWishlistNum(map.getString("wishlist_num"))
.setGiftType(map.getInteger("giftId"))
.setLuid(conString.toString())).setUname(map.getString("userName")).setLiveType(Integer.parseInt(map.getString("level"))));
break;
case Constants.LIVE_VOTE_CREATE:
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.VOTE_CREATE).setObject(map));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.VOTE_CREATE)
.setObject(map)
);
break;
case Constants.LIVE_VOTE_END:
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.VOTE_END).setObject(map));
EventBus.getDefault().post(new LiveAnchorEvent().setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_END).setObject(map));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.VOTE_END)
.setObject(map)
);
EventBus.getDefault().post(new LiveAnchorEvent()
.setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_END)
.setObject(map)
);
break;
case Constants.LIVE_VOTE_UPDATE:
//通知给观众
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.VOTE_UPDATE).setObject(map));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.VOTE_UPDATE)
.setObject(map)
);
//通知给主播
EventBus.getDefault().post(new LiveAnchorEvent().setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_UPDATE).setObject(map));
EventBus.getDefault().post(new LiveAnchorEvent()
.setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_UPDATE)
.setObject(map)
);
break;
case Constants.LIVE_PK_END:
mListener.onEndPk(map.getLong("uid"), map.getLong("pkuid"), map.getLong("uid_score"), map.getLong("pkuid_score"), JSONObject.parseObject(map.getJSONObject("ct").getJSONObject("pk_top_users").toJSONString(), LivePKUserListBean.class));
mListener.onEndPk(map.getLong("uid"),
map.getLong("pkuid"),
map.getLong("uid_score"),
map.getLong("pkuid_score"),
JSONObject.parseObject(map.getJSONObject("ct").getJSONObject("pk_top_users").toJSONString(), LivePKUserListBean.class)
);
break;
case Constants.RED_PACKET:
RedPacketModel redPacketModel = GsonUtils.fromJson(map.toString(), RedPacketModel.class);
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.RED_PACKET).setRedPacketModel(redPacketModel));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.RED_PACKET)
.setRedPacketModel(redPacketModel));
break;
case Constants.RED_PACKET_SUPER_JACKPOT:
RedPacketInfoModel redPacketInfoModel = GsonUtils.fromJson(map.toString(), RedPacketInfoModel.class);
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.RED_PACKET_SUPER_JACKPOT).setRedPacketInfoModel(redPacketInfoModel));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.RED_PACKET_SUPER_JACKPOT)
.setRedPacketInfoModel(redPacketInfoModel));
break;
case "GiftWallIlluminate":
Log.e("GiftWallIlluminate", map.toString());
Bus.get().post(new GiftWallIlluminateEvent().setNewNumber(map.getInteger("new_number")).setMaxNumber(map.getInteger("max_number")));
Bus.get().post(new GiftWallIlluminateEvent()
.setNewNumber(map.getInteger("new_number"))
.setMaxNumber(map.getInteger("max_number")));
break;
case SOCKET_LIVE_MSG_TO_USER:
sendToUserMsg(map);
break;
case "SudGameCreateRoom":
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SUD_GAME_CREATE_ROOM).setAvatar(WordUtil.isNewZh() ? map.getString("sud_game_name") : map.getString("sud_game_name_en")).setCreateSudRoomModel(GsonUtils.fromJson(map.toString(), SudGameDateModel.class)));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.SUD_GAME_CREATE_ROOM)
.setAvatar(WordUtil.isNewZh() ? map.getString("sud_game_name") : map.getString("sud_game_name_en"))
.setCreateSudRoomModel(GsonUtils.fromJson(map.toString(), SudGameDateModel.class)));
break;
case "sendQuickGift":
SendQuickGiftModel sendQuickGiftModel = GsonUtils.fromJson(map.toString(), SendQuickGiftModel.class);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(sendQuickGiftModel.getUserNicename()).append(WordUtil.isNewZh() ? " 送出了 " : " sent ").append(sendQuickGiftModel.getQuickGiftNumber()).append(WordUtil.isNewZh() ? " 個小PD " : " small pandas ");
stringBuffer.append(sendQuickGiftModel.getUserNicename())
.append(WordUtil.isNewZh() ? " 送出了 " : " sent ")
.append(sendQuickGiftModel.getQuickGiftNumber())
.append(WordUtil.isNewZh() ? " 個小PD " : " small pandas ");
systemChatMessage2(stringBuffer.toString());
Bus.get().post(new QuickGiftingEvent().setHotNum(sendQuickGiftModel.getHotNum()));
break;
@ -725,7 +805,9 @@ public class SocketRyClient {
pkRankBean.setRedVal(item.getString("uid_win_continuity"));
pkRankBean.setPkTopImgUrl(item.getString("pktt_img"));
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_START).setObject(pkRankBean));
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_START)
.setObject(pkRankBean));
break;
case "guardMaturityDateRemind":
GuardMaturityDateRemindModel maturityDateRemindModel = GsonUtils.fromJson(map.toString(), GuardMaturityDateRemindModel.class);
@ -738,6 +820,13 @@ public class SocketRyClient {
case "SendMoneyLongEnd":
Bus.get().post(new SendMoneyLongEndEvent());
break;
case Constants.SOCKET_LIVE_ANCHOR_PK_DIALOG:
item = map.getJSONObject("ct");
//DialogUitl.showSimpleDialog(mContext,WordUtil.isNewZh()?item.getString("text"):item.getString("text_en"),null);
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_DIALOG_ANCHOR_TIPS)
.setObject(WordUtil.isNewZh() ? item.getString("text") : item.getString("text_en")));
break;
}
}
@ -900,6 +989,7 @@ public class SocketRyClient {
chatBean.setBubble(map.getString("bubble"));
chatBean.setMedal(map.getString("medal"));
chatBean.setMedal_new(map.getString("medal_new"));
chatBean.setMedal_new_en(map.getString("medal_new_en"));
chatBean.setVipType(map.getIntValue("vip_type"));
chatBean.setVipType(map.getIntValue("vip_type"));
chatBean.setMedal_honor(map.getString("medal_honor"));
@ -957,6 +1047,7 @@ public class SocketRyClient {
chatBean.setBubble(obj.getString("bubble"));
chatBean.setMedal(obj.getString("medal"));
chatBean.setMedal_new(obj.getString("medal_new"));
chatBean.setMedal_new_en(map.getString("medal_new_en"));
chatBean.setHot_num(obj.getString("hot_num"));
UserBean.DressBean dressBean = new UserBean.DressBean();
dressBean.setAvatar_frame(obj.getString("avatar_frame"));
@ -977,7 +1068,8 @@ public class SocketRyClient {
FansModel fansMedalBean = new NewLevelManager(mContext).getFansModel(map.getIntValue("medal_level"));
u.setFansLevel(obj.getIntValue("medal_level"));
u.setFansEnterRoomUrl(obj.getString("medal_backgroup_thumb"));
if (fansMedalBean != null) chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb());
if (fansMedalBean != null)
chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb());
mListener.onEnterRoom(new LiveEnterRoomBean(u, chatBean));
}
}
@ -1009,7 +1101,8 @@ public class SocketRyClient {
//增加粉丝徽章信息
chatBean.setMedalNmae(map.getString("medal_name"));
FansModel fansMedalBean = new NewLevelManager(mContext).getFansModel(map.getIntValue("medal_level"));
if (fansMedalBean != null) chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb());
if (fansMedalBean != null)
chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb());
//聊天列表显示 玩家名 1 礼物名
if (CommonAppContext.lang.equals("chinese")) {
@ -1034,7 +1127,8 @@ public class SocketRyClient {
mListener.onSendGift(receiveGiftBean, null);
}
//同一个直播间时才刷新pk
if (mLiveUid.equals(map.getString("pkuid1")) || mLiveUid.equals(map.getString("pkuid2"))) {
if (mLiveUid.equals(map.getString("pkuid1")) ||
mLiveUid.equals(map.getString("pkuid2"))) {
mListener.onSendGiftPk(map.getLongValue("pktotal2"), map.getLongValue("pktotal1"), livePKUserListBean);
}
}
@ -1069,6 +1163,7 @@ public class SocketRyClient {
chatBean.setBubble(map.getString("bubble"));
chatBean.setMedal(map.getString("medal"));
chatBean.setMedal_new(map.getString("medal_new"));
chatBean.setMedal_new_en(map.getString("medal_new_en"));
chatBean.setGood_nub(map.getString("good_num"));
chatBean.setType(LiveChatBean.GIFT);
if (map.get("guard_type") != null && !"".equals(map.get("guard_type")) && !"null".equals(map.get("guard_type"))) {
@ -1116,21 +1211,32 @@ public class SocketRyClient {
chatBean.setBubble(map.getString("bubble"));
chatBean.setMedal(map.getString("medal"));
chatBean.setMedal_new(map.getString("medal_new"));
chatBean.setMedal_new_en(map.getString("medal_new_en"));
chatBean.setGood_nub(map.getString("good_num"));
chatBean.setType(LiveChatBean.GIFT);
if (map.get("guard_type") != null && !"".equals(map.get("guard_type")) && !"null".equals(map.get("guard_type"))) {
chatBean.setGuardType(map.getInteger("guard_type"));
}
String special = "";
if (sendBlindGiftEvent.getSpecialGift() == 1) {
if (WordUtil.isNewZh()) {
chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName());
special = "送出" + receiveGiftBean.getGiftName() + sendBlindGiftEvent.getSpecialGiftName();
} else {
chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen());
special = "Send " + receiveGiftBean.getGiftName() + sendBlindGiftEvent.getSpecialGiftNameEn();
}
chatBean.setContent(special);
} else {
if (WordUtil.isNewZh()) {
chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + receiveGiftBean.getGiftCount() + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftName() + special);
} else {
chatBean.setContent(mContext.getString(R.string.live_send_gift_1) + " " + +receiveGiftBean.getGiftCount() + " " + mContext.getString(R.string.live_send_gift_2) + receiveGiftBean.getGiftnameen() + special);
}
}
//增加粉丝徽章信息
chatBean.setMedalNmae(map.getString("medal_name"));
FansModel fansMedalBean = new NewLevelManager(mContext).getFansModel(map.getIntValue("medal_level"));
if (fansMedalBean != null) chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb());
if (fansMedalBean != null)
chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb());
receiveGiftBean.setLiveChatBean(chatBean);
@ -1158,7 +1264,11 @@ public class SocketRyClient {
}
if (map.getIntValue("drpk_status") == 1) {
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LEAVE_PK_SCORE).setPkScores(map.getJSONArray("userlist")).setUid(mLiveUid).setTime(0));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LEAVE_PK_SCORE)
.setPkScores(map.getJSONArray("userlist"))
.setUid(mLiveUid)
.setTime(0));
// LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, 0);
}
@ -1284,53 +1394,55 @@ public class SocketRyClient {
private void processAnchorLinkMicPk(JSONObject map) {
int action = map.getIntValue("action");
Log.i("Socket", "action = " + action + " json = " + map.toString());
L.eSw("处理主播与主播PK逻辑action = " + action + " json = " + map.toString());
L.eSw("RY RY RY RY "+map.toString());
switch (action) {
case 1://收到对方主播PK回调
UserBean u = new UserBean();
u.setId(map.getString("uid"));
u.setUserNiceName(map.getString("pkname"));
u.setAvatar(map.getString("pkhead"));
u.setRandomPk("11".equals(map.getString("msgtype")));
mListener.onLinkMicPkApply(u, map.getString("stream"), "11".equals(map.getString("msgtype"))?2:1);
mListener.onLinkMicPkApply(u, map.getString("stream"), 1);
break;
case 2://收到对方主播PK回调
L.eSw("收到对方主播PK回调");
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
mListener.onLinkMicToPk(map.getString("uid"), map.getString("uhead"), map.getString("uhead"));
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("uhead"), map.getString("uname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
if (livePushRyViewHolder != null) {
UserBean userBean = new UserBean();
userBean.setId(map.getString("uid"));
userBean.setAvatar(map.getString("uhead"));
userBean.setUserNiceName(map.getString("uname"));
livePushRyViewHolder.setAnPkRtc(userBean);
}
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
break;
case 3://对方主播拒绝PK的回调
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
mListener.onLinkMicPkRefuse();
break;
case 4://所有人收到PK开始址的回调
L.eSw("所有人收到PK开始址的回调");
// RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(map.getString("pkuid")));
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));
break;
case 5://PK时候断开连麦的回调
// if (rtcRoom != null) {
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.DISCONNEXT_PK_TIME));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.DISCONNEXT_PK_TIME));
RCRTCEngine.getInstance().leaveOtherRoom(map.getString("pkuid"), true, new IRCRTCResultCallback() {
@Override
public void onSuccess() {
Log.e("ry", map.getString("pkuid") + "退出多人成功a as");
}
@Override
public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry", map.getString("pkuid") + "退asa出多人失败" + rtcErrorCode);
}
});
//断开连麦
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout").execute(new HttpCallback() {
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
// }
if (livePushRyViewHolder != null) {
livePushRyViewHolder.onLinkMicAnchorClose();
}
mListener.onLinkMicPkClose(1);
if (RandomPkManager.getInstance().isRandomModel()) {
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_DEFAULT);
@ -1344,67 +1456,11 @@ public class SocketRyClient {
break;
case 9://pk结束的回调
mListener.onLinkMicPkEnd(map.getString("win_uid"));
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_PK_END).setObject(map.getString("uid")));
if (livePushRyViewHolder != null) {
livePushRyViewHolder.onLinkMicAnchorClose();
}
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_PK_END));
break;
case 10://系统发起PK回调
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK)
.param("action", 2)
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
.param("pkuid", CommonAppConfig.getInstance().getUid())
.param("msgtype", 2)
.param("uid", CommonAppConfig.getInstance().getUid())
.param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
msg1.create();
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(map.getString("uid"), conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(io.rong.imlib.model.Message message) {
}
@Override
public void onSuccess(io.rong.imlib.model.Message message) {
}
@Override
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
Log.e("tx", "aaa" + errorCode.toString());
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
}
});
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
LiveNetManager.get(mContext).getLiveInfo(map.getString("uid"), new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() {
@Override
public void onSuccess(LiveInfoModel data) {
mListener.onLinkMicToPk(map.getString("uid"), data.getAvatar(), map.getString("uhead"));
mListener.onLinkMicPkStart(map.getString("uid"), data.getAvatar(), map.getString("uname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
if (livePushRyViewHolder != null) {
UserBean userBean = new UserBean();
userBean.setId(map.getString("uid"));
userBean.setAvatar(data.getAvatar());
userBean.setUserNiceName(map.getString("uname"));
livePushRyViewHolder.setAnPkRtc(userBean);
}
}
@Override
public void onError(String error) {
}
}
);
/*JSONObject msg1 = new JSONObject();
JSONObject msg1 = new JSONObject();
msg1.put("type", "autoLivePK");
msg1.put("uid", CommonAppConfig.getInstance().getUid());
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
@ -1442,7 +1498,7 @@ public class SocketRyClient {
ToastUtil.show("invite " + map.getString("uid") + " lose " + rtcErrorCode);
}
}
});*/
});
break;
}
}

View File

@ -7,7 +7,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
@ -73,7 +73,7 @@ public class SocketRyLinkMicPkUtil {
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
Message message1 = Message.obtain("g" + CommonAppConfig.getInstance().getUid(), conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message1, null, null, new IRongCallback.ISendMessageCallback() {
RongcloudIMManager.sendMessage(message1, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
@ -136,7 +136,7 @@ public class SocketRyLinkMicPkUtil {
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(pkUid, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,210 @@
package com.yunbao.live.socket;
import android.util.Log;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.message.TextMessage;
public class SocketSwLinkMicPkUtil {
/**
* 发起PK申请
*
* @param pkUid 对方主播的uid
* @param stream 自己直播间的stream
*/
public static void linkMicPkApply(SocketSwClient client, String pkUid, String stream) {
if (client == null) {
return;
}
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
}
/**
* 主播接受对方主播的Pk请求
*
* @param pkUid 对方主播的uid
*/
public static void linkMicPkAccept(SocketSwClient client, String pkUid, String url, String name) {
HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive")
.params("uid", CommonAppConfig.getInstance().getUid())
.params("pkuid", pkUid)
.params("type", "1")
.params("sign", "1")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msgs, String[] info) {
if (code == 0) {
HttpClient.getInstance().get("Livepk.setPK", "Livepk.setPK")
.params("uid", CommonAppConfig.getInstance().getUid())
.params("pkuid", pkUid)
.params("type", "1")
.params("sign", "1")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msgs, String[] info) {
if (code == 0) {
Log.e("ry",name+"啊啊"+url);
final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
.param("action", 4)
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
.param("pkuid", pkUid)
.param("uid", CommonAppConfig.getInstance().getUid())
.param("pkhead", url)
.param("pkname", name);
msg1.create();
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
Message message1 = Message.obtain("g" + CommonAppConfig.getInstance().getUid(), conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message1, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
}
});
}
}
});
}
/**
* 主播接受对方主播的Pk请求
*
* @param pkUid 对方主播的uid
*/
public static void linkMicDRPkAccept(String pkUid) {
}
/**
* 主播拒绝其他主播的连麦请求
*/
public static void linkMicPkRefuse(SocketSwClient client, String pkUid) {
if (client == null) {
return;
}
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
final SocketSendBean msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
.param("action", 3)
.param("msgtype", 0)
.param("uid", u.getId())
.param("uname", u.getUserNiceName())
.param("pkuid", pkUid)
.param("ct", "");
msg.create();
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
Message message = Message.obtain(pkUid, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
/**
* 主播断开连麦
*/
public static void linkMicAnchorClose(SocketSwClient client, String pkUid) {
if (client == null) {
return;
}
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u == null) {
return;
}
// client.send(new SocketSendBean()
// .param("_method_", Constants.SOCKET_LINK_MIC_PK)
// .param("action", 5)
// .param("msgtype", 0)
// .param("uid", u.getId())
// .param("ct", "")
// .param("pkuid", pkUid)
// .param("uname", u.getUserNiceName()));
}
/**
* 当收到主播连麦的请求时候主播正在忙
*/
public static void linkMicPkBusy(SocketClient client, String pkUid) {
if (client == null) {
return;
}
// client.send(new SocketSendBean()
// .param("_method_", Constants.SOCKET_LINK_MIC_PK)
// .param("action", 7)
// .param("msgtype", 10)
// .param("pkuid", pkUid));
}
/**
* 当收到主播连麦的请求时候主播无响应
*/
public static void linkMicPkNotResponse(SocketSwClient client, String pkUid) {
if (client == null) {
return;
}
// client.send(new SocketSendBean()
// .param("_method_", Constants.SOCKET_LINK_MIC_PK)
// .param("action", 8)
// .param("msgtype", 10)
// .param("pkuid", pkUid));
}
}

View File

@ -19,10 +19,8 @@ import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
@ -60,7 +58,7 @@ public class LiveRoomVoteManager {
mAnchorVoteHide.setOnClickListener(v -> hideAnchorVote());
mVoteShow.setOnClickListener(v -> hideAnchorVote());
mClose.setOnClickListener(v -> close());
if (mContext instanceof LiveRyAnchorActivity) {
if (mContext instanceof LiveSwAnchorActivity) {
isAnchor = true;
} else {
isAnchor = false;

View File

@ -104,7 +104,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
initLittlePanda();
}
@Override
protected int getLayoutId() {
return R.layout.view_live_audience;

View File

@ -37,6 +37,7 @@ import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.adapter.SearchRecommendBodyAdapter;
import com.yunbao.live.event.JumpUserHomeEvent;
import com.yunbao.common.event.LiveRoomChangeEvent;
@ -234,9 +235,10 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
((LiveAnchorActivity) mContext).superBackPressed();
} else if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).exitLiveRoom();
} else if (mContext instanceof LiveRyAnchorActivity) {
} else if (mContext instanceof LiveSwAnchorActivity) {
((LiveSwAnchorActivity) mContext).superBackPressed();
}else if(mContext instanceof LiveRyAnchorActivity){
((LiveRyAnchorActivity) mContext).superBackPressed();
}
Bus.get().post(new CloseEvent());
}
@ -266,9 +268,8 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
((LiveAnchorActivity) mContext).superBackPressed();
} else if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).exitLiveRoom();
} else if (mContext instanceof LiveRyAnchorActivity) {
((LiveRyAnchorActivity) mContext).superBackPressed();
} else if (mContext instanceof LiveSwAnchorActivity) {
((LiveSwAnchorActivity) mContext).superBackPressed();
}
Bus.get().post(new CloseEvent());
}
@ -365,9 +366,10 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
((LiveAnchorActivity) mContext).superBackPressed();
} else if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).exitLiveRoom();
} else if (mContext instanceof LiveRyAnchorActivity) {
} else if (mContext instanceof LiveSwAnchorActivity) {
((LiveSwAnchorActivity) mContext).superBackPressed();
}else if(mContext instanceof LiveRyAnchorActivity){
((LiveRyAnchorActivity) mContext).superBackPressed();
}
Bus.get().post(new CloseEvent());
}
@ -424,7 +426,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}
@ -448,7 +450,9 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
((LiveAnchorActivity) mContext).superBackPressed();
} else if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).exitLiveRoom();
} else if (mContext instanceof LiveRyAnchorActivity) {
} else if (mContext instanceof LiveSwAnchorActivity) {
((LiveSwAnchorActivity) mContext).superBackPressed();
}else if(mContext instanceof LiveRyAnchorActivity){
((LiveRyAnchorActivity) mContext).superBackPressed();
}
}

View File

@ -65,7 +65,6 @@ import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.dialog.LiveAnchorEditCallMeDialog;
import com.yunbao.live.dialog.LiveAnchorSayPopDialog;
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
import com.yunbao.live.dialog.LiveFaceUnityDialogNewFragment;
import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment;
import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment;
import com.yunbao.live.dialog.LiveTimeDialogFragment;
@ -77,7 +76,10 @@ import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.util.Locale;
import io.agora.beautyapi.faceunity.agora.SWManager;
import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream;
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
import cn.rongcloud.rtc.base.RCRTCParamsType;
public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnClickListener {
@ -305,6 +307,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
}
private void setSelectClarity(int selectClarity) {
this.selectClarity = selectClarity;
IMLoginManager.get(mContext).setSelectClarity(selectClarity);
switch (selectClarity) {
@ -324,7 +327,35 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.setSelectClarity(selectClarity);
}
SWManager.get().setDimensions(selectClarity);
//設置開播分辨率
RCRTCParamsType.RCRTCVideoResolution rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
int minRate = 200;
int maxRate = 900;
switch (selectClarity) {
case 0:
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
minRate = 200;
maxRate = 900;
break;
case 1:
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280;
minRate = 250;
maxRate = 2200;
break;
case 2:
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_1080_1920;
minRate = 400;
maxRate = 4000;
break;
}
RCRTCVideoStreamConfig config =
RCRTCVideoStreamConfig.Builder.create()
.setMinRate(minRate)
.setMaxRate(maxRate)
.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_15)
.setVideoResolution(rcrtcVideoResolution)
.build();
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(config);
Log.e("切换分辨率", "时间戳" + System.currentTimeMillis());
//重新发布一下流
Bus.get().post(new LivePushRyEvent());
@ -536,7 +567,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
} else if (i == R.id.btn_locaiton) {
switchLocation();
} else if (i == R.id.btn_horizontally) {
SWManager.get().setMirrorMode();
RCRTCCameraOutputStream cameraStream = RCRTCEngine.getInstance().getDefaultVideoStream();
cameraStream.setPreviewMirror(!cameraStream.isPreviewMirror());
} else if (i == R.id.btn_robot) {
new XPopup.Builder(mContext)
.asCustom(new LiveRobotSettingCustomPopup(mContext))
@ -580,20 +612,6 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
}
}
public void setFaceUnityNew(boolean init){
LiveFaceUnityDialogNewFragment fragment = new LiveFaceUnityDialogNewFragment(mContext);
fragment.setManager(manager);
fragment.setDismissShowUi(mRootView);
if (mContext instanceof LiveRyAnchorActivity) {
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "FaceUnity");
mRootView.setVisibility(View.INVISIBLE);
if (init) {
fragment.dismiss();
}
}
}
/**
* 打开心愿单窗口
*/
@ -923,7 +941,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
return;
}
String title = mEditTitle.getText().toString().trim();
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, IMLoginManager.get(mContext).getSelectClarity() + 1, new HttpCallback() {
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, IMLoginManager.get(mContext).getSelectClarity() + 1, false,new HttpCallback() {
@Override
public void onSuccess(int code, String msg, final String[] info) {
if (code == 0 && info.length > 0) {

View File

@ -0,0 +1,963 @@
package com.yunbao.live.views;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.interfaces.XPopupCallback;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.bean.LiveRoomTypeBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.LivePushRyEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpConsts;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.ImageResultCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.common.views.LiveClarityCustomPopup;
import com.yunbao.common.views.LiveNewWishListPopup;
import com.yunbao.common.views.LiveOpenCustomPopup;
import com.yunbao.common.views.LiveRobotSettingCustomPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.faceunity.FaceManager;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.dialog.LiveAnchorEditCallMeDialog;
import com.yunbao.live.dialog.LiveAnchorSayPopDialog;
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
import com.yunbao.live.dialog.LiveFaceUnityDialogNewFragment;
import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment;
import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment;
import com.yunbao.live.dialog.LiveTimeDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.util.Locale;
import io.agora.beautyapi.faceunity.agora.SWManager;
public class LiveNewReadySwViewHolder extends AbsViewHolder implements View.OnClickListener {
private ConstraintLayout mAvatar, mRootView;
private TextView mCoverText;
private EditText mEditTitle;
private ProcessImageUtil mImageUtil;
private File mAvatarFile;
private TextView mLiveClass, anchorAgreement;
private TextView mLiveTypeTextView, liveClarity;//房间类型TextView
private TextView mLiveWishListTextView;//心愿单TextView
private int mLiveClassID;//直播频道id
private int mLiveType;//房间类型
private int mLiveTypeVal;//房间密码门票收费金额
private int mLiveTimeCoin;//计时收费金额
private boolean mOpenLocation = true;
private int mLiveSdk;
private LiveClassBean classBean;
private FaceManager manager;
private TextView faceTextView;//提示人脸未检测到的TextView
private ImageView imgClarity, selectorProtocol;
private int selectClarity = 1;
private LiveOpenCustomPopup liveOpenCustomPopup;
private boolean selector = true;
private String mLiveUid;
public LiveNewReadySwViewHolder(Context context, ViewGroup parentView, int liveSdk) {
super(context, parentView, liveSdk);
}
@Override
protected void processArguments(Object... args) {
if (args.length > 0) {
mLiveSdk = (int) args[0];
}
}
@Override
protected int getLayoutId() {
return R.layout.view_new_live_ready;
}
@Override
public void init() {
mRootView = (ConstraintLayout) findViewById(R.id.traceroute_rootview);
imgClarity = (ImageView) findViewById(R.id.img_clarity);
selectorProtocol = (ImageView) findViewById(R.id.selector_protocol);
liveClarity = (TextView) findViewById(R.id.live_clarity);
anchorAgreement = (TextView) findViewById(R.id.anchor_agreement);
mRootView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
InputMethodManager imm = (InputMethodManager)
mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
});
mAvatar = (ConstraintLayout) findViewById(R.id.avatar);
mAvatar.setOnClickListener(this);
UserBean u = CommonAppConfig.getInstance().getUserBean();
ImgLoader.displayDrawable(mContext, u.getAvatar(), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
mAvatar.setBackground(drawable);
}
@Override
public void onLoadFailed() {
}
});
mCoverText = (TextView) findViewById(R.id.cover_text);
mEditTitle = (EditText) findViewById(R.id.edit_title);
findViewById(R.id.btn_room_type).setOnClickListener(this);
mOpenLocation = true;
mLiveClass = (TextView) findViewById(R.id.live_class);
mLiveTypeTextView = (TextView) findViewById(R.id.text_room_type);
mLiveWishListTextView = (TextView) findViewById(R.id.text_wishlist);
faceTextView = (TextView) findViewById(R.id.faceTextView);
mImageUtil = ((LiveActivity) mContext).getProcessImageUtil();
mImageUtil.setImageResultCallback(new ImageResultCallback() {
@Override
public void beforeCamera() {
((LiveSwAnchorActivity) mContext).beforeCamera();
}
@Override
public void onSuccess(File file) {
if (file != null) {
ImgLoader.displayFileDrawable(mContext, file, new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
mAvatar.setBackground(drawable);
}
@Override
public void onLoadFailed() {
}
});
if (mAvatarFile == null) {
mCoverText.setText(mContext.getString(R.string.live_cover_2));
mCoverText.setBackground(ContextCompat.getDrawable(mContext, R.drawable.bg_live_cover));
}
mAvatarFile = file;
}
}
@Override
public void onFailure() {
}
});
findViewById(R.id.btn_camera).setOnClickListener(this);
findViewById(R.id.btn_live_class).setOnClickListener(this);
findViewById(R.id.btn_close).setOnClickListener(this);
findViewById(R.id.btn_beauty).setOnClickListener(this);
findViewById(R.id.btn_robot).setOnClickListener(this);
findViewById(R.id.btn_start_live).setOnClickListener(this);
findViewById(R.id.btn_wishlist).setOnClickListener(this);
findViewById(R.id.btn_horizontally).setOnClickListener(this);
findViewById(R.id.anchor_agreement_layout).setOnClickListener(this);
findViewById(R.id.btn_live_anchor_say).setOnClickListener(this);
findViewById(R.id.btn_live_anchor_call_me).setOnClickListener(this);
if (manager != null) {
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
final Handler handler = new Handler(Looper.getMainLooper());
@Override
public void onFaceChanged(int num) {
handler.post(() -> {
if (num == 0) {
faceTextView.setVisibility(View.VISIBLE);
} else {
faceTextView.setVisibility(View.GONE);
}
});
}
});
//新美颜
setFaceUnity(true);
}
//设置清晰度
// DeviceUtils.getMemory(mContext); //获取可用内存
// DeviceUtils.getNetSpeed(mContext);//获取当前上传网速
// Log.e("网速和内存", "内存:" + + " 网速:" + DeviceUtils.getNetSpeed(mContext));
IMLoginManager.get(mContext).setSelectClarity(selectClarity);
setSelectClarity(IMLoginManager.get(mContext).getSelectClarity());
ViewClicksAntiShake
.clicksAntiShake(
findViewById(R.id.btn_live_clarity), () -> {
LiveClarityCustomPopup liveClarityCustomPopup =
new LiveClarityCustomPopup(mContext,
IMLoginManager.get(mContext).getSelectClarity(),
IMLoginManager.get(mContext).getClarity() ? 0 : LiveClarityCustomPopup.BAN_1080, false);
new XPopup.Builder(mContext)
.setPopupCallback(new XPopupCallback() {
@Override
public void onCreated(BasePopupView popupView) {
}
@Override
public void beforeShow(BasePopupView popupView) {
}
@Override
public void onShow(BasePopupView popupView) {
}
@Override
public void onDismiss(BasePopupView popupView) {
setSelectClarity(liveClarityCustomPopup.getSelectClarity());
}
@Override
public void beforeDismiss(BasePopupView popupView) {
}
@Override
public boolean onBackPressed(BasePopupView popupView) {
return false;
}
@Override
public void onKeyBoardStateChanged(BasePopupView popupView, int height) {
}
@Override
public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) {
}
@Override
public void onClickOutside(BasePopupView popupView) {
}
})
.asCustom(liveClarityCustomPopup)
.show();
});
String keywordHtml2 = "</font><font color='#FF8D41'size='42px'>" + mContext.getString(R.string.anchor_hint) + "</font>";
String contextHtml = "<font color='#ffffff'size='42px'>" + mContext.getString(R.string.anchor_agreement) + "</font>";
anchorAgreement.setText(Html.fromHtml(contextHtml + keywordHtml2));
selectorProtocol.setPressed(true);
selectorProtocol.setSelected(true);
selector = selectorProtocol.isSelected();
selectorProtocol.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selector = !selector;
selectorProtocol.setSelected(selector);
}
});
}
private void setSelectClarity(int selectClarity) {
this.selectClarity = selectClarity;
IMLoginManager.get(mContext).setSelectClarity(selectClarity);
switch (selectClarity) {
case 0:
imgClarity.setImageResource(R.mipmap.icon_sd);
liveClarity.setText(R.string.standard_clear);
break;
case 1:
imgClarity.setImageResource(R.mipmap.icon_hd);
liveClarity.setText(R.string.high_definition);
break;
case 2:
imgClarity.setImageResource(R.mipmap.icon_fhd);
liveClarity.setText(R.string.ultra_hd);
break;
}
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.setSelectClarity(selectClarity);
}
SWManager.get().setDimensions(selectClarity);
Log.e("切换分辨率", "时间戳" + System.currentTimeMillis());
//重新发布一下流
Bus.get().post(new LivePushRyEvent());
}
public void setManager(FaceManager manager) {
this.manager = manager;
}
@Override
public void onClick(View v) {
if (!canClick()) {
return;
}
int i = v.getId();
if (i == R.id.avatar) {
setAvatar();
} else if (i == R.id.btn_camera) {
toggleCamera();
} else if (i == R.id.btn_close) {
close();
} else if (i == R.id.btn_live_class) {
chooseLiveClass();
} else if (i == R.id.btn_beauty) {
//beauty();//momo美颜
setFaceUnity(false); //新娱美颜
} else if (i == R.id.btn_wishlist) {
//点击心愿单
openWishListWindow();
} else if (i == R.id.btn_room_type) {
chooseLiveType();
} else if (i == R.id.btn_start_live) {
if (!selector) {
ToastUtil.show(mContext.getString(R.string.anchor_agreement_hint));
return;
}
if (mLiveClassID == 0) {
ToastUtil.show(WordUtil.getNewString(R.string.live_choose_live_class));
return;
}
// startLive();
liveOpenCustomPopup = new LiveOpenCustomPopup(mContext, IMLoginManager.get(mContext).getSelectClarity(), classBean, liveRoomTypeBean)
.setSayStatus(IMLoginManager.get(mContext).getAnchorSayStatus())
.setCallMeStatus(IMLoginManager.get(mContext).getAnchorCallStatus())
.setCallBack(new LiveOpenCustomPopup.LiveOpenCallBack() {
@Override
public void startLive(LiveRoomTypeBean liveRoomTypeModel, LiveClassBean classModel) {
if (classModel != null) {
classBean = classModel;
mLiveClassID = classBean.getId();
}
liveRoomTypeBean = liveRoomTypeModel;
mLiveType = liveRoomTypeModel.getId();
startLiveInit();
liveOpenCustomPopup = null;
}
@Override
public void selectClarity(int selectClarity) {
LiveClarityCustomPopup liveClarityCustomPopup =
new LiveClarityCustomPopup(mContext,
IMLoginManager.get(mContext).getSelectClarity(),
IMLoginManager.get(mContext).getClarity() ? 0 : LiveClarityCustomPopup.BAN_1080, false);
new XPopup.Builder(mContext)
.setPopupCallback(new XPopupCallback() {
@Override
public void onCreated(BasePopupView popupView) {
}
@Override
public void beforeShow(BasePopupView popupView) {
}
@Override
public void onShow(BasePopupView popupView) {
}
@Override
public void onDismiss(BasePopupView popupView) {
setSelectClarity(liveClarityCustomPopup.getSelectClarity());
}
@Override
public void beforeDismiss(BasePopupView popupView) {
}
@Override
public boolean onBackPressed(BasePopupView popupView) {
return false;
}
@Override
public void onKeyBoardStateChanged(BasePopupView popupView, int height) {
}
@Override
public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) {
}
@Override
public void onClickOutside(BasePopupView popupView) {
}
})
.asCustom(liveClarityCustomPopup)
.show();
}
@Override
public void openRobot() {
LiveRobotSettingCustomPopup liveRobotSettingCustomPopup = new LiveRobotSettingCustomPopup(mContext);
new XPopup.Builder(mContext)
.setPopupCallback(new XPopupCallback() {
@Override
public void onCreated(BasePopupView popupView) {
}
@Override
public void beforeShow(BasePopupView popupView) {
}
@Override
public void onShow(BasePopupView popupView) {
}
@Override
public void onDismiss(BasePopupView popupView) {
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.initDate();
}
}
@Override
public void beforeDismiss(BasePopupView popupView) {
}
@Override
public boolean onBackPressed(BasePopupView popupView) {
return false;
}
@Override
public void onKeyBoardStateChanged(BasePopupView popupView, int height) {
}
@Override
public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) {
}
@Override
public void onClickOutside(BasePopupView popupView) {
}
})
.asCustom(liveRobotSettingCustomPopup)
.show();
}
@Override
public void openLiveRoomType(LiveRoomTypeBean liveRoomTypeModel) {
liveRoomTypeBean = liveRoomTypeModel;
mLiveType = liveRoomTypeModel.getId();
chooseLiveType();
}
@Override
public void openLiveClass(LiveClassBean classModel) {
if (classModel != null) {
classBean = classModel;
mLiveClassID = classBean.getId();
}
chooseLiveClass();
}
@Override
public void openWishlist() {
//点击心愿单
openWishListWindow();
}
@Override
public void openAnchorSay() {
openAnchorSayDialog();
}
@Override
public void openCallMe() {
openAnchorCallMeDialog();
}
});
new XPopup.Builder(mContext)
.asCustom(liveOpenCustomPopup)
.show();
} else if (i == R.id.btn_locaiton) {
switchLocation();
} else if (i == R.id.btn_horizontally) {
SWManager.get().setMirrorMode();
} else if (i == R.id.btn_robot) {
new XPopup.Builder(mContext)
.asCustom(new LiveRobotSettingCustomPopup(mContext))
.show();
} else if (i == R.id.anchor_agreement_layout) {
String ct = Locale.getDefault().getLanguage();
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
StringBuffer url = new StringBuffer();
url.append(CommonAppConfig.HOST);
if (TextUtils.equals(ct, "zh")) {
url.append("/index.php?g=portal&m=page&a=index&id=671");
} else {
url.append("/index.php?g=portal&m=page&a=index&id=672");
}
url.append("&uid=")
.append(model.getId())
.append("&token=")
.append(model.getToken()).append("&isZh=")
.append(WordUtil.isNewZh() ? "1" : 0);
RouteUtil.forwardLiveZhuangBanActivity(url.toString(), false);
} else if (i == R.id.btn_live_anchor_say) {
openAnchorSayDialog();
} else if (i == R.id.btn_live_anchor_call_me) {
openAnchorCallMeDialog();
}
}
/**
* 新娱美颜
*/
public void setFaceUnity(boolean init) {
LiveFaceUnityDialogFragment fragment = new LiveFaceUnityDialogFragment(mContext);
fragment.setManager(manager);
fragment.setDismissShowUi(mRootView);
if (mContext instanceof LiveSwAnchorActivity) {
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "FaceUnity");
mRootView.setVisibility(View.INVISIBLE);
if (init) {
fragment.dismiss();
}
}
}
public void setFaceUnityNew(boolean init){
LiveFaceUnityDialogNewFragment fragment = new LiveFaceUnityDialogNewFragment(mContext);
fragment.setManager(manager);
fragment.setDismissShowUi(mRootView);
if (mContext instanceof LiveSwAnchorActivity) {
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "FaceUnity");
mRootView.setVisibility(View.INVISIBLE);
if (init) {
fragment.dismiss();
}
}
}
/**
* 打开心愿单窗口
*/
public void openWishListWindow() {
// LiveNewWishListDialogFragment fragment = new LiveNewWishListDialogFragment();
//
// if (mContext instanceof LiveRyAnchorActivity) {
// fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "RY");
//
// }
new XPopup.Builder(mContext)
.enableDrag(false)
.asCustom(new LiveNewWishListPopup((LiveSwAnchorActivity) mContext))
.show();
}
public void openAnchorSayDialog() {
new LiveAnchorSayPopDialog(mContext).setLiveUid(mLiveUid).setOnItemClickListener(new OnItemClickListener<LiveAnchorSayModel>() {
@Override
public void onItemClick(LiveAnchorSayModel bean, int position) {
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.setSayStatus(bean.getLivePreview().getIsShow() == 1);
}
}
}).showDialog();
}
public void openAnchorCallMeDialog() {
new LiveAnchorEditCallMeDialog(mContext).setLiveUid(mLiveUid).setOnItemClickListener(new OnItemClickListener<LiveAnchorCallMeModel>() {
@Override
public void onItemClick(LiveAnchorCallMeModel bean, int position) {
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.setCallMeStatus(bean.getIsShow() == 1);
}
}
}).showDialog();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateStart(LiveAudienceEvent event) {
if (event.getType() == WISH_LIST_UPDATE) {
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.initDate();
}
}
}
/**
* 打开 关闭位置
*/
private void switchLocation() {
if (mOpenLocation) {
new DialogUitl.Builder(mContext)
.setContent(mContext.getString(R.string.live_location_close_3))
.setCancelable(true)
.setConfirmString(mContext.getString(R.string.live_location_close_2))
.setClickCallback(new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
toggleLocation();
}
})
.build()
.show();
} else {
toggleLocation();
}
}
private void toggleLocation() {
mOpenLocation = !mOpenLocation;
}
/**
* 设置头像
*/
private void setAvatar() {
if (mLiveSdk == Constants.LIVE_SDK_TX) {
mImageUtil.getImageByAlumb();
} else {
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
@Override
public void onItemClick(String text, int tag) {
if (tag == R.string.camera) {
mImageUtil.getImageByCamera();
} else {
mImageUtil.getImageByAlumb();
}
}
});
}
}
/**
* 切换镜头
*/
private void toggleCamera() {
((LiveSwAnchorActivity) mContext).toggleCamera();
}
/**
* 关闭
*/
private void close() {
((LiveSwAnchorActivity) mContext).endLives();
}
/**
* 选择直播频道
*/
private void chooseLiveClass() {
/* try {
Intent intent = new Intent(mContext, LiveChooseClassActivity.class);
intent.putExtra(Constants.CLASS_ID, mLiveClassID);
mImageUtil.startActivityForResult(intent, mActivityResultCallback);
}catch (Exception e){
}*/
Bundle bundle = new Bundle();
bundle.putInt(Constants.CLASS_ID, mLiveClassID);
LiveNewRoomClassDialogFragment fragment = new LiveNewRoomClassDialogFragment();
fragment.setArguments(bundle);
fragment.setCallback(new CommonCallback<LiveClassBean>() {
@Override
public void callback(LiveClassBean bean) {
classBean = bean;
mLiveClassID = classBean.getId();
mLiveClass.setText(bean.getName());
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.setClassBean(classBean);
}
}
});
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
}
/**
* 设置美颜
*/
private void beauty() {
((LiveSwAnchorActivity) mContext).beauty();
// Intent intent = new Intent(mContext, Beauty360Activity3.class);
// mContext.startActivity(intent);
}
/**
* 选择直播类型
*/
private LiveRoomTypeBean liveRoomTypeBean = new LiveRoomTypeBean(0, mContext.getString(R.string.live_room_public));
private void chooseLiveType() {
Bundle bundle = new Bundle();
bundle.putInt(Constants.CHECKED_ID, mLiveType);
LiveNewRoomTypeDialogFragment fragment = new LiveNewRoomTypeDialogFragment();
fragment.setArguments(bundle);
fragment.setCallback(new CommonCallback<LiveRoomTypeBean>() {
@Override
public void callback(LiveRoomTypeBean bean) {
liveRoomTypeBean = bean;
switch (bean.getId()) {
case Constants.LIVE_TYPE_NORMAL:
onLiveTypeNormal(bean);
break;
case Constants.LIVE_TYPE_PWD:
onLiveTypePwd(bean);
break;
case Constants.LIVE_TYPE_PAY:
onLiveTypePay(bean);
break;
case Constants.LIVE_TYPE_TIME:
onLiveTypeTime(bean);
break;
}
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.setLiveRoomTypeBean(liveRoomTypeBean);
}
}
});
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
}
/**
* 普通房间
*/
private void onLiveTypeNormal(LiveRoomTypeBean bean) {
mLiveType = bean.getId();
mLiveTypeTextView.setText(bean.getName());
mLiveTypeVal = 0;
mLiveTimeCoin = 0;
}
/**
* 密码房间
*/
private void onLiveTypePwd(final LiveRoomTypeBean bean) {
DialogUitl.showSimpleInputDialog(mContext, mContext.getString(R.string.live_set_pwd), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, 8, new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
if (TextUtils.isEmpty(content)) {
ToastUtil.show(mContext.getString(R.string.live_set_pwd_empty));
} else {
mLiveType = bean.getId();
mLiveTypeTextView.setText(WordUtil.isNewZh() ? "密碼房" : "password room");
if (StringUtil.isInt(content)) {
mLiveTypeVal = Integer.parseInt(content);
}
mLiveTimeCoin = 0;
dialog.dismiss();
}
}
});
}
/**
* 付费房间
*/
private void onLiveTypePay(final LiveRoomTypeBean bean) {
DialogUitl.showSimpleInputDialog(mContext, mContext.getString(R.string.live_set_fee), DialogUitl.INPUT_TYPE_NUMBER, 8, new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
if (TextUtils.isEmpty(content)) {
ToastUtil.show(mContext.getString(R.string.live_set_fee_empty));
} else {
mLiveType = bean.getId();
mLiveTypeTextView.setText(bean.getName());
if (StringUtil.isInt(content)) {
mLiveTypeVal = Integer.parseInt(content);
}
mLiveTimeCoin = 0;
dialog.dismiss();
}
}
});
}
/**
* 计时房间
*/
private void onLiveTypeTime(final LiveRoomTypeBean bean) {
LiveTimeDialogFragment fragment = new LiveTimeDialogFragment();
Bundle bundle = new Bundle();
bundle.putInt(Constants.CHECKED_COIN, mLiveTimeCoin);
fragment.setArguments(bundle);
fragment.setCommonCallback(new CommonCallback<Integer>() {
@Override
public void callback(Integer coin) {
mLiveType = bean.getId();
mLiveTypeTextView.setText(bean.getName());
mLiveTypeVal = coin;
mLiveTimeCoin = coin;
}
});
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveTimeDialogFragment");
}
public void hide() {
if (mContentView != null && mContentView.getVisibility() == View.VISIBLE) {
mContentView.setVisibility(View.INVISIBLE);
}
}
public void show() {
if (mContentView != null && mContentView.getVisibility() != View.VISIBLE) {
mContentView.setVisibility(View.VISIBLE);
}
}
/**
* 点击开始直播按钮
*/
private void startLiveInit() {
if (isWifiProxy(mContext) || checkVPN((ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE))) {
ToastUtil.show(WordUtil.isNewZh()?"檢測開啓了VPN或者代理請先關閉VPN或者代理再開播。":
"It is detected that VPN or proxy is turned on. Please turn off VPN or proxy before starting the broadcast.");
} else {
boolean startPreview = ((LiveSwAnchorActivity) mContext).isStartPreview();
// if (!startPreview) {
// ToastUtil.show(R.string.please_wait);
// return;
// }
if (mLiveClassID == 0) {
ToastUtil.show(WordUtil.getNewString(R.string.live_choose_live_class));
return;
}
createRoom();
}
}
private boolean isWifiProxy(Context context) {
final boolean IS_ICS_OR_LATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
String proxyAddress;
int proxyPort;
if (IS_ICS_OR_LATER) {
proxyAddress = System.getProperty("http.proxyHost");
String portStr = System.getProperty("http.proxyPort");
proxyPort = Integer.parseInt((portStr != null ? portStr : "-1"));
} else {
proxyAddress = android.net.Proxy.getHost(context);
proxyPort = android.net.Proxy.getPort(context);
}
return (!TextUtils.isEmpty(proxyAddress)) && (proxyPort != -1);
}
private boolean checkVPN(ConnectivityManager connMgr) {
//don't know why always returns null:
NetworkInfo networkInfo = connMgr.getNetworkInfo(ConnectivityManager.TYPE_VPN);
boolean isVpnConn = networkInfo == null ? false : networkInfo.isConnected();
return isVpnConn;
}
/**
* 请求创建直播间接口开始直播
*/
boolean isHttpBack = false;
private void createRoom() {
if (!isHttpBack) {
isHttpBack = true;
if (mLiveClassID == 0) {
ToastUtil.show(WordUtil.getNewString(R.string.live_choose_live_class));
return;
}
String title = mEditTitle.getText().toString().trim();
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, IMLoginManager.get(mContext).getSelectClarity() + 1,true, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, final String[] info) {
if (code == 0 && info.length > 0) {
L.e("开播", "createRoom------->" + info[0]);
isHttpBack = false;
final CommonAppConfig appConfig = CommonAppConfig.getInstance();
UserBean u = appConfig.getUserBean();
((LiveSwAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal);
} else {
ToastUtil.show(msg);
}
}
@Override
public void onError() {
super.onError();
isHttpBack = false;
}
});
} else {
ToastUtil.show("請求中,請勿重複點擊");
}
}
public void release() {
mImageUtil = null;
}
@Override
public void onDestroy() {
LiveHttpUtil.cancel(LiveHttpConsts.CREATE_ROOM);
}
public void setLiveUid(String mLiveUid) {
this.mLiveUid = mLiveUid;
}
}

View File

@ -11,25 +11,16 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.tencent.live2.V2TXLiveDef;
import com.tencent.live2.V2TXLivePlayer;
import com.tencent.live2.impl.V2TXLivePlayerImpl;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.live.R;
import com.yunbao.live.bean.DrPkbean;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cxf on 2018/10/10.
@ -77,7 +68,7 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
@Override
protected int getLayoutId() {
return R.layout.view_live_play_ksy;
return R.layout.view_live_play_sw;
}
@Override
@ -272,6 +263,36 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
LivePlayKsyViewHolder.landscape =landscape;
}
@Override
public void endPk() {
}
@Override
public void endpk(String liveUid) {
}
@Override
public void initSwEngine(String liveUid) {
}
@Override
public void removeDetailView() {
}
@Override
public void setPkView(String liveUid) {
}
@Override
public void claerDrPkInfoView() {
}
@Override
public ViewGroup getSmallContainer() {

View File

@ -12,7 +12,7 @@ public interface LivePlayListener extends LiveActivityLifeCallback {
*
* @param data 房间信息
*/
void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk);
void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk,boolean isSw);
/**
* 用户滑动移除该页面

File diff suppressed because it is too large Load Diff

View File

@ -79,6 +79,36 @@ public class LivePlayTxViewHolder extends LiveRoomPlayViewHolder implements ITXL
public void setLiveBeanLandscape(int landscape) {
}
@Override
public void endPk() {
}
@Override
public void endpk(String liveUid) {
}
@Override
public void initSwEngine(String liveUid) {
}
@Override
public void removeDetailView() {
}
@Override
public void setPkView(String liveUid) {
}
@Override
public void claerDrPkInfoView() {
}
@Override
protected int getLayoutId() {
return R.layout.view_live_play_tx;

View File

@ -1,476 +0,0 @@
package com.yunbao.live.views;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.tencent.rtmp.ITXLivePlayListener;
import com.tencent.rtmp.TXLiveConstants;
import com.tencent.rtmp.TXLivePlayConfig;
import com.tencent.rtmp.TXLivePlayer;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.common.http.LiveHttpConsts;
import com.yunbao.common.http.LiveHttpUtil;
/**
* Created by cxf on 2018/10/10.
* 直播间播放器 腾讯播放器
*/
public class LivePlayTxViewHolder_backup extends LiveRoomPlayViewHolder implements ITXLivePlayListener {
private static final String TAG = "LiveTxPlayViewHolder";
private ViewGroup mRoot;
private ViewGroup mSmallContainer;
private ViewGroup mLeftContainer;
private ViewGroup mRightContainer;
private ViewGroup mPkContainer;
private TXCloudVideoView mVideoView;
private View mLoading;
private ImageView mCover;
private TXLivePlayer mPlayer;
private boolean mPaused;//是否切后台了
private boolean mStarted;//是否开始了播放
private boolean mEnd;//是否结束了播放
private boolean mPausedPlay;//是否被动暂停了播放
private boolean mChangeToLeft;
private boolean mChangeToAnchorLinkMic;
private String mUrl;
private int mPlayType;
private HttpCallback mGetTxLinkMicAccUrlCallback;
private Handler mHandler;
private int mVideoLastProgress;
@Override
public void setPkview() {
}
@Override
public void setPkEndview() {
}
@Override
public void setDrMicInfo(UserBean u) {
}
@Override
public void setLiveBeanLandscape(int landscape) {
}
public LivePlayTxViewHolder_backup(Context context, ViewGroup parentView) {
super(context, parentView);
}
@Override
protected int getLayoutId() {
return R.layout.view_live_play_tx;
}
@Override
public void init() {
mRoot = (ViewGroup) findViewById(R.id.root);
mSmallContainer = (ViewGroup) findViewById(R.id.small_container);
mLeftContainer = (ViewGroup) findViewById(R.id.left_container);
mRightContainer = (ViewGroup) findViewById(R.id.right_container);
mPkContainer = (ViewGroup) findViewById(R.id.pk_container);
mLoading = findViewById(R.id.loading);
mCover = (ImageView) findViewById(R.id.cover);
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
mPlayer = new TXLivePlayer(mContext);
mPlayer.setPlayListener(this);
mPlayer.setPlayerView(mVideoView);
mPlayer.enableHardwareDecode(false);
mPlayer.setRenderRotation(TXLiveConstants.RENDER_ROTATION_PORTRAIT);
mPlayer.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN);
TXLivePlayConfig playConfig = new TXLivePlayConfig();
playConfig.setAutoAdjustCacheTime(true);
playConfig.setMaxAutoAdjustCacheTime(5.0f);
playConfig.setMinAutoAdjustCacheTime(1.0f);
mPlayer.setConfig(playConfig);
}
@Override
public void onPlayEvent(int e, Bundle bundle) {
if (mEnd) {
return;
}
switch (e) {
case TXLiveConstants.PLAY_EVT_PLAY_BEGIN://播放开始
if (mLoading != null && mLoading.getVisibility() == View.VISIBLE) {
mLoading.setVisibility(View.INVISIBLE);
}
break;
case TXLiveConstants.PLAY_EVT_PLAY_LOADING:
if (mLoading != null && mLoading.getVisibility() != View.VISIBLE) {
mLoading.setVisibility(View.VISIBLE);
}
break;
case TXLiveConstants.PLAY_EVT_RCV_FIRST_I_FRAME://第一帧
hideCover();
break;
case TXLiveConstants.PLAY_EVT_PLAY_END://播放结束
replay();
break;
case TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION://获取视频宽高
if (mChangeToLeft || mChangeToAnchorLinkMic) {
return;
}
float width = bundle.getInt("EVT_PARAM1", 0);
float height = bundle.getInt("EVT_PARAM2", 0);
L.e(TAG, "流---width----->" + width);
L.e(TAG, "流---height----->" + height);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mVideoView.getLayoutParams();
int targetH = 0;
if (width >= height) {//横屏 9:16=0.5625
targetH = (int) (mVideoView.getWidth() / width * height);
} else {
targetH = ViewGroup.LayoutParams.MATCH_PARENT;
}
if (targetH != params.height) {
params.height = targetH;
params.gravity = Gravity.CENTER;
mVideoView.requestLayout();
}
break;
case TXLiveConstants.PLAY_ERR_NET_DISCONNECT://播放失败
case TXLiveConstants.PLAY_ERR_FILE_NOT_FOUND:
ToastUtil.show(mContext.getString(R.string.live_play_error));
break;
case TXLiveConstants.PLAY_EVT_PLAY_PROGRESS:
int progress = bundle.getInt("EVT_PLAY_PROGRESS_MS");
if (mVideoLastProgress == progress) {
replay();
} else {
mVideoLastProgress = progress;
}
break;
default:break;
}
}
@Override
public void onNetStatus(Bundle bundle) {
}
@Override
public void hideCover() {
if (mCover != null) {
mCover.animate().alpha(0).setDuration(500).start();
}
}
@Override
public void setCover(String coverUrl) {
if (mCover != null) {
ImgLoader.displayBlur(mContext, coverUrl, mCover);
}
}
@Override
public void fullScreen() {
}
@Override
public void smallScreen() {
}
/**
* 循环播放
*/
private void replay() {
if (mStarted && mPlayer != null) {
mPlayer.seek(0);
mPlayer.resume();
}
}
/**
* 暂停播放
*/
@Override
public void pausePlay() {
if (!mPausedPlay) {
mPausedPlay = true;
if (!mPaused) {
if (mPlayer != null) {
mPlayer.pause();
}
}
if (mCover != null) {
mCover.setAlpha(1f);
if (mCover.getVisibility() != View.VISIBLE) {
mCover.setVisibility(View.VISIBLE);
}
}
}
}
/**
* 暂停播放后恢复
*/
@Override
public void resumePlay() {
if (mPausedPlay) {
mPausedPlay = false;
if (!mPaused) {
if (mPlayer != null) {
mPlayer.resume();
}
}
hideCover();
}
}
/**
* 开始播放
*
* @param url 流地址
*/
@Override
public void play(String url,int playModel) {
if (TextUtils.isEmpty(url)) {
return;
}
int playType = -1;
if (url.startsWith("rtmp://")) {
playType = TXLivePlayer.PLAY_TYPE_LIVE_RTMP;
} else if (url.endsWith(".flv")) {
playType = TXLivePlayer.PLAY_TYPE_LIVE_FLV;
} else if (url.endsWith(".m3u8")) {
playType = TXLivePlayer.PLAY_TYPE_VOD_HLS;
} else if (url.endsWith(".mp4")) {
playType = TXLivePlayer.PLAY_TYPE_VOD_MP4;
}
if (playType == -1) {
ToastUtil.show(mContext.getString(R.string.live_play_error_2));
return;
}
if (mPlayer != null) {
int result = mPlayer.startPlay(url, playType);
if (result == 0) {
mStarted = true;
mUrl = url;
mPlayType = playType;
}
}
L.e(TAG, "play----url--->" + url);
}
@Override
public void switchStream(String url, int playModel) {
}
@Override
public void stopPlay() {
mChangeToLeft = false;
mChangeToAnchorLinkMic = false;
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
}
if (mCover != null) {
mCover.setAlpha(1f);
if (mCover.getVisibility() != View.VISIBLE) {
mCover.setVisibility(View.VISIBLE);
}
}
stopPlay2();
}
@Override
public void stopPlay2() {
if (mPlayer != null) {
mPlayer.stopPlay(false);
}
}
@Override
public void release() {
mEnd = true;
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
}
mHandler = null;
LiveHttpUtil.cancel(LiveHttpConsts.GET_TX_LINK_MIC_ACC_URL);
if (mPlayer != null) {
mPlayer.stopPlay(false);
mPlayer.setPlayListener(null);
}
mPlayer = null;
L.e(TAG, "release------->");
}
@Override
public ViewGroup getSmallContainer() {
return mSmallContainer;
}
@Override
public ViewGroup getRightContainer() {
return mRightContainer;
}
@Override
public ViewGroup getPkContainer() {
return mPkContainer;
}
@Override
public void changeToLeft() {
mChangeToLeft = true;
if (mVideoView != null) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mVideoView.getLayoutParams();
params.width = mVideoView.getWidth() / 2;
params.height = DpUtil.dp2px(250);
params.topMargin = DpUtil.dp2px(130);
mVideoView.setLayoutParams(params);
}
if (mLoading != null && mLeftContainer != null) {
ViewParent viewParent = mLoading.getParent();
if (viewParent != null) {
((ViewGroup) viewParent).removeView(mLoading);
}
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(DpUtil.dp2px(24), DpUtil.dp2px(24));
params.gravity = Gravity.CENTER;
mLoading.setLayoutParams(params);
mLeftContainer.addView(mLoading);
}
}
@Override
public void changeToBig() {
mChangeToLeft = false;
if (mVideoView != null) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mVideoView.getLayoutParams();
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
params.topMargin = 0;
mVideoView.setLayoutParams(params);
}
if (mLoading != null && mRoot != null) {
ViewParent viewParent = mLoading.getParent();
if (viewParent != null) {
((ViewGroup) viewParent).removeView(mLoading);
}
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(DpUtil.dp2px(24), DpUtil.dp2px(24));
params.gravity = Gravity.CENTER;
mLoading.setLayoutParams(params);
mRoot.addView(mLoading);
}
}
@Override
public void onResume() {
if (!mPausedPlay && mPaused && mPlayer != null) {
mPlayer.resume();
}
mPaused = false;
}
@Override
public void onPause() {
if (!mPausedPlay && mPlayer != null) {
mPlayer.pause();
}
mPaused = true;
}
@Override
public void onDestroy() {
release();
}
/**
* 腾讯sdk连麦时候切换低延时流
*/
public void onLinkMicTxAccEvent(boolean linkMic) {
if (mStarted && mPlayer != null && !TextUtils.isEmpty(mUrl)) {
mPlayer.stopPlay(false);
if (linkMic) {
if (mGetTxLinkMicAccUrlCallback == null) {
mGetTxLinkMicAccUrlCallback = new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
JSONObject obj = JSON.parseObject(info[0]);
if (obj != null) {
String accUrl = obj.getString("streamUrlWithSignature");
if (!TextUtils.isEmpty(accUrl) && mPlayer != null) {
L.e(TAG, "低延时流----->" + accUrl);
mPlayer.startPlay(accUrl, TXLivePlayer.PLAY_TYPE_LIVE_RTMP_ACC);
}
}
}
}
};
}
LiveHttpUtil.getTxLinkMicAccUrl(mUrl, mGetTxLinkMicAccUrlCallback);
} else {
mPlayer.startPlay(mUrl, mPlayType);
}
}
}
/**
* 设置主播连麦模式
*
* @param anchorLinkMic
*/
public void setAnchorLinkMic(final boolean anchorLinkMic, int delayTime) {
if (mVideoView == null) {
return;
}
if (mHandler == null) {
mHandler = new Handler();
}
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mChangeToAnchorLinkMic = anchorLinkMic;
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mVideoView.getLayoutParams();
if (anchorLinkMic) {
params.height = DpUtil.dp2px(250);
params.topMargin = DpUtil.dp2px(130);
params.gravity = Gravity.TOP;
} else {
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
params.topMargin = 0;
params.gravity = Gravity.CENTER;
}
mVideoView.setLayoutParams(params);
}
}, delayTime);
}
}

View File

@ -9,8 +9,8 @@ import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.LIVE_PK_I
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList1;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.mPkUid;
import static cn.rongcloud.rtc.base.RCRTCLiveRole.BROADCASTER;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Resources;
@ -46,17 +46,16 @@ import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.IMRTCManager;
import com.yunbao.common.manager.RandomPkManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.bean.DrPkbean;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.common.http.LiveHttpConsts;
import com.yunbao.common.http.LiveHttpUtil;
@ -72,23 +71,29 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import cn.rongcloud.rtc.api.RCRTCConfig;
import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.RCRTCMixConfig;
import cn.rongcloud.rtc.api.RCRTCRemoteUser;
import cn.rongcloud.rtc.api.RCRTCRoom;
import cn.rongcloud.rtc.api.RCRTCRoomConfig;
import cn.rongcloud.rtc.api.callback.IRCRTCEngineEventListener;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
import cn.rongcloud.rtc.base.RCRTCParamsType;
import cn.rongcloud.rtc.base.RCRTCRoomType;
import cn.rongcloud.rtc.base.RCRTCVideoEventCode;
import cn.rongcloud.rtc.base.RTCErrorCode;
import io.agora.beautyapi.faceunity.agora.SWAuManager;
import io.agora.beautyapi.faceunity.agora.SWManager;
import cn.rongcloud.rtc.core.CameraVideoCapturer;
import cn.rongcloud.rtc.core.RendererCommon;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.message.TextMessage;
/**
@ -97,11 +102,13 @@ import io.rong.message.TextMessage;
*/
public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITXLivePushListener {
private int mMeiBaiVal;//基础美颜 美白
private int mMoPiVal;//基础美颜 磨皮
private int mHongRunVal;//基础美颜 红润
private String mBgmPath;//背景音乐路径
private Bitmap mFilterBmp;
private TXDeviceManager mTXDeviceManager;
private TRTCCloudDef.TRTCParams mTRTCParams;
private Handler mMainHandler;
@ -111,6 +118,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
public LinearLayout dr_pk_view;
public static RCRTCRoom rtcRoom;
public static RCRTCLiveInfo rcrtcLiveInfo;
private ViewGroup liveActivityContainer;
public FrameLayout timeTitle;
public TextView textTime;
@ -119,8 +127,6 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
private LinearLayout goto_room_view;
private boolean isPk = false;
private boolean isNeedOpenCamera = false;
private SWManager swManager;
private String pkUid1;
//修改上面主播的头像
@Subscribe(threadMode = ThreadMode.MAIN)
@ -134,6 +140,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
goto_room_view.setVisibility(View.VISIBLE);
} else {
goto_room_view.setVisibility(View.GONE);
}
}
}
@ -231,7 +238,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
UserBean userBean = new UserBean();
userBean.setId(inviterRoomId);
//收到邀请这个时候正在PK或连麦中 自动拒绝对方
if (isPking()) {
if (isPking() == true) {
rtcRoom.getLocalUser().responseJoinOtherRoom(userBean.getId(), userBean.getId(), false, false, "extra", new IRCRTCResultCallback() {
@ -242,7 +249,9 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
@Override
public void onSuccess() {
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 8);
final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LINK_MIC_PK)
.param("action", 8);
msg1.create();
String targetId = userBean.getId();
@ -250,7 +259,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(io.rong.imlib.model.Message message) {
@ -286,7 +295,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
rtcRoom.getLocalUser().responseJoinOtherRoom(userBean.getId(), userBean.getId(), true, true, "LiveDRPK1", new IRCRTCResultCallback() {
@Override
public void onSuccess() {
//mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(userBean.getId(), 2);
mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(userBean.getId(), 2);
}
@Override
@ -301,7 +310,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
JSONObject map = JSONObject.parseObject(extra);
userBean1.setId(map.getString("uid"));
userBean1.setUserNiceName(map.getString("pkname"));
userBean1.setAvatar(map.getString("uhead"));
userBean1.setAvatar(map.getString("pkhead"));
} else {
userBean1.setId(inviterRoomId);
userBean1.setUserNiceName("null");
@ -382,7 +391,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
} else if (agree == true && extra.equals(SOCKET_LIVE_DRPK)) {
mLiveRyLinkMicPkPresenter.onDRLinkMicToPk(inviteeRoomId);
} else if (extra.equals("LiveDRPK1")) {
//mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(inviteeRoomId, 3);
mLiveRyLinkMicPkPresenter.dRjoinOtherRoom(inviteeRoomId, 3);
} else {
Log.e("ry", extra);
UserBean userBean1 = new UserBean();
@ -406,7 +415,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
}
});
@ -462,6 +471,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
}
};
@Override
public void init() {
super.init();
@ -496,231 +506,283 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
aheadOfScheduleEndPK(mPkUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName(), (String) tv_avatarOther_name.getTag());
//断开连麦
LiveRyAnchorActivity.isDRPK = 0;
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout").execute(new HttpCallback() {
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
HttpClient.getInstance().get("Livepk.endPK", "Livepk.endPK").params("uid", CommonAppConfig.getInstance().getUid()).params("addtime", "1").params("type", "1").params("sign", "1").execute(new HttpCallback() {
HttpClient.getInstance().get("Livepk.endPK", "Livepk.endPK")
.params("uid", CommonAppConfig.getInstance().getUid())
.params("addtime", "1")
.params("type", "1")
.params("sign", "1")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
JSONObject datas = JSONObject.parseObject(info[0]);
String pkUid = datas.getString("pkuid");
//退出副房间
// TODO: 2024/4/13 退出对方主播直播间
SWManager.get().exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), pkUid1);
SWManager.get().updateMyChannelView((FrameLayout) mBigContainer);
btn_close.setVisibility(View.GONE);//隐藏连麦按钮
RCRTCEngine.getInstance().leaveOtherRoom(pkUid, true, new IRCRTCResultCallback() {
@Override
public void onSuccess() {
Log.e("ry", "退出房间成功" + pkUid);
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
mPreView1.removeAllViews();
mPreView1.setVisibility(View.GONE);
inputStreamList.clear();
inputStreamList1.clear();
changeToBig();
//清理PK上面对方的头像
EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
closeButtonGone();
}
});
}
SocketSendBean seed_msg = new SocketSendBean().param("_method_", Constants.SOCKET_LINK_MIC_PK).param("action", 9).param("msgtype", 10).param("win_uid", datas.getString("win_uid")).param("uid", CommonAppConfig.getInstance().getUid());
@Override
public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry", pkUid + "退出房间s失败" + rtcErrorCode);
}
});
SocketSendBean seed_msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
.param("action", 9)
.param("msgtype", 10)
.param("win_uid", datas.getString("win_uid"))
.param("uid", CommonAppConfig.getInstance().getUid());
seed_msg.create();
Log.i("seed", seed_msg.mResult.toString());
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + pkUid).params("jsonstr", seed_msg.mResult.toString()).execute(new HttpCallback() {
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2")
.params("GroupId", "g" + pkUid)
.params("jsonstr", seed_msg.mResult.toString())
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + CommonAppConfig.getInstance().getUid()).params("jsonstr", seed_msg.mResult.toString()).execute(new HttpCallback() {
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2")
.params("GroupId", "g" + CommonAppConfig.getInstance().getUid())
.params("jsonstr", seed_msg.mResult.toString())
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
SocketSendBean seed_msgs = new SocketSendBean().param("_method_", Constants.SOCKET_LINK_MIC_PK).param("action", 5).param("msgtype", 10).param("uname", "1").param("uimg", "1").param("pkuid", LiveRyLinkMicPkPresenter.oldmPkUid).param("uid", CommonAppConfig.getInstance().getUid());
SocketSendBean seed_msgs = new SocketSendBean()
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
.param("action", 5)
.param("msgtype", 10)
.param("uname", "1")
.param("uimg", "1")
.param("pkuid", LiveRyLinkMicPkPresenter.oldmPkUid)
.param("uid", CommonAppConfig.getInstance().getUid());
seed_msgs.create();
Log.i("seed", seed_msgs.mResult.toString());
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + LiveRyLinkMicPkPresenter.oldmPkUid).params("jsonstr", seed_msgs.mResult.toString()).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + CommonAppConfig.getInstance().getUid()).params("jsonstr", seed_msgs.mResult.toString()).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
});
}
});
}
});
}
}
});
}
});
}
});
initRtcEngine();
}
/**
* 初始化声网SDK
*/
private void initRtcEngine() {
swManager = SWManager.get();
swManager.setAnchorContainer((FrameLayout) mBigContainer);
swManager.initRtcEngine((Activity) mContext, CommonAppConfig.getInstance().getUid());
swManager.setOnRtcEngineListener(new SWManager.onRtcEngineListener() {
@Override
public void onOpenSuccess(String channel, int uid) {
//开播成功
L.eSw("开播成功");
}
});
}
public void exitChannelDrPk(List<DrPkbean> drPkbeanList){
for (int i = 0; i <drPkbeanList.size(); i++) {
if(!CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeanList.get(i).getId()))){
SWManager.get().exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), String.valueOf(drPkbeanList.get(i).getId()));
}
}
SWManager.get().updateMyChannelView((FrameLayout) mBigContainer);
currentPosition = 0;
drpkUid3 = "";
}
public void setAnPkRtc(UserBean u) {
EventBus.getDefault().post(new AnchorInfoEvent(false, u.getId(), u.getUserNiceName(), u.getAvatar()));
if (swManager != null && u != null) {
//将多人pk画面屏蔽
dr_pk_view.setVisibility(View.GONE);
L.eSw("设置对方主播的视图setAnPkRtc" + u);
pkUid1 = u.getId();
mPkContainer.setVisibility(View.VISIBLE);
//将自己的渲染视图设置到 leftContainer
swManager.updateMyChannelView((FrameLayout) mLeftContainer);
//清除 mBigContainer 中的渲染
mBigContainer.removeAllViews();
btn_close.setVisibility(View.VISIBLE);
//设置对方主播的渲染视图 设置到 rightContainer
swManager.setPkContainer(mRightContainer);
swManager.joinChannelEx(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, u.getId(), SWAuManager.getChannelName(u.getId()));
}
HttpClient.getInstance().get("Livepk.setPK", "Livepk.setPK")
.params("uid", CommonAppConfig.getInstance().getUid())
.params("pkuid", u.getId())
.params("type", "1")
.params("sign", "1")
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2")
.params("GroupId", "g" + LiveRyLinkMicPkPresenter.oldmPkUid)
.params("jsonstr", seed_msgs.mResult.toString())
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msgs, String[] info) {
if (code == 0) {
final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
.param("action", 4)
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
.param("pkuid", u.getId())
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("uid", CommonAppConfig.getInstance().getUid());
msg1.create();
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
Message message1 = Message.obtain("g" + CommonAppConfig.getInstance().getUid(), conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message1, null, null, new IRongCallback.ISendMessageCallback() {
public void onSuccess(int code, String msg, String[] info) {
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2")
.params("GroupId", "g" + CommonAppConfig.getInstance().getUid())
.params("jsonstr", seed_msgs.mResult.toString())
.execute(new HttpCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
public void onSuccess(int code, String msg, String[] info) {
}
});
}
});
}
});
}
});
}
}
});
mLiveRyLinkMicPkPresenter.setPkUserInfoView(u);
}
});
}
});
// 构建 RoomConfig指定房间类型和主播身份
RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create()
// 根据实际场景选择音视频直播LIVE_AUDIO_VIDEO 或音频直播LIVE_AUDIO
.setRoomType(RCRTCRoomType.LIVE_AUDIO_VIDEO)
.setLiveRole(BROADCASTER)
.build();
//调用 RCRTCEngine 下的 joinRoom 方法创建并加入一个直播房间
final CommonAppConfig appConfig = CommonAppConfig.getInstance();
RCRTCEngine.getInstance().joinRoom(appConfig.getUid(), roomConfig, new IRCRTCResultDataCallback<RCRTCRoom>() {
@Override
public void onFailed(RTCErrorCode errorCode) {
ToastUtil.show("开播失败" + errorCode);
}
private int currentPosition = 0;
@Override
public void onSuccess(final RCRTCRoom room) {
private String drpkUid3 = "";
public int setAnDrPkRtc(String uid, int position) {
L.eSw("setAnDrPkRtc uid"+uid+" position"+position);
int temp= -1;
if (swManager != null && !StringUtil.isEmpty(uid)) {
L.eSw("设置对方主播的视图 setAnDrPkRtc" + uid + "position:" + position);
if(currentPosition==0){
position = 2;
}
if(position==-1){
temp = currentPosition+1;
}else{
temp = position;
}
switch (temp) {
// 保存房间对象
rtcRoom = room;
IMRTCManager.getInstance().setRtcRoom(room);
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
RCRTCConfig config = RCRTCConfig.Builder.create()
//是否硬解码
.enableHardwareDecoder(true)
//是否硬编码
.enableHardwareEncoder(true)
.build();
RCRTCEngine.getInstance().init(contexts, config);
RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC_HIGH, RCRTCParamsType.AudioScenario.MUSIC_CHATROOM);
//設置開播分辨率
RCRTCParamsType.RCRTCVideoResolution rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
int minRate = 200;
int maxRate = 900;
switch (IMLoginManager.get(mContext).getSelectClarity()) {
case 0:
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
minRate = 200;
maxRate = 900;
break;
case 1:
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280;
minRate = 250;
maxRate = 2200;
break;
case 2:
swManager.joinChannelDrEx(dr2_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid));
swManager.updateMyChannelView(dr1_preview);
mBigContainer.removeAllViews();
dr3_preview.setVisibility(View.GONE);
dr4_preview.setVisibility(View.GONE);
break;
case 3:
drpkUid3 = uid;
swManager.joinChannelDrEx(dr4_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid));
dr3_preview.setVisibility(View.GONE);
dr4_preview.setVisibility(View.VISIBLE);
break;
case 4:
dr3_preview.setVisibility(View.VISIBLE);
//先退出这个主播的直播间在进入该直播间视图问题暂时這樣處理
swManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()),drpkUid3);
swManager.joinChannelDrEx(dr3_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, drpkUid3, SWAuManager.getChannelName(drpkUid3));
swManager.joinChannelDrEx(dr4_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid));
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_1080_1920;
minRate = 400;
maxRate = 4000;
break;
}
dr_pk_view.setVisibility(View.VISIBLE);
currentPosition = temp;
}
return currentPosition;
RCRTCVideoStreamConfig videoConfigBuilder = RCRTCVideoStreamConfig.Builder.create()
//设置分辨率
.setVideoResolution(rcrtcVideoResolution)
//设置帧率
.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_24)
//设置最小码率480P下推荐200
.setMinRate(minRate)
//设置最大码率480P下推荐900
.setMaxRate(maxRate)
.build();
// 创建本地视频显示视图
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(videoConfigBuilder);
RCRTCEngine.getInstance().getDefaultVideoStream().enableTinyStream(false);
RCRTCVideoView rongRTCVideoView = new RCRTCVideoView(contexts);
rongRTCVideoView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoView(rongRTCVideoView);
RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(new IRCRTCResultDataCallback<Boolean>() {
@Override
public void onSuccess(Boolean data) {
//设置摄像头最大缩放比例
boolean zoom = RCRTCEngine.getInstance().getDefaultVideoStream().setCameraZoomFactor(1.0f);
// ToastUtil.show("设置比例="+zoom);
Log.i("摄像头", "onSuccess: 打开摄像头");
isNeedOpenCamera = false;
}
public void anchorClose(){
swManager.updateMyChannelView((FrameLayout) mBigContainer); //用户主动断开连麦再退出画面
@Override
public void onFailed(RTCErrorCode errorCode) {
Log.i("摄像头", "onFailed: 打开摄像头失败 " + errorCode);
}
});
RCRTCEngine.getInstance().registerEventListener(new IRCRTCEngineEventListener() {
@Override
public void onKicked(String roomId, RCRTCParamsType.RCRTCKickedReason kickedReason) {
}
public void onLinkMicAnchorClose() {
//swManager.updateMyChannelView((FrameLayout) mBigContainer); 用户主动断开连麦再退出画面
//LivePushRyViewHolder.btn_close.setVisibility(View.GONE);
@Override
public void onError(RTCErrorCode errorCode) {
super.onError(errorCode);
Log.i("摄像头", "onError: 错误码" + errorCode);
}
public void onLinkDRMicPkApply(UserBean userBean) {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean);
@Override
public void onLocalVideoEventNotify(RCRTCVideoEventCode event) {
super.onLocalVideoEventNotify(event);
Log.i("摄像头", "onLocalVideoEventNotify: 本地视频事件" + event.code);
if (event.code == 3) {
isNeedOpenCamera = true;
}
}
});
//设置摄像头最大缩放比例
// RCRTCEngine.getInstance().getDefaultVideoStream().setCameraZoomFactor(RCRTCEngine.getInstance().getDefaultVideoStream().getCameraMaxZoomFactor());
mPreView.addView(rongRTCVideoView);
tencentTRTCBeautyManager = new TencentTRTCBeautyManager(mContext);
//加入房间成功后可以通过 RCRTCLocalUser 对象发布本地默认音视频流包括麦克风采集的音频和摄像头采集的视频
RCRTCEngine.getInstance().getDefaultVideoStream().setEncoderMirror(true);
if (rtcRoom == null || rtcRoom.getLocalUser() == null) {
if (room == null || room.getLocalUser() == null) {
ToastUtil.show("开播失败 请稍后再试,错误代码:room is null");
((LiveRyAnchorActivity) mContext).endLives();
return;
}
rtcRoom = room;
IMRTCManager.getInstance().setRtcRoom(room);
}
rtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() {
@Override
public void onSuccess(RCRTCLiveInfo rcrtcLiveInfo1) {
rcrtcLiveInfo = rcrtcLiveInfo1;
room.registerRoomListener(roomEventsListener);
//美颜
// new Handler(Looper.getMainLooper()).post(new Runnable() {
// public void run() {
// //旧美颜不需要了
//
//
// }
// });
}
@Override
public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry", "rtcErrorCode" + rtcErrorCode);
}
});
}
});
}
});
}
@Override
public void changeToLeft() {
if (mPreView != null) {
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mPreView.getLayoutParams();
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mPreView.getLayoutParams();
params.width = mPreView.getWidth() / 2;
params.height = DpUtil.dp2px(mPreView.getHeight());
params.height = DpUtil.dp2px(250);
params.topMargin = DpUtil.dp2px(130);
camera.setLayoutParams(params);
}
@ -754,7 +816,17 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
} else {
mCameraFront = true;
}
swManager.switchCamera();
RCRTCEngine.getInstance().getDefaultVideoStream().switchCamera(new CameraVideoCapturer.CameraSwitchHandler() {
@Override
public void onCameraSwitchDone(boolean isFrontCamera) {
}
@Override
public void onCameraSwitchError(String errorDescription) {
}
});
}
/**
@ -766,6 +838,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
ToastUtil.show(mContext.getString(R.string.live_open_flash));
return;
}
}
/**
@ -775,10 +848,6 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
*/
@Override
public void startPush(String pushUrl) {
//开播成功创建频道
if (swManager != null) {
swManager.createChannel(CommonAppConfig.SWToken, CommonAppConfig.getChannelName());
}
if (rcrtcLiveInfo != null) {
rcrtcLiveInfo.addPublishStreamUrl(pushUrl, new IRCRTCResultDataCallback<String[]>() {
@Override
@ -878,7 +947,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
public void onResume() {
mPaused = false;
Log.i("摄像头", "onResume: " + isNeedOpenCamera);
if (isNeedOpenCamera) {
if(isNeedOpenCamera){
RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(new IRCRTCResultDataCallback<Boolean>() {
@Override
public void onSuccess(Boolean data) {
@ -901,6 +970,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
public void startBgm(String path) {
mBgmPath = path;
}
@Override
@ -968,13 +1038,23 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
}
String ct = "由於 " + uname + " 退出比賽," + pkname + " 獲得勝利";
SocketSendBean seed_msg = new SocketSendBean().param("_method_", Constants.SOCKET_SYSTEM).param("action", 1).param("ct", ct);
SocketSendBean seed_msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SYSTEM)
.param("action", 1)
.param("ct", ct);
seed_msg.create();
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + pkUid).params("jsonstr", seed_msg.mResult.toString()).execute(new HttpCallback() {
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2")
.params("GroupId", "g" + pkUid)
.params("jsonstr", seed_msg.mResult.toString())
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
HttpClient.getInstance().post("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + CommonAppConfig.getInstance().getUid()).params("jsonstr", seed_msg.mResult.toString()).execute(new HttpCallback() {
HttpClient.getInstance().post("Tx.sendmsgzs2", "Tx.sendmsgzs2")
.params("GroupId", "g" + CommonAppConfig.getInstance().getUid())
.params("jsonstr", seed_msg.mResult.toString())
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@ -1016,12 +1096,6 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
});
}
public void setEnableBeauty(boolean flag) {
if (swManager != null) {
swManager.setEnableBeauty(flag);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateSub(LiveAudienceEvent event) {
if (event.getType() == LIVE_PK_END) {
@ -1031,12 +1105,4 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
}
Log.i("PK----->", "updateSub: " + isPk + "|" + event.getType());
}
@Override
public void onDestroy() {
super.onDestroy();
if (swManager != null) {
swManager.exitChannelAll();
}
}
}

View File

@ -0,0 +1,731 @@
package com.yunbao.live.views;
import static com.yunbao.live.activity.LiveActivity.mLiveSwLinkMicPkPresenter;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.LIVE_PK_END;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.LIVE_PK_ING;
import static com.yunbao.live.presenter.LiveSwLinkMicPkPresenter.inputStreamList;
import static com.yunbao.live.presenter.LiveSwLinkMicPkPresenter.inputStreamList1;
import static com.yunbao.live.presenter.LiveSwLinkMicPkPresenter.mPkUid;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSONObject;
import com.tencent.rtmp.ITXLivePushListener;
import com.tencent.rtmp.TXLiveConstants;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.LivePushRyEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.bean.DrPkbean;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.common.http.LiveHttpConsts;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveSwLinkMicPkPresenter;
import com.yunbao.live.socket.SocketSendBean;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.RCRTCMixConfig;
import cn.rongcloud.rtc.api.RCRTCRoom;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
import cn.rongcloud.rtc.base.RCRTCParamsType;
import cn.rongcloud.rtc.base.RTCErrorCode;
import io.agora.beautyapi.faceunity.agora.SWAuManager;
import io.agora.beautyapi.faceunity.agora.SWManager;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.message.TextMessage;
/**
* Created by cxf on 2018/10/7.
* 腾讯云直播推流
*/
public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITXLivePushListener {
private int mMeiBaiVal;//基础美颜 美白
private int mMoPiVal;//基础美颜 磨皮
private int mHongRunVal;//基础美颜 红润
private String mBgmPath;//背景音乐路径
private Bitmap mFilterBmp;
private Handler mMainHandler;
public static Context contexts;
public static TextView btn_close;
public LinearLayout dr_pk_view;
public static RCRTCRoom rtcRoom;
public static RCRTCLiveInfo rcrtcLiveInfo;
private ViewGroup liveActivityContainer;
public FrameLayout timeTitle;
public TextView textTime;
private TextView tv_avatarOther_name;
private ImageView avatarOther;
private LinearLayout goto_room_view;
private boolean isPk = false;
private boolean isNeedOpenCamera = false;
private SWManager swManager;
private String pkUid1;
//修改上面主播的头像
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUPAnchorInfo(AnchorInfoEvent e) {
Log.i(TAG, "onUPAnchorInfo: " + e);
if (e != null) {
if (!e.isClear()) {
tv_avatarOther_name.setText(e.getUserNiceName());
tv_avatarOther_name.setTag(e.getUserNiceName());
ImgLoader.displayAvatar(mContext, e.getAvatar(), avatarOther);
goto_room_view.setVisibility(View.VISIBLE);
} else {
goto_room_view.setVisibility(View.GONE);
}
}
}
public LivePushSwViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
this.contexts = context;
EventBus.getDefault().register(this);
}
@Override
protected int getLayoutId() {
return R.layout.view_live_push_sw;
}
public void setLiveActivityContainer(ViewGroup liveActivityContainer) {
this.liveActivityContainer = liveActivityContainer;
}
@Override
public void init() {
super.init();
Bus.getOn(this);
mPreView = (FrameLayout) findViewById(R.id.camera_preview);
camera = (LinearLayout) findViewById(R.id.camera);
mPreView1 = (FrameLayout) findViewById(R.id.camera_preview1);
cameraPreview3 = (FrameLayout) findViewById(R.id.camera_preview3);
dr1_preview = (FrameLayout) findViewById(R.id.dr1_preview);
dr2_preview = (FrameLayout) findViewById(R.id.dr2_preview);
dr3_preview = (FrameLayout) findViewById(R.id.dr3_preview);
dr4_preview = (FrameLayout) findViewById(R.id.dr4_preview);
leave = (ImageView) findViewById(R.id.leave);
dr_pk_view = (LinearLayout) findViewById(R.id.dr_pk_view);
timeTitle = (FrameLayout) findViewById(R.id.time_title);
textTime = (TextView) findViewById(R.id.text_time);
dr_pk_view.setVisibility(View.GONE);
cameraPreview3.setVisibility(View.GONE);
btn_close = (TextView) findViewById(R.id.btn_close);
tv_avatarOther_name = (TextView) findViewById(R.id.tv_avatarOther_name);
avatarOther = (ImageView) findViewById(R.id.avatarOther);
goto_room_view = (LinearLayout) findViewById(R.id.goto_room_view);
goto_room_view.setVisibility(View.GONE);
mMainHandler = new Handler(Looper.getMainLooper());
btn_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DialogUitl.showSimpleDialog(mContext, WordUtil.isNewZh() ? "是否要斷開連麥?" : "Do you want to disconnect Link?", new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
Log.i("PK----->", "updateSub: " + isPk + "|");
aheadOfScheduleEndPK(mPkUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName(), (String) tv_avatarOther_name.getTag());
//断开连麦
LiveSwAnchorActivity.isDRPK = 0;
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout").execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
HttpClient.getInstance().get("Livepk.endPK", "Livepk.endPK").params("uid", CommonAppConfig.getInstance().getUid()).params("addtime", "1").params("type", "1").params("sign", "1").execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
JSONObject datas = JSONObject.parseObject(info[0]);
String pkUid = datas.getString("pkuid");
//退出副房间
// TODO: 2024/4/13 退出对方主播直播间
SWManager.get().exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), pkUid1);
SWManager.get().updateMyChannelView((FrameLayout) mBigContainer);
btn_close.setVisibility(View.GONE);//隐藏连麦按钮
EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
closeButtonGone();
SocketSendBean seed_msg = new SocketSendBean().param("_method_", Constants.SOCKET_LINK_MIC_PK).param("action", 9).param("msgtype", 10).param("win_uid", datas.getString("win_uid")).param("uid", CommonAppConfig.getInstance().getUid());
seed_msg.create();
Log.i("seed", seed_msg.mResult.toString());
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + pkUid).params("jsonstr", seed_msg.mResult.toString()).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + CommonAppConfig.getInstance().getUid()).params("jsonstr", seed_msg.mResult.toString()).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
SocketSendBean seed_msgs = new SocketSendBean().param("_method_", Constants.SOCKET_LINK_MIC_PK).param("action", 5).param("msgtype", 10).param("uname", "1").param("uimg", "1").param("pkuid", LiveSwLinkMicPkPresenter.oldmPkUid).param("uid", CommonAppConfig.getInstance().getUid());
seed_msgs.create();
Log.i("seed", seed_msgs.mResult.toString());
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + LiveSwLinkMicPkPresenter.oldmPkUid).params("jsonstr", seed_msgs.mResult.toString()).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + CommonAppConfig.getInstance().getUid()).params("jsonstr", seed_msgs.mResult.toString()).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
});
}
});
}
});
}
}
});
}
});
}
});
initRtcEngine();
}
/**
* 初始化声网SDK
*/
private void initRtcEngine() {
swManager = SWManager.get();
swManager.setAnchorContainer((FrameLayout) mBigContainer);
swManager.initRtcEngine((Activity) mContext, CommonAppConfig.getInstance().getUid());
swManager.setOnRtcEngineListener(new SWManager.onRtcEngineListener() {
@Override
public void onOpenSuccess(String channel, int uid) {
//开播成功
L.eSw("开播成功");
}
});
}
public void exitChannelDrPk(List<DrPkbean> drPkbeanList){
for (int i = 0; i <drPkbeanList.size(); i++) {
if(!CommonAppConfig.getInstance().getUid().equals(String.valueOf(drPkbeanList.get(i).getId()))){
SWManager.get().exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), String.valueOf(drPkbeanList.get(i).getId()));
}
}
SWManager.get().updateMyChannelView((FrameLayout) mBigContainer);
currentPosition = 0;
drpkUid3 = "";
}
public void setAnPkRtc(UserBean u) {
EventBus.getDefault().post(new AnchorInfoEvent(false, u.getId(), u.getUserNiceName(), u.getAvatar()));
if (swManager != null && u != null) {
//将多人pk画面屏蔽
dr_pk_view.setVisibility(View.GONE);
L.eSw("设置对方主播的视图setAnPkRtc" + u);
pkUid1 = u.getId();
mPkContainer.setVisibility(View.VISIBLE);
//将自己的渲染视图设置到 leftContainer
swManager.updateMyChannelView((FrameLayout) mLeftContainer);
//清除 mBigContainer 中的渲染
mBigContainer.removeAllViews();
btn_close.setVisibility(View.VISIBLE);
//设置对方主播的渲染视图 设置到 rightContainer
swManager.setPkContainer(mRightContainer);
swManager.joinChannelEx(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, u.getId(), SWAuManager.getChannelName(u.getId()));
}
HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive")
.params("uid", CommonAppConfig.getInstance().getUid())
.params("pkuid", u.getId())
.params("type", "1")
.params("sign", "1")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msgs, String[] info) {
if (code == 0) {
HttpClient.getInstance().get("Livepk.setPK", "Livepk.setPK")
.params("uid", CommonAppConfig.getInstance().getUid())
.params("pkuid", u.getId())
.params("type", "1")
.params("sign", "1")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msgs, String[] info) {
if (code == 0) {
final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
.param("action", 4)
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
.param("pkuid", u.getId())
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("uid", CommonAppConfig.getInstance().getUid());
msg1.create();
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
Message message1 = Message.obtain("g" + CommonAppConfig.getInstance().getUid(), conversationType, messageContent);
RongIMClient.getInstance().sendMessage(message1, null, null, new IRongCallback.ISendMessageCallback() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
Log.i("tx", "发送成功");
}
@Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
}
});
}
}
});
}
}
});
mLiveSwLinkMicPkPresenter.setPkUserInfoView(u);
}
private int currentPosition = 0;
private String drpkUid3 = "";
public int setAnDrPkRtc(String uid, int position) {
L.eSw("setAnDrPkRtc uid"+uid+" position"+position);
int temp= -1;
if (swManager != null && !StringUtil.isEmpty(uid)) {
L.eSw("设置对方主播的视图 setAnDrPkRtc" + uid + "position:" + position);
if(currentPosition==0){
position = 2;
}
if(position==-1){
temp = currentPosition+1;
}else{
temp = position;
}
switch (temp) {
case 2:
swManager.joinChannelDrEx(dr2_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid));
swManager.updateMyChannelView(dr1_preview);
mBigContainer.removeAllViews();
dr3_preview.setVisibility(View.GONE);
dr4_preview.setVisibility(View.GONE);
break;
case 3:
drpkUid3 = uid;
swManager.joinChannelDrEx(dr4_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid));
dr3_preview.setVisibility(View.GONE);
dr4_preview.setVisibility(View.VISIBLE);
break;
case 4:
dr3_preview.setVisibility(View.VISIBLE);
//先退出这个主播的直播间在进入该直播间视图问题暂时這樣處理
swManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()),drpkUid3);
swManager.joinChannelDrEx(dr3_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, drpkUid3, SWAuManager.getChannelName(drpkUid3));
swManager.joinChannelDrEx(dr4_preview,CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid));
break;
}
dr_pk_view.setVisibility(View.VISIBLE);
currentPosition = temp;
}
return currentPosition;
}
public void anchorClose(){
swManager.updateMyChannelView((FrameLayout) mBigContainer); //用户主动断开连麦再退出画面
}
public void onLinkMicAnchorClose() {
//swManager.updateMyChannelView((FrameLayout) mBigContainer); 用户主动断开连麦再退出画面
//LivePushRyViewHolder.btn_close.setVisibility(View.GONE);
}
public void onLinkDRMicPkApply(UserBean userBean) {
if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.onLinkDRMicPkApply(userBean);
}
}
@Override
public void changeToLeft() {
if (mPreView != null) {
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mPreView.getLayoutParams();
params.width = mPreView.getWidth() / 2;
params.height = DpUtil.dp2px(mPreView.getHeight());
params.topMargin = DpUtil.dp2px(130);
camera.setLayoutParams(params);
}
}
@Override
public void changeToBig() {
if (camera != null) {
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) camera.getLayoutParams();
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
params.topMargin = 0;
camera.setLayoutParams(params);
}
if (mPreView1.getVisibility() == View.VISIBLE) {
mPreView1.removeAllViews();
mPreView1.setVisibility(View.GONE);
inputStreamList.clear();
inputStreamList1.clear();
}
}
public void closeButtonGone() {
btn_close.setVisibility(View.GONE);
}
@Override
public void toggleCamera() {
if (mCameraFront) {
mCameraFront = false;
} else {
mCameraFront = true;
}
swManager.switchCamera();
}
/**
* 打开关闭闪光灯
*/
@Override
public void toggleFlash() {
if (mCameraFront) {
ToastUtil.show(mContext.getString(R.string.live_open_flash));
return;
}
}
/**
* 开始推流
*
* @param pushUrl 推流地址
*/
@Override
public void startPush(String pushUrl) {
//开播成功创建频道
if (swManager != null) {
swManager.createChannel(CommonAppConfig.SWToken, CommonAppConfig.getChannelName());
}
if (rcrtcLiveInfo != null) {
rcrtcLiveInfo.addPublishStreamUrl(pushUrl, new IRCRTCResultDataCallback<String[]>() {
@Override
public void onSuccess(String[] data) {
//强制设置开播后cdn的尺寸竖屏因为有时候PK异常退出cdn没有还原竖屏
if (rtcRoom != null) {
RCRTCMixConfig config = new RCRTCMixConfig();
RCRTCMixConfig.MediaConfig mediaConfig = new RCRTCMixConfig.MediaConfig();
config.setMediaConfig(mediaConfig);
//视频输出配置
RCRTCMixConfig.MediaConfig.VideoConfig videoConfig = new RCRTCMixConfig.MediaConfig.VideoConfig();
mediaConfig.setVideoConfig(videoConfig);
//大流视频的输出参数
RCRTCMixConfig.MediaConfig.VideoConfig.VideoLayout normal = new RCRTCMixConfig.MediaConfig.VideoConfig.VideoLayout();
//推荐宽帧率参数值可以通过默认视频流的配置获取也可以根据实际需求来自定义设置
//如不设置宽高值则服务端将使用默认宽高 360 * 640
//:发布的视频分辨率为720 * 1280如果不设置则观众端看到的视频分辨率为 360 * 640,
//所以如果想让观众端看到的视频分辨率和发布视频分辨率一致则应从发布的视频流中获取分辨率配置并设置到 mediaConfig
//設置開播分辨率
//設置開播分辨率
RCRTCParamsType.RCRTCVideoResolution rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
int minRate = 200;
int maxRate = 900;
switch (IMLoginManager.get(mContext).getSelectClarity()) {
case 0:
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
break;
case 1:
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280;
break;
case 2:
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_1080_1920;
break;
}
int width = rcrtcVideoResolution.getWidth();
int height = rcrtcVideoResolution.getHeight();
normal.setWidth(width); //视频宽
normal.setHeight(height); //视频高
normal.setFps(15); //视频帧率
videoConfig.setVideoLayout(normal);
//2. 合流画布设置
//(请参照画布和声音配置示例代码)
//3. 假设以画布设置的宽高为 300 * 300为例(应以真实设置的宽高为准)设置每个视频流小窗口的坐标及宽高
ArrayList<RCRTCMixConfig.CustomLayoutList.CustomLayout> list = new ArrayList<>();
config.setCustomLayouts(list);
//user1的视频流
RCRTCMixConfig.CustomLayoutList.CustomLayout videoLayout1 = new RCRTCMixConfig.CustomLayoutList.CustomLayout();
list.add(videoLayout1);
videoLayout1.setVideoStream(RCRTCEngine.getInstance().getDefaultVideoStream()); // RCRTCStream#MediaType 必须是Video
videoLayout1.setX(0); //X 坐标
videoLayout1.setY(0); //Y 坐标
videoLayout1.setWidth(720); // 视频窗口的宽
videoLayout1.setHeight(1280); // 视频窗口的高
//2. 合流画布设置
rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() {
@Override
public void onSuccess() {
Log.e("ry", "混成功12");
}
@Override
public void onFailed(RTCErrorCode errorCode) {
Log.e("ry", "混失败" + errorCode);
}
});
}
}
@Override
public void onFailed(RTCErrorCode errorCode) {
}
});
startCountDown();
} else {
ToastUtil.show("请稍后,准备中....");
}
}
public boolean isPking() {
if (btn_close != null) {
return btn_close.getVisibility() == View.VISIBLE;
}
return false;
}
@Override
public void onPause() {
mPaused = true;
}
@Override
public void onResume() {
mPaused = false;
Log.i("摄像头", "onResume: " + isNeedOpenCamera);
if (isNeedOpenCamera) {
RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(new IRCRTCResultDataCallback<Boolean>() {
@Override
public void onSuccess(Boolean data) {
//设置摄像头最大缩放比例
boolean zoom = RCRTCEngine.getInstance().getDefaultVideoStream().setCameraZoomFactor(1.0f);
// ToastUtil.show("设置比例="+zoom);
Log.i("摄像头", "onSuccess: 打开摄像头");
isNeedOpenCamera = false;
}
@Override
public void onFailed(RTCErrorCode errorCode) {
Log.i("摄像头", "onFailed: 打开摄像头失败 " + errorCode);
}
});
}
}
@Override
public void startBgm(String path) {
mBgmPath = path;
}
@Override
public void pauseBgm() {
}
@Override
public void resumeBgm() {
}
@Override
public void stopBgm() {
mBgmPath = null;
}
@Override
public void release() {
super.release();
Bus.getOff(this);
LiveHttpUtil.cancel(LiveHttpConsts.LINK_MIC_TX_MIX_STREAM);
rtcRoom = null;
}
@Override
public void onPushEvent(int e, Bundle bundle) {
if (e == TXLiveConstants.PUSH_ERR_OPEN_CAMERA_FAIL) {
ToastUtil.show(mContext.getString(R.string.live_push_failed_1));
} else if (e == TXLiveConstants.PUSH_ERR_OPEN_MIC_FAIL) {
ToastUtil.show(mContext.getString(R.string.live_push_failed_2));
} else if (e == TXLiveConstants.PUSH_ERR_NET_DISCONNECT || e == TXLiveConstants.PUSH_ERR_INVALID_ADDRESS) {
L.e(TAG, "网络断开,推流失败------>");
} else if (e == TXLiveConstants.PUSH_WARNING_HW_ACCELERATION_FAIL) {
L.e(TAG, "不支持硬件加速------>");
} else if (e == TXLiveConstants.PUSH_EVT_FIRST_FRAME_AVAILABLE) {//预览成功
L.e(TAG, "mStearm--->初始化完毕");
if (mLivePushListener != null) {
mLivePushListener.onPreviewStart();
}
} else if (e == TXLiveConstants.PUSH_EVT_PUSH_BEGIN) {//推流成功
L.e(TAG, "mStearm--->推流成功");
if (!mStartPush) {
mStartPush = true;
if (mLivePushListener != null) {
mLivePushListener.onPushStart();
}
}
}
}
@Override
public void onNetStatus(Bundle bundle) {
}
private void aheadOfScheduleEndPK(String pkUid, String uname, String pkname) {
if (!isPk) {
return;
}
String ct = "由於 " + uname + " 退出比賽," + pkname + " 獲得勝利";
SocketSendBean seed_msg = new SocketSendBean().param("_method_", Constants.SOCKET_SYSTEM).param("action", 1).param("ct", ct);
seed_msg.create();
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + pkUid).params("jsonstr", seed_msg.mResult.toString()).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
HttpClient.getInstance().post("Tx.sendmsgzs2", "Tx.sendmsgzs2").params("GroupId", "g" + CommonAppConfig.getInstance().getUid()).params("jsonstr", seed_msg.mResult.toString()).execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
});
}
private Bitmap decodeResource(Resources resources, int id) {
TypedValue value = new TypedValue();
resources.openRawResource(id, value);
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inTargetDensity = value.density;
return BitmapFactory.decodeResource(resources, id, opts);
}
public static String getLiveStream() {
return ((LiveActivity) contexts).getStream();
}
private String getTxAppId() {
return ((LiveActivity) mContext).getTxAppId();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void setSelectClarity(LivePushRyEvent event) {
if (rtcRoom != null)
rtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() {
@Override
public void onSuccess(RCRTCLiveInfo rcrtcLiveInfo1) {
rcrtcLiveInfo = rcrtcLiveInfo1;
}
@Override
public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry", "rtcErrorCode" + rtcErrorCode);
}
});
}
public void setEnableBeauty(boolean flag) {
if (swManager != null) {
swManager.setEnableBeauty(flag);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateSub(LiveAudienceEvent event) {
if (event.getType() == LIVE_PK_END) {
isPk = false;
} else if (event.getType() == LIVE_PK_ING) {
isPk = true;
}
Log.i("PK----->", "updateSub: " + isPk + "|" + event.getType());
}
@Override
public void onDestroy() {
super.onDestroy();
if (swManager != null) {
swManager.exitChannelAll();
}
}
}

View File

@ -34,7 +34,7 @@ import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveChooseClassActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.adapter.LiveReadyShareAdapter;
import com.yunbao.common.bean.LiveRoomTypeBean;
import com.yunbao.live.dialog.LiveRoomTypeDialogFragment;
@ -123,7 +123,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
@Override
public void beforeCamera() {
((LiveRyAnchorActivity) mContext).beforeCamera();
((LiveSwAnchorActivity) mContext).beforeCamera();
}
@Override
@ -218,8 +218,8 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
public void openWishListWindow() {
LiveWishListDialogFragment fragment = new LiveWishListDialogFragment();
if (mContext instanceof LiveRyAnchorActivity){
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "RY");
if (mContext instanceof LiveSwAnchorActivity){
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "RY");
}
}
@ -281,14 +281,14 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
* 切换镜头
*/
private void toggleCamera() {
((LiveRyAnchorActivity) mContext).toggleCamera();
((LiveSwAnchorActivity) mContext).toggleCamera();
}
/**
* 关闭
*/
private void close() {
((LiveRyAnchorActivity) mContext).endLives();
((LiveSwAnchorActivity) mContext).endLives();
}
/**
@ -309,7 +309,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
* 设置美颜
*/
private void beauty() {
((LiveRyAnchorActivity) mContext).beauty();
((LiveSwAnchorActivity) mContext).beauty();
// Intent intent = new Intent(mContext, Beauty360Activity3.class);
// mContext.startActivity(intent);
@ -324,7 +324,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
LiveRoomTypeDialogFragment fragment = new LiveRoomTypeDialogFragment();
fragment.setArguments(bundle);
fragment.setCallback(mLiveTypeCallback);
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
}
/**
@ -398,7 +398,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
mLiveTimeCoin = coin;
}
});
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveTimeDialogFragment");
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveTimeDialogFragment");
}
public void hide() {
@ -418,7 +418,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
* 点击开始直播按钮
*/
private void startLive() {
boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview();
boolean startPreview = ((LiveSwAnchorActivity) mContext).isStartPreview();
// if (!startPreview) {
// ToastUtil.show(R.string.please_wait);
// return;
@ -471,7 +471,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
return;
}
String title = mEditTitle.getText().toString().trim();
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile,0, new HttpCallback() {
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile,0, false,new HttpCallback() {
@Override
public void onSuccess(int code, String msg, final String[] info) {
if (code == 0 && info.length > 0) {
@ -480,7 +480,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
final CommonAppConfig appConfig = CommonAppConfig.getInstance();
UserBean u = appConfig.getUserBean();
((LiveRyAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal);
((LiveSwAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal);
//
// RongChatRoomClient.getInstance().joinChatRoom("g" + appConfig.getUid(), -1, new IRongCoreCallback.OperationCallback() {
// @Override

View File

@ -492,7 +492,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
return;
}
String title = mEditTitle.getText().toString().trim();
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, 0, new HttpCallback() {
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, 0, false,new HttpCallback() {
@Override
public void onSuccess(int code, String msg, final String[] info) {
if (code == 0 && info.length > 0) {

View File

@ -90,6 +90,7 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
public void setViewDrMic() {
}
public void setViewDrPk() {
}
@ -115,6 +116,17 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
public void clearFrame() {
}
public abstract void endPk();
public abstract void endpk(String liveUid);
public abstract void initSwEngine(String liveUid);
public abstract void removeDetailView();
public abstract void setPkView(String liveUid);
public abstract void claerDrPkInfoView();
public interface OnMicCallback {

View File

@ -148,7 +148,7 @@ import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.adapter.LiveChatAdapter;
import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter;
@ -1263,7 +1263,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
topBanner1 = (Banner) findViewById(R.id.top_banner1);
topBanner2 = (Banner) findViewById(R.id.top_banner2);
if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) {
if (LivePushTxViewHolder.mTRTCCloud != null || LivePushSwViewHolder.rtcRoom != null) {
fans_btn.setVisibility(View.GONE);
}
mPkRankTopIcon.setVisibility(View.GONE);
@ -1579,7 +1579,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
// fastMsgRecyclerView.setItemAnimator(new DefaultItemAnimator());
//主播页面隐藏头部
if (mContext instanceof LiveRyAnchorActivity) {
if (mContext instanceof LiveSwAnchorActivity) {
findViewById(R.id.open_sidebar).setVisibility(View.GONE);
findViewById(R.id.btn_follow).setVisibility(View.GONE);
findViewById(R.id.live_rank_pk).setVisibility(View.GONE);
@ -1739,7 +1739,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
redSchedule.setText(stringBuffer.toString());
openRedPacket.setText(String.format(mContext.getString(R.string.open_red_packet), mRedPacketModel.getRedPacketCount() + ""));
}
if (IMLoginManager.get(mContext).getUserInfo().anchorUserType() && mContext instanceof LiveRyAnchorActivity) {
if (IMLoginManager.get(mContext).getUserInfo().anchorUserType() && mContext instanceof LiveSwAnchorActivity) {
anchorTimeHandler.removeCallbacks(anchorTimeRunnable);
anchorTimeHandler.post(anchorTimeRunnable);
}
@ -1751,7 +1751,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override
public void onViewClicks() {
if (!(mContext instanceof LiveRyAnchorActivity)) {
if (!(mContext instanceof LiveSwAnchorActivity)) {
LiveNetManager.get(mContext)
.redPacketInfo(mLiveUid, redPacketModel.getRedPacketId(), new com.yunbao.common.http.base.HttpCallback<RedPacketInfoModel>() {
@Override
@ -1885,7 +1885,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (d_pk_view != null) {
d_pk_view.setVisibility(View.GONE);
}
if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) {
if (LivePushTxViewHolder.mTRTCCloud != null || LivePushSwViewHolder.rtcRoom != null) {
fans_btn.setVisibility(View.GONE);
}
mRedVal.setVisibility(View.GONE);
@ -3029,7 +3029,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
bundle.putString("toUid", toUid);
bundle.putInt("isAttention", isAttention);
bundle.putBoolean("isLive", isAnchor);
bundle.putBoolean("SBW", !(mContext instanceof LiveRyAnchorActivity));
bundle.putBoolean("SBW", !(mContext instanceof LiveSwAnchorActivity));
giftWallDialog.setArguments(bundle);
giftWallDialog.show(((AbsActivity) mContext).getSupportFragmentManager(), "GiftWallDialog");
@ -3387,7 +3387,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
//直播间 粉丝排行榜
openMedalRankWindow();
} else if (i == R.id.btn_guard) {
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveSwAnchorActivity);
} else if (i == R.id.btn_red_pack) {
((LiveActivity) mContext).openRedPackListWindow();
@ -3395,13 +3395,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
((LiveActivity) mContext).openPrizePoolWindow();
} else if (i == R.id.user_more) {
MobclickAgent.onEvent(mContext, "live_room_audience_list", "直播间上面点观众列表按钮");
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveSwAnchorActivity);
} else if (i == R.id.hot_btn) {
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveSwAnchorActivity);
} else if (i == R.id.noble_seat) {
MobclickAgent.onEvent(mContext, "live_room_noble", "贵族按钮");
((LiveActivity) mContext).openUserMoreListWindow(1, false, true, mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openUserMoreListWindow(1, false, true, mContext instanceof LiveSwAnchorActivity);
} else if (i == R.id.btn_close) {
// if (sudGameMin!=null&&sudGameMin.getVisibility()==View.VISIBLE) {
// new XPopup.Builder(mContext)
@ -3434,7 +3434,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} else if (i == R.id.user_guard) {
MobclickAgent.onEvent(mContext, "anchor_avatar_guard", "守护按钮");
// ((LiveActivity) mContext).openUserMoreListWindow(2, true);
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveSwAnchorActivity);
}
if (i == R.id.lt_trickery) {
showTrickeryDialog();
@ -3459,7 +3459,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* @param in 展示的view
*/
private void changeMsgView(View out, View in) {
if (mContext instanceof LiveRyAnchorActivity) {
if (mContext instanceof LiveSwAnchorActivity) {
return;
}
if (in.getVisibility() == View.VISIBLE) {
@ -3669,23 +3669,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAnchorActivity) mContext).onBackPressed();
}
} else if (mContext instanceof LiveRyAnchorActivity) {
} else if (mContext instanceof LiveSwAnchorActivity) {
if (forAct == 1) {
//是否关注0==没关注
if (isAttention == 0) {
if (isStayRoomfive) {
showFollowDialog(mNameText, mAvatarUrl, mContext);
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
LiveSwAnchorActivity.backIndex = 1;
((LiveSwAnchorActivity) mContext).onBackPressed();
}
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
LiveSwAnchorActivity.backIndex = 1;
((LiveSwAnchorActivity) mContext).onBackPressed();
}
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
LiveSwAnchorActivity.backIndex = 1;
((LiveSwAnchorActivity) mContext).onBackPressed();
}
}
}
@ -4840,7 +4840,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
lt_trickster_salvation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mContext instanceof LiveRyAnchorActivity) {
if (mContext instanceof LiveSwAnchorActivity) {
dialog.dismiss();
return;
}
@ -4883,7 +4883,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}

View File

@ -1,8 +1,8 @@
package com.yunbao.live.views;
import static com.yunbao.live.activity.LiveActivity.mLiveUid;
import static com.yunbao.live.activity.LiveRyAnchorActivity.PKing;
import static com.yunbao.live.activity.LiveRyAnchorActivity.pk_nub;
import static com.yunbao.live.activity.LiveSwAnchorActivity.PKing;
import static com.yunbao.live.activity.LiveSwAnchorActivity.pk_nub;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.START_MESSAGE;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE;
@ -44,6 +44,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.bean.WishlistModel;
import com.yunbao.live.dialog.LiveHDDialogFragment;
@ -173,7 +174,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
if (yaoqing.size() < 3) {
if (PKing == false) {
((LiveRyAnchorActivity) mContext).openLinkMicAnchorWindow(true);
((LiveSwAnchorActivity) mContext).openLinkMicAnchorWindow(true);
} else {
ToastUtil.show(WordUtil.isNewZh() ? "您已在PK中" : "You are already in the PK");
}
@ -241,7 +242,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
* 关闭直播
*/
private void close() {
((LiveRyAnchorActivity) mContext).closeLive();
((LiveSwAnchorActivity) mContext).closeLive();
}
@Override
@ -257,8 +258,12 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
if (mBtnFunction != null) {
mBtnFunction.setImageDrawable(mDrawable1);
}
if(mContext instanceof LiveSwAnchorActivity){
((LiveSwAnchorActivity) mContext).showFunctionDialog();
}else{
((LiveRyAnchorActivity) mContext).showFunctionDialog();
}
}
/**
* 设置功能按钮变暗
@ -290,7 +295,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
* 发起主播连麦pk
*/
private void applyLinkMicPk() {
((LiveRyAnchorActivity) mContext).applyLinkMicPk();
((LiveSwAnchorActivity) mContext).applyLinkMicPk();
}
public void setLinkMicEnable(boolean linkMicEnable) {
@ -516,7 +521,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
bundle.putString("url", htmlUrl.toString());
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
}
}
@ -577,7 +582,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
bundle.putString("url", htmlUrl.toString());
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
fragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
}
}

View File

@ -105,10 +105,12 @@ import com.yunbao.live.event.LiveOpenSuccessEvent;
import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveSwLinkMicPkPresenter;
import com.yunbao.live.socket.SocketClient;
import com.yunbao.live.socket.SocketMessageListener;
import com.yunbao.live.socket.SocketRyChatUtil;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSwClient;
import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.utils.LiveImDeletUtil;
@ -155,7 +157,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//侧滑布局
// private DrawerLayout drawerLayout;
//直播间拆分布局
public LivePlayRyViewHolder mLivePlayViewHolder;
public LiveRoomPlayViewHolder mLivePlayViewHolder;
//头部布局
public LiveRoomViewHolder mLiveRoomViewHolder;
//底部布局
@ -169,14 +172,20 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//主播与主播连麦逻辑
private LiveLinkMicAnchorPresenter mLiveLinkMicAnchorPresenter;
//主播与主播PK逻辑
private LiveSwLinkMicPkPresenter mLiveSwLinkMicPkPresenter;
private LiveRyLinkMicPkPresenter mLiveRyLinkMicPkPresenter;
//直播间的类型 普通 密码 门票 计时等
private int mLiveType;
//收费价格,计时收费每次扣费的值
private int mLiveTypeVal;
//直播结束页面
private LiveEndViewHolder mLiveEndViewHolder;
private SocketSwClient mSocketSwClient;
private SocketRyClient mSocketRyClient;
private SocketClient mSocketClient;
private String mDanmuPrice;//弹幕价格
private int mSocketUserType;//socket用户类型 30 普通用户 40 管理员 50 主播 60超管
@ -215,6 +224,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public static PortraitLiveManager portraitLiveManager;
private static int waitShowTopBannerTime = 6000;
private boolean isSw;
public PortraitLiveManager setQuitF(boolean quitF) {
isQuitF = quitF;
return this;
@ -265,6 +276,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public PortraitLiveManager(Activity context, Intent intent) {
this.mContext = context;
this.mIntent = intent;
isSw = intent.getBooleanExtra("isSw", false);
liveImDeletUtil = new LiveImDeletUtil();
portraitLiveManager = this;
ininView();
@ -333,7 +345,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk, boolean isSw) {
isEnterRoom = false;
MobclickAgent.onEvent(mContext, "live_room_chat_list", "滑动直播间聊天列表");
openParametersModel = new OpenParametersModel();
@ -351,6 +363,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.release();
mLiveRyLinkMicPkPresenter = null;
}
if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.clearData();
mLiveSwLinkMicPkPresenter.release();
mLiveSwLinkMicPkPresenter = null;
}
OpenAdManager.getInstance().dismiss();
mLiveBean = data;
mLiveSDK = liveSdk;
@ -369,13 +387,23 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
liveHandler.removeCallbacks(loadRunnableGone);
liveHandler.removeCallbacks(loadTimeoutRunnableGone);
if (mLivePlayViewHolder == null) {
if (isSw) {
mLivePlayViewHolder = new LivePlaySwViewHolder(mContext, playContainer, 1);
} else {
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
}
mLivePlayViewHolder.initSwEngine(mLiveBean.getUid());
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);
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
if (isSw) {
mLiveSwLinkMicPkPresenter = new LiveSwLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
} else {
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
}
mLivePlayViewHolder.addToParent();
mLivePlayViewHolder.subscribeActivityLifeCycle();
mLivePlayViewHolder.setLoadViewListener(new LiveRoomPlayViewHolder.LoadingListener() {
@ -394,16 +422,22 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
}
if (isSw) {
if (mLiveSwLinkMicPkPresenter == null) {
mLiveSwLinkMicPkPresenter = new LiveSwLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
}
} else {
if (mLiveRyLinkMicPkPresenter == null) {
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
}
}
//去除主播离开画面
if (LivePlayKsyViewHolder.leave != null) {
LivePlayKsyViewHolder.leave.setVisibility(View.GONE);
}
if (LivePlayRyViewHolder.leave != null) {
LivePlayRyViewHolder.leave.setVisibility(View.GONE);
if (LivePlaySwViewHolder.leave != null) {
LivePlaySwViewHolder.leave.setVisibility(View.GONE);
}
//直播间背景
@ -438,8 +472,17 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.clearGuardIcon();
mLiveRoomViewHolder.clearChat();
mLiveRoomViewHolder.releaseGift();
if (isSw) {
mLiveSwLinkMicPkPresenter.setLiveUid(data.getUid(), "");
} else {
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
}
if (isSw) {
mSocketSwClient = new SocketSwClient(mLiveBean.getUid(), PortraitLiveManager.this, mContext);
} else {
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this, mContext);
}
if (mLiveLinkMicPresenter != null) {
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
}
@ -616,8 +659,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
if (leave == 1) {
if (LivePlayRyViewHolder.leave != null) {
LivePlayRyViewHolder.leave.setVisibility(View.VISIBLE);
if (LivePlaySwViewHolder.leave != null) {
LivePlaySwViewHolder.leave.setVisibility(View.VISIBLE);
}
}
//判断是否有连麦要显示连麦窗口
@ -644,17 +687,17 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
}
}
if(mLivePlayViewHolder != null && data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")){
if (mLivePlayViewHolder != null && data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")) {
JSONArray array = pkInfo.getJSONArray("userlist");
//判断是否是多人连麦
if(array.size()>0){//多人連麥
if (array.size() > 0) {//多人連麥
if (mLivePlayViewHolder != null) {
List<DrPkbean> drPkbeans = new ArrayList<>();
for (int j = 0; j < array.size(); j++) {
UserBean drPkbean = new UserBean();
DrPkbean drPkbean1 = new DrPkbean();
JSONObject da = array.getJSONObject(j);
if(!String.valueOf(da.getIntValue("id")).equals(String.valueOf(data.getLiveInfo().getUid()))){
if (!String.valueOf(da.getIntValue("id")).equals(String.valueOf(data.getLiveInfo().getUid()))) {
drPkbean.setId(String.valueOf(da.getIntValue("id")));
drPkbean1.setId(da.getIntValue("id"));
drPkbean1.setUser_nicename(da.getString("user_nicename"));
@ -664,9 +707,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
//mLivePlayViewHolder.setDrPkView(drPkbeans);
}
}else{//单人连麦
} else {//单人连麦
LivePkMicModel connection_info = data.getEnterRoomInfo().getConnectionInfo();
if(!StringUtil.isEmpty(connection_info.getPkuid())){
if (!StringUtil.isEmpty(connection_info.getPkuid())) {
mPkUid = connection_info.getPkuid();
mLivePlayViewHolder.setPkView(connection_info.getPkuid());
}
@ -692,9 +735,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
};
linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000);
}
if (isSw) {
mLiveSwLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean);
} else {
mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean);
}
} else if (!pkInfo.getString("end_pk_time").equals("0")) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.pkHandler = true;
@ -708,7 +754,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//pk排名数据
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
if (isSw) {
mLiveSwLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean);
} else {
mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean);
}
} else {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.initPkRank(null);
@ -726,7 +776,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
UserBean userBean = new UserBean();
DrPkbean drPkbean = new DrPkbean();
JSONObject da = array.getJSONObject(j);
if(!String.valueOf(da.getIntValue("id")).equals(String.valueOf(data.getLiveInfo().getUid()))){
if (!String.valueOf(da.getIntValue("id")).equals(String.valueOf(data.getLiveInfo().getUid()))) {
userBean.setId(String.valueOf(da.getIntValue("id")));
drPkbean.setId(da.getIntValue("id"));
drPkbean.setUser_nicename(da.getString("user_nicename"));
@ -837,10 +887,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
}
public void loadTimeoutRunnableGone(){
if(liveHandler!=null){
public void loadTimeoutRunnableGone() {
if (liveHandler != null) {
liveHandler.postDelayed(loadTimeoutRunnableGone, 1_000);
}
}
@ -871,11 +919,17 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.clearData();
mLiveRyLinkMicPkPresenter.release();
}
if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.clearData();
mLiveSwLinkMicPkPresenter.release();
}
mLiveAudienceViewHolder = null;
mLiveRoomViewHolder = null;
mLiveLinkMicPresenter = null;
mLiveLinkMicAnchorPresenter = null;
mLiveRyLinkMicPkPresenter = null;
mLiveSwLinkMicPkPresenter = null;
mLivePlayViewHolder = null;
}
@ -902,6 +956,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mSocketRyClient.disConnect();
mSocketRyClient = null;
}
if (mSocketSwClient != null) {
mSocketSwClient.disConnect();
mSocketSwClient = null;
}
if (mSocketClient != null) {
mSocketClient.disConnect();
mSocketClient = null;
@ -1360,7 +1418,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void showAllServerNotifyFFGGGD(AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent,true);
mLiveRoomViewHolder.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent, true);
}
}
@ -1392,15 +1450,28 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) {
if (isSw) {
if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
} else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
}
}
@Override
public void onEndPk(long leftUid, long rightUid, long left, long right, LivePKUserListBean bean) {
if (isSw) {
if (mLiveSwLinkMicPkPresenter != null) {
if (mLiveUid.equals(leftUid + "")) {
mLiveSwLinkMicPkPresenter.onPkProgressEnd(left, right, bean);
} else {
mLiveSwLinkMicPkPresenter.onPkProgressEnd(right, left, bean);
}
}
} else {
if (mLiveRyLinkMicPkPresenter != null) {
if (mLiveUid.equals(leftUid + "")) {
mLiveRyLinkMicPkPresenter.onPkProgressEnd(left, right, bean);
@ -1409,6 +1480,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
}
}
}
@Override
public void onSendDanMu(LiveDanMuBean bean) {
@ -1610,7 +1682,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void onLinkDRMicPKToUser(UserBean u) {
L.eSw("onLinkDRMicPKToUser(UserBean u)PortraitLiveManager");
mLivePlayViewHolder.setDrMicInfo(u);
}
@Override
@ -1619,7 +1690,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//mLivePlayViewHolder.setDrMicInfo(u);
}
/**
* 主播与主播PK 所有人收到PK开始的回调
*/
@ -1645,12 +1715,20 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
}
};
if (isSw) {
if (mLiveSwLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.pkHandler = true;
mLiveSwLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000);//3秒后执行Runnable中的run方法
}
} else {
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.pkHandler = true;
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000);//3秒后执行Runnable中的run方法
}
}
if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.setLiveBeanLandscape(1);
}
@ -1673,13 +1751,21 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void onLinkMicPkClose(int i) {
if (isSw) {
if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.onLinkMicPkClose(i);
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.resetViewGone();
}
}
} else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(i);
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.resetViewGone();
}
}
}
if (mLiveRoomViewHolder != null) {
mLivePlayViewHolder.setLiveBeanLandscape(landscape);
mLivePlayViewHolder.endpk(mPkUid);
@ -1706,11 +1792,18 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void onLinkMicPkEnd(String winUid) {
if (isSw) {
if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.onLinkMicPkEnd(winUid);
//mLiveRoomViewHolder.setDelOtherInfo();
}
} else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid);
//mLiveRoomViewHolder.setDelOtherInfo();
}
}
}
@Override
public void onLuckGiftWin(LiveLuckGiftWinBean bean) {
@ -1900,9 +1993,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
}
mSocketRyClient = null;
}
if (mSocketSwClient != null) {
mSocketSwClient.disConnect();
mSocketSwClient = null;
}
//结束播放
if (mLivePlayViewHolder != null) {
@ -2210,7 +2307,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* @param time
*/
public void upDataPkScore(JSONArray pkScores, int time) {
L.eSw("upDataPkScore"+time);
L.eSw("upDataPkScore" + time);
if (mLiveRoomViewHolder != null) {
String liveId = mLiveBean.getUid();
JSONObject liveModel = null;

View File

@ -102,8 +102,8 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder {
}
new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -1,41 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:animateLayoutChanges="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">
android:layout_height="match_parent">
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
app:surface_type="texture_view"
app:use_controller="false" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_centerVertical="true"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/playView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/playView1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
app:use_controller="false"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/leave"
@ -46,11 +23,12 @@
android:src="@mipmap/zslk"
android:visibility="gone" />
<FrameLayout
<RelativeLayout
android:id="@+id/pk_container"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_marginTop="130dp">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/live_top">
<com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/left_container"
@ -65,62 +43,8 @@
android:layout_gravity="right"
android:layout_marginBottom="20dp" />
</FrameLayout>
<LinearLayout
android:id="@+id/dr_pk_view"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginTop="130dp"
android:orientation="horizontal"
android:visibility="gone">
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<FrameLayout
android:id="@+id/dr1_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"
tools:ignore="NestedWeights" />
<FrameLayout
android:id="@+id/dr3_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<FrameLayout
android:id="@+id/dr2_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"
tools:ignore="NestedWeights" />
<FrameLayout
android:id="@+id/dr4_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout>
</LinearLayout>
<com.yunbao.live.custom.MyFrameLayout3
android:id="@+id/small_container"
@ -148,19 +72,18 @@
android:id="@+id/loading"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="240dp"
android:layout_centerHorizontal="true"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/anim_loading"
android:indeterminateOnly="true"
android:visibility="invisible" />
<ProgressBar
android:id="@+id/loading2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="240dp"
android:layout_centerHorizontal="true"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/anim_loading"
android:indeterminateOnly="true"

View File

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
app:surface_type="texture_view"
app:use_controller="false" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_centerVertical="true"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/playView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/playView1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<ImageView
android:id="@+id/leave"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:scaleType="centerCrop"
android:src="@mipmap/zslk"
android:visibility="gone" />
<FrameLayout
android:id="@+id/pk_container"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_marginTop="130dp">
<com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/left_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="20dp" />
<com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/right_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_marginBottom="20dp" />
</FrameLayout>
<LinearLayout
android:id="@+id/dr_pk_view"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginTop="130dp"
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<FrameLayout
android:id="@+id/dr1_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"
tools:ignore="NestedWeights" />
<FrameLayout
android:id="@+id/dr3_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<FrameLayout
android:id="@+id/dr2_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"
tools:ignore="NestedWeights" />
<FrameLayout
android:id="@+id/dr4_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout>
</LinearLayout>
<com.yunbao.live.custom.MyFrameLayout3
android:id="@+id/small_container"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="120dp"
app:mfl3_ratio="0.25" />
<FrameLayout
android:id="@+id/ry_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<ProgressBar
android:id="@+id/loading"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="240dp"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/anim_loading"
android:indeterminateOnly="true"
android:visibility="invisible" />
<ProgressBar
android:id="@+id/loading2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="240dp"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/anim_loading"
android:indeterminateOnly="true"
android:visibility="invisible" />
</RelativeLayout>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -14,7 +14,6 @@
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:orientation="vertical">
<FrameLayout
@ -31,6 +30,7 @@
</LinearLayout>
<FrameLayout
android:id="@+id/camera_preview1"
android:layout_width="wrap_content"
@ -39,53 +39,51 @@
<LinearLayout
android:id="@+id/dr_pk_view"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="130dp"
android:orientation="horizontal"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:orientation="horizontal">
<FrameLayout
android:id="@+id/dr1_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"
tools:ignore="NestedWeights" />
android:background="@mipmap/live_icon_vacancy" />
<FrameLayout
android:id="@+id/dr3_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/dr2_preview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:orientation="horizontal">
<FrameLayout
android:id="@+id/dr2_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/dr3_preview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy"
tools:ignore="NestedWeights" />
android:background="@mipmap/live_icon_vacancy" />
<FrameLayout
android:id="@+id/dr4_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
@ -93,12 +91,16 @@
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/big_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent">
</FrameLayout>
<LinearLayout
android:id="@+id/layout_surface"
@ -114,32 +116,12 @@
android:layout_height="match_parent" />
</LinearLayout>
<FrameLayout
android:id="@+id/pk_container"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_marginTop="130dp">
<com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/left_container"
android:layout_marginBottom="20dp"
android:layout_width="0dp"
android:layout_height="match_parent"
/>
<com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/right_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_marginBottom="20dp" />
</FrameLayout>
<LinearLayout
android:id="@+id/goto_room_view"
android:layout_width="wrap_content"
android:layout_height="27dp"
android:layout_alignParentRight="true"
android:layout_marginTop="135dp"
android:layout_marginTop="122dp"
android:layout_marginRight="9dp"
android:background="@drawable/bg_live_other_ico"
android:gravity="center"
@ -175,6 +157,26 @@
</LinearLayout>
<FrameLayout
android:id="@+id/pk_container"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_marginTop="130dp">
<com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/left_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="20dp" />
<com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/right_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_marginBottom="20dp" />
</FrameLayout>
<TextView
android:id="@+id/btn_close"
@ -193,6 +195,7 @@
android:textSize="13sp"
android:visibility="gone" />
<com.yunbao.live.custom.MyFrameLayout3
android:id="@+id/small_container"
android:layout_width="0dp"
@ -202,6 +205,7 @@
android:layout_marginBottom="120dp"
app:mfl3_ratio="0.25" />
<ImageView
android:id="@+id/leave"
android:layout_width="match_parent"

View File

@ -0,0 +1,235 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/camera_preview3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
<FrameLayout
android:id="@+id/camera_preview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
<LinearLayout
android:id="@+id/dr_pk_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="130dp"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/dr1_preview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
<FrameLayout
android:id="@+id/dr2_preview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/dr3_preview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
<FrameLayout
android:id="@+id/dr4_preview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@mipmap/live_icon_vacancy" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/big_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<LinearLayout
android:id="@+id/layout_surface"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:orientation="vertical"
android:visibility="gone">
<SurfaceView
android:id="@+id/surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:id="@+id/goto_room_view"
android:layout_width="wrap_content"
android:layout_height="27dp"
android:layout_alignParentRight="true"
android:layout_marginTop="122dp"
android:layout_marginRight="9dp"
android:background="@drawable/bg_live_other_ico"
android:gravity="center"
android:visibility="gone">
<RelativeLayout
android:layout_width="21dp"
android:layout_height="21dp"
android:layout_marginLeft="3dp"
android:gravity="center">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatarOther"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/m_chu_xia"
app:riv_oval="true" />
</RelativeLayout>
<TextView
android:id="@+id/tv_avatarOther_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="3dp"
android:maxLength="4"
android:maxLines="1"
android:text=""
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<FrameLayout
android:id="@+id/pk_container"
android:layout_width="match_parent"
android:layout_height="270dp"
android:layout_marginTop="130dp">
<com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/left_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="20dp" />
<com.yunbao.live.custom.MyFrameLayout4
android:id="@+id/right_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_marginBottom="20dp" />
</FrameLayout>
<TextView
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="400dp"
android:layout_marginRight="8dp"
android:background="@drawable/background_dedede"
android:paddingLeft="8dp"
android:paddingTop="5dp"
android:paddingRight="8dp"
android:paddingBottom="5dp"
android:text="@string/live_link_mic_3"
android:textColor="@color/color_white"
android:textSize="13sp"
android:visibility="gone" />
<com.yunbao.live.custom.MyFrameLayout3
android:id="@+id/small_container"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="120dp"
app:mfl3_ratio="0.25" />
<ImageView
android:id="@+id/leave"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:scaleType="centerCrop"
android:src="@mipmap/zslk"
android:visibility="gone" />
<FrameLayout
android:id="@+id/time_title"
android:layout_width="60dp"
android:layout_height="16.67dp"
android:layout_centerHorizontal="true"
android:background="@mipmap/live_pk_time_bg"
android:visibility="gone">
<TextView
android:id="@+id/text_time"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/pk_time"
android:textColor="@color/white"
android:textSize="8sp" />
<!-- 详情-->
</FrameLayout>
</RelativeLayout>

View File

@ -671,8 +671,8 @@ public class EntryActivity extends AppCompatActivity {
}
new LiveRoomCheckLivePresenter(activity, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -118,8 +118,8 @@ public class LiveClassActivity extends AbsActivity implements OnItemClickListene
public void watchLive(LiveBean liveBean, int position) {
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -257,8 +257,8 @@ public class LoginActivity extends AbsActivity {
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -271,8 +271,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override
@ -485,8 +485,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override
@ -1069,9 +1069,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
public void watchLive(LiveBean liveBean, String key, int position) {
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
MobclickAgent.onEvent(mContext, "home_page_enter_room", "首页点击直播间");
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -261,7 +261,7 @@ public class MyWebViewActivity extends AbsActivity {
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
@ -274,7 +274,7 @@ public class MyWebViewActivity extends AbsActivity {
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
}
}

View File

@ -230,7 +230,7 @@ public class MyWebViewActivity2 extends AbsActivity {
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
@ -243,7 +243,7 @@ public class MyWebViewActivity2 extends AbsActivity {
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
}
}

View File

@ -528,8 +528,8 @@ public class RegisterActivity extends AbsActivity {
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
NoviceInstructorManager.get(mContext).setFrist(false);
}

View File

@ -176,8 +176,8 @@ public class SearchActivity extends AbsActivity {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -154,8 +154,8 @@ public class WeekWebViewActivity extends AbsActivity {
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -391,7 +391,7 @@ public class ZhuangBanActivity extends AbsActivity {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (liveBean == null) {
return;
}
@ -400,7 +400,7 @@ public class ZhuangBanActivity extends AbsActivity {
return;
}
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
finish();
}

View File

@ -203,8 +203,8 @@ public class SearchAdapter extends RefreshAdapter<SearchUserBean> {
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -77,8 +77,8 @@ public class AnchorStartLiveNotifyDialog extends AbsDialogPositionPopupWindow {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
}
@Override

View File

@ -39,6 +39,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.LiveConfig;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveSwAnchorActivity;
import com.yunbao.live.bean.LiveKsyConfigBean;
import com.yunbao.main.R;
import com.yunbao.main.activity.MyWebViewActivity;
@ -227,15 +228,25 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
@Override
public void onSuccess(int code, String msg, String[] info1) {
try {
LiveHttpUtil.getIsSw(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] infos) {
JSONObject obj = JSON.parseObject(info[0]);
JSONObject obj1 = JSON.parseObject(info1[0]);
if (obj1.getString("is_rong").equals("1")) {
try {
code = 200;
if(code==201){ //声网
LiveSwAnchorActivity.forward(mContext, Constants.LIVE_SDK_SW, JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
}else if(code==200){//融云
LiveRyAnchorActivity.forward(mContext, obj.getIntValue("live_sdk"), JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
} else {
LiveAnchorActivity.forward(mContext, obj.getIntValue("live_sdk"), JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
}
} catch (Exception e) {
}
}
});
} catch (Exception e) {
}
}
});

View File

@ -150,11 +150,11 @@ public class OneLoginDialog extends AbsDialogFragment {
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
NoviceInstructorManager.get(mContext).setFrist(false);
}

View File

@ -262,8 +262,8 @@ public class MainHomeCommunityFragment extends BaseFragment {
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -170,8 +170,8 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override
@ -406,8 +406,8 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -402,8 +402,8 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
liveBean.setParams(gotoRoomKey);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override
@ -497,7 +497,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
@ -509,7 +509,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
}
}

View File

@ -515,8 +515,8 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
}
@Override

View File

@ -794,7 +794,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
if (mFromLiveRoom) {
if (MicStatusManager.getInstance().isMic(liveUid)) {
@ -804,7 +804,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh
((UserHomeActivity) mContext).onBackPressed();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
}
}