fix[声望升级-修复BUG]
This commit is contained in:
parent
26a71ff825
commit
cf48be7d15
@ -65,6 +65,10 @@ public abstract class AbsViewHolder implements LifeCycleListener {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShow(){
|
||||
return mParentView.indexOfChild(mContentView)>-1;
|
||||
}
|
||||
|
||||
public void removeFromParent() {
|
||||
ViewParent parent = mContentView.getParent();
|
||||
if (parent != null) {
|
||||
|
@ -25,4 +25,6 @@ systemProp.http.proxyHost=127.0.0.1
|
||||
systemProp.https.proxyHost=127.0.0.1
|
||||
systemProp.https.proxyPort=10809
|
||||
systemProp.http.proxyPort=10809
|
||||
|
||||
|
||||
#android.enableR8.fullMode=true
|
@ -94,7 +94,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
||||
swAuManager.initRtcEngine( mContext);
|
||||
swAuManager.setupRemoteVideo(Integer.parseInt(mLiveBean.getUid()));
|
||||
//进入主播房间
|
||||
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, SWAuManager.getChannelName(mLiveBean.getUid()));
|
||||
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken,mLiveBean.getUid(), SWAuManager.getChannelName(mLiveBean.getUid()));
|
||||
}else{
|
||||
videoView = magnetView.findViewById(R.id.video_view);
|
||||
mPlayer = new TXLivePlayer(mContext);
|
||||
@ -145,7 +145,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
||||
});
|
||||
if(mLiveSDK == Constants.LIVE_SDK_SW){
|
||||
ViewClicksAntiShake.clicksAntiShake(videoFrameLayout, () -> {
|
||||
mPlayer.stopPlay(true);
|
||||
SWAuManager.get().exitChannelAll();
|
||||
APPEasyFloat.getInstance().dismiss(mContext);
|
||||
new Handler().post(liveCheck);
|
||||
});
|
||||
@ -166,8 +166,13 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (mPlayer != null)
|
||||
mPlayer.stopPlay(true);
|
||||
if(mLiveSDK == Constants.LIVE_SDK_SW){
|
||||
SWAuManager.get().exitChannelAll();
|
||||
}else{
|
||||
if (mPlayer != null)
|
||||
mPlayer.stopPlay(true);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
.show(mContext);
|
||||
@ -192,7 +197,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
||||
public LiveFloatView cacheLiveData(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) {
|
||||
this.mLiveBean = mLiveBean;
|
||||
this.mLiveType = mLiveType;
|
||||
this.mLiveSDK = Constants.LIVE_SDK_SW;
|
||||
this.mLiveSDK = mLiveSDK;
|
||||
this.mLiveTypeVal = mLiveTypeVal;
|
||||
return instance;
|
||||
}
|
||||
@ -249,7 +254,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
||||
swAuManager.initRtcEngine( mContext);
|
||||
swAuManager.setupRemoteVideo(Integer.parseInt(mLiveBean.getUid()));
|
||||
//进入主播房间
|
||||
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, SWAuManager.getChannelName(mLiveBean.getUid()));
|
||||
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, mLiveBean.getUid(),SWAuManager.getChannelName(mLiveBean.getUid()));
|
||||
}else{
|
||||
TXCloudVideoView videoView = view.findViewById(R.id.video_view);
|
||||
mPlayer = new TXLivePlayer(mContext);
|
||||
|
@ -2,15 +2,24 @@ package io.agora.beautyapi.faceunity.agora;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceView;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.manager.MicUserManager;
|
||||
import com.yunbao.common.manager.MicedUserManager;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import io.agora.rtc2.ChannelMediaOptions;
|
||||
import io.agora.rtc2.Constants;
|
||||
@ -19,6 +28,15 @@ import io.agora.rtc2.RtcConnection;
|
||||
import io.agora.rtc2.RtcEngineConfig;
|
||||
import io.agora.rtc2.RtcEngineEx;
|
||||
import io.agora.rtc2.video.VideoCanvas;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import io.rong.imkit.IMCenter;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 声网主播管理类
|
||||
@ -37,6 +55,14 @@ public class SWAuManager extends BaseCacheManager {
|
||||
private FrameLayout pkContainer3; //pk主播视图3
|
||||
private FrameLayout linkUserContainer;//连麦用户视图
|
||||
|
||||
private int liveMicUid;
|
||||
|
||||
private SwListener swListener;
|
||||
|
||||
public void setSwListener(SwListener swListener) {
|
||||
this.swListener = swListener;
|
||||
}
|
||||
|
||||
public SWAuManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@ -57,13 +83,13 @@ public class SWAuManager extends BaseCacheManager {
|
||||
@Override
|
||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
super.onJoinChannelSuccess(channel, uid, elapsed);
|
||||
L.eSw("加入房间成功 channel"+channel+" uid"+uid);
|
||||
L.eSw("加入房间成功 channel" + channel + " uid" + uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserJoined(int uid, int elapsed) {
|
||||
super.onUserJoined(uid, elapsed);
|
||||
L.eSw("用户加入房间成功"+uid);
|
||||
L.eSw("用户加入房间成功" + uid);
|
||||
}
|
||||
};
|
||||
|
||||
@ -84,8 +110,6 @@ public class SWAuManager extends BaseCacheManager {
|
||||
throw new RuntimeException("Check the error.");
|
||||
}
|
||||
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING); // 直播模式,引擎級別
|
||||
// 启用视频模块
|
||||
mRtcEngine.enableVideo();
|
||||
// 开启本地预览
|
||||
//mRtcEngine.startPreview();
|
||||
}
|
||||
@ -112,19 +136,20 @@ public class SWAuManager extends BaseCacheManager {
|
||||
|
||||
/**
|
||||
* 创建语音房
|
||||
*
|
||||
* @param token
|
||||
* @param channelName
|
||||
* @param uid
|
||||
*/
|
||||
public void joinAudioRoom(String channelName,String token,int uid){
|
||||
L.eSw("加入房间"+channelName+" uid"+uid);
|
||||
public void joinAudioRoom(String channelName, String token, int uid) {
|
||||
L.eSw("加入房间" + channelName + " uid" + uid);
|
||||
// 直播场景下,设置频道场景为 BROADCASTING (直播场景)
|
||||
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
|
||||
// 创建 ChannelMediaOptions 对象,并进行配置
|
||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||
// 根据场景将用户角色设置为 AUDIENCE (观众)
|
||||
options.clientRoleType = Constants.CLIENT_ROLE_AUDIENCE;
|
||||
// 直播场景下,设置频道场景为 BROADCASTING (直播场景)
|
||||
options.audienceLatencyLevel = Constants.CHANNEL_PROFILE_LIVE_BROADCASTING; // 觀眾走極速直播
|
||||
options.autoSubscribeVideo = false;
|
||||
mRtcEngine.disableVideo();
|
||||
options.autoSubscribeAudio = true;
|
||||
mRtcEngine.joinChannel(token, channelName, uid, options);
|
||||
}
|
||||
@ -148,7 +173,8 @@ public class SWAuManager extends BaseCacheManager {
|
||||
/**
|
||||
* 加入房间
|
||||
*/
|
||||
public void joinRoom(String strUid, String token, String channelName) {
|
||||
public void joinRoom(String strUid, String token, String liveUid, String channelName) {
|
||||
liveMicUid = Integer.parseInt(liveUid);
|
||||
int uid;
|
||||
if (StringUtil.isEmpty(strUid)) {
|
||||
uid = 0;
|
||||
@ -159,6 +185,13 @@ public class SWAuManager extends BaseCacheManager {
|
||||
SurfaceView surfaceView = new SurfaceView(mContext);
|
||||
audienceContainer.addView(surfaceView);
|
||||
|
||||
// 启用视频模块
|
||||
mRtcEngine.enableVideo();
|
||||
|
||||
//走媒体音量,和音质有关
|
||||
mRtcEngine.setAudioProfile(Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY);
|
||||
mRtcEngine.setAudioScenario(Constants.AUDIO_SCENARIO_GAME_STREAMING);
|
||||
|
||||
// 创建 ChannelMediaOptions 对象,并进行配置
|
||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||
// 根据场景将用户角色设置为 AUDIENCE (观众)
|
||||
@ -229,10 +262,11 @@ public class SWAuManager extends BaseCacheManager {
|
||||
mRtcEngine.updateChannelMediaOptions(options);
|
||||
}
|
||||
|
||||
public void setMicAudio(int toUid,boolean isEn) {
|
||||
L.eSw("setMicAudio:toUid" +toUid+"isEn "+ isEn);
|
||||
mRtcEngine.muteRemoteAudioStream(toUid,isEn);
|
||||
public void setMicAudio(int toUid, boolean isEn) {
|
||||
L.eSw("setMicAudio:toUid" + toUid + "isEn " + isEn);
|
||||
mRtcEngine.muteRemoteAudioStream(toUid, isEn);
|
||||
}
|
||||
|
||||
/**
|
||||
* PK-加入对方主播直播间
|
||||
*
|
||||
@ -310,7 +344,7 @@ public class SWAuManager extends BaseCacheManager {
|
||||
*/
|
||||
public void exitChannelAll() {
|
||||
L.eSw("exitChannelAll exitChannelAll exitChannelAll");
|
||||
if(mRtcEngine!=null){
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.leaveChannel();
|
||||
}
|
||||
}
|
||||
@ -336,6 +370,17 @@ public class SWAuManager extends BaseCacheManager {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserOffline(int uid, int reason) {
|
||||
super.onUserOffline(uid, reason);
|
||||
L.eSw("onUserOffline: uid " + uid + " reason" + reason);
|
||||
if (liveMicUid == uid) {
|
||||
if (swListener != null) {
|
||||
swListener.onUserOffline(liveMicUid);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//设置对方主播视图
|
||||
@ -367,4 +412,7 @@ public class SWAuManager extends BaseCacheManager {
|
||||
this.linkUserContainer = linkUserContainer;
|
||||
}
|
||||
|
||||
public interface SwListener {
|
||||
void onUserOffline(int liveUid);
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class SWManager extends BaseCacheManager {
|
||||
cfg.dimensions = VideoEncoderConfiguration.VD_1920x1080;
|
||||
break;
|
||||
}
|
||||
cfg.frameRate = 24;
|
||||
cfg.frameRate = 20;
|
||||
cfg.bitrate = 0;
|
||||
cfg.mirrorMode = VideoEncoderConfiguration.MIRROR_MODE_TYPE.MIRROR_MODE_ENABLED; //镜像
|
||||
mRtcEngine.setVideoEncoderConfiguration(cfg);
|
||||
@ -148,7 +148,10 @@ public class SWManager extends BaseCacheManager {
|
||||
|
||||
/**
|
||||
* 设置清晰度
|
||||
*
|
||||
* 单人直播:720x1280
|
||||
* 2人连麦PK:360x640
|
||||
* 3人连麦PK:左侧主播 360x640,右侧两个主播 360x320
|
||||
* 4人连麦PK:360X320
|
||||
* @param selectClarity
|
||||
*/
|
||||
public void setDimensions(int selectClarity) {
|
||||
@ -221,6 +224,10 @@ public class SWManager extends BaseCacheManager {
|
||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||
// 设置角色 BROADCASTER (主播) 或 AUDIENCE (观众)
|
||||
options.clientRoleType = Constants.CLIENT_ROLE_BROADCASTER;
|
||||
|
||||
mRtcEngine.setAudioProfile(Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY);
|
||||
mRtcEngine.setAudioScenario(Constants.AUDIO_SCENARIO_GAME_STREAMING);
|
||||
|
||||
// 加入频道
|
||||
mRtcEngine.joinChannel(token, channelName, uid, options);
|
||||
}
|
||||
@ -297,6 +304,12 @@ public class SWManager extends BaseCacheManager {
|
||||
super.onError(err);
|
||||
L.eSw("onError:" + err);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(Constants.VideoSourceType source, int uid, int width, int height, int rotation) {
|
||||
super.onVideoSizeChanged(source, uid, width, height, rotation);
|
||||
L.eSw("uid:"+uid+"\nwidth:"+width+"\nheight:"+height);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -941,7 +941,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.show("主播正在PK,稍後再試");
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,8 +366,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
loadData(viewGroup, mCurrentItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
getDrawer();
|
||||
|
||||
@ -412,7 +410,9 @@ 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, boolean isSw) {
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw1) {
|
||||
L.eSw("onLiveRoomChanged:"+isSw1);
|
||||
isSw = isSw1;
|
||||
liveIndex = false;
|
||||
try {
|
||||
mLiveSDK = Integer.parseInt(liveSdk);
|
||||
@ -915,10 +915,11 @@ 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, boolean isSw) {
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw1) {
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
isSw = isSw1;
|
||||
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
||||
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||
return;
|
||||
|
@ -1237,8 +1237,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
|
||||
|
||||
IMRTCManager.getInstance().requestJoinOtherRoom(pkUid, true, extra, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
@ -1270,7 +1268,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
});
|
||||
|
||||
} else {
|
||||
ToastUtil.show("主播正在PK,稍後再試");
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
if (RandomPkManager.getInstance().isRandomModel()) {
|
||||
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
||||
}
|
||||
@ -1345,7 +1343,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.show("主播正在PK,稍後再試");
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1648,7 +1646,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
}
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.seisShowGif(true);
|
||||
mLiveRoomViewHolder.endDRGif();
|
||||
if(isDRPK==1){
|
||||
mLiveRoomViewHolder.endDRGif();
|
||||
}
|
||||
|
||||
}
|
||||
// if (mLiveRoomViewHolder != null) {
|
||||
// mLiveRoomViewHolder.hotAddVisibility(false);
|
||||
|
@ -1262,7 +1262,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.show("主播正在PK,稍後再試");
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
if (RandomPkManager.getInstance().isRandomModel()) {
|
||||
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
||||
}
|
||||
@ -1341,7 +1341,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.show("主播正在PK,稍後再試");
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1645,7 +1645,9 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
}
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.seisShowGif(true);
|
||||
mLiveRoomViewHolder.endDRGif();
|
||||
if(isDRPK==1){
|
||||
mLiveRoomViewHolder.endDRGif();
|
||||
}
|
||||
}
|
||||
// if (mLiveRoomViewHolder != null) {
|
||||
// mLiveRoomViewHolder.hotAddVisibility(false);
|
||||
|
@ -21,6 +21,7 @@ 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.MsgSwitchFollowlModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
@ -34,6 +35,7 @@ import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.common.utils.SVGAViewUtils;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
@ -123,23 +125,23 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
if (MicedUserManager.get().getMicUserList().size() < 3) {
|
||||
if (v.getTag() != null) {
|
||||
UserBean tag = (UserBean) v.getTag();
|
||||
if (tag.getTypeMic() == TYPE_MIC_REQUEST) {
|
||||
SocketSendBean bean = createSocketSendBean().param("targetId", tag.getId());
|
||||
applyMic(tag, 1, bean);
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_invite));
|
||||
} else if (tag.getTypeMic() == TYPE_MIC_INVITE) {
|
||||
applyMic(tag, 4, createSocketSendBean());
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_request));
|
||||
for (int i = 0; i < mList.size(); i++) {
|
||||
if (TextUtils.equals(mList.get(i).getId(), tag.getId())) {
|
||||
mList.get(i).setRequest(true);
|
||||
notifyItemChanged(i);
|
||||
ViewClicksAntiShake.clicksAntiShake(mBtn, () -> {
|
||||
if (tag.getTypeMic() == TYPE_MIC_REQUEST) {
|
||||
applyMic(tag, 4, createSocketSendBean());
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_request));
|
||||
for (int i = 0; i < mList.size(); i++) {
|
||||
if (TextUtils.equals(mList.get(i).getId(), tag.getId())) {
|
||||
mList.get(i).setRequest(true);
|
||||
notifyItemChanged(i);
|
||||
}
|
||||
}
|
||||
} else if (tag.getTypeMic() == TYPE_MIC_INVITE) {
|
||||
SocketSendBean bean = createSocketSendBean().param("targetId", tag.getId());
|
||||
applyMic(tag, 1, bean);
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_invite));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}else {
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_max));
|
||||
}
|
||||
@ -167,7 +169,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
return new SocketSendBean()
|
||||
.param("_method_", Constants.LIAN_MAI)
|
||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||
.param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
}
|
||||
if (freePkNum == 0 && mDrPkNum == -1) {
|
||||
ToastUtil.show(mContext.getString(R.string.free_pk_num_null));
|
||||
// return;
|
||||
return;
|
||||
}
|
||||
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@ public class LivePkBean {
|
||||
private String avatar;
|
||||
private String stream;
|
||||
private String pkUid;
|
||||
private String drpkStatus;
|
||||
private int level;
|
||||
private int levelAnchor;
|
||||
private int sex;
|
||||
@ -69,6 +70,19 @@ public class LivePkBean {
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
@JSONField(name="drpk_status")
|
||||
public String getDrpkStatus(){
|
||||
if (drpkStatus == null) {
|
||||
drpkStatus = "0";
|
||||
}
|
||||
return drpkStatus;
|
||||
}
|
||||
|
||||
@JSONField(name = "drpk_status")
|
||||
public void setDrpkStatus(String drpkStatus) {
|
||||
this.drpkStatus = drpkStatus;
|
||||
}
|
||||
|
||||
@JSONField(name = "pkuid")
|
||||
public String getPkUid() {
|
||||
if (pkUid == null) {
|
||||
|
@ -343,7 +343,11 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
userBean.setId(bean.getUid());
|
||||
userBean.setUserNiceName(bean.getUserNiceName());
|
||||
userBean.setAvatar(bean.getAvatar());
|
||||
userBean.setPk(bean.getPkUid().equals("0") ? 0 : 1);
|
||||
if(bean.getPkUid().equals("0")||bean.getDrpkStatus().equals("0")){
|
||||
userBean.setPk(0);
|
||||
}else{
|
||||
userBean.setPk(1);
|
||||
}
|
||||
userBean.setAttention("1");
|
||||
list.add(userBean);
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import android.widget.PopupWindow;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
@ -45,6 +46,7 @@ import com.yunbao.common.event.AnchorInfoEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.IMRTCManager;
|
||||
@ -1047,7 +1049,20 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||
}
|
||||
if (mAcceptPk) {
|
||||
isPK(u);
|
||||
|
||||
LiveHttpUtil.livePkCheckLive(u.getId(), "", "", 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) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
isPK(u);
|
||||
}else{
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}}});
|
||||
} else {
|
||||
if (mPkWaitCount < 0) {
|
||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
||||
@ -1391,7 +1406,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||
}
|
||||
if (mAcceptPk) {
|
||||
|
||||
HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive")
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.params("pkuid", u.getId())
|
||||
@ -1522,6 +1536,21 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
});
|
||||
|
||||
/*LiveHttpUtil.livePkCheckLive(u.getId(), "", "", 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) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
|
||||
|
||||
}else{
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
}});*/
|
||||
|
||||
} else {
|
||||
if (mPkWaitCount < 0) {
|
||||
|
@ -29,16 +29,22 @@ import android.widget.PopupWindow;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.imsdk.v2.V2TIMSendCallback;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
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.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.IMRTCManager;
|
||||
@ -109,7 +115,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
private Context mContext;
|
||||
private View mRoot;
|
||||
private boolean mIsAnchor;//自己是否是主播
|
||||
private SocketSwClient mSocketRyClient;
|
||||
private SocketSwClient mSocketSwClient;
|
||||
private ViewGroup mPkContainer;
|
||||
private boolean mIsApplyDialogShow;//是否显示了申请PK的弹窗
|
||||
private boolean mAcceptPk;//是否接受连麦
|
||||
@ -285,7 +291,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
|
||||
public void setSocketRyClient(SocketSwClient SocketRyClient) {
|
||||
mSocketRyClient = SocketRyClient;
|
||||
mSocketSwClient = SocketRyClient;
|
||||
}
|
||||
|
||||
public void setLiveUid(String liveUid, String url) {
|
||||
@ -471,7 +477,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
return;
|
||||
}
|
||||
mPkSend = true;
|
||||
SocketSwLinkMicPkUtil.linkMicPkApply(mSocketRyClient, pkUid, stream);
|
||||
SocketSwLinkMicPkUtil.linkMicPkApply(mSocketSwClient, pkUid, stream);
|
||||
ToastUtil.show(mContext.getString(R.string.link_mic_apply_pk));
|
||||
|
||||
if (mLiveLinkMicPkViewHolder == null) {
|
||||
@ -571,13 +577,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
LivePushSwViewHolder.btn_close.setVisibility(View.VISIBLE);
|
||||
LiveSwAnchorActivity.isDRPK = 1;
|
||||
livePushSwViewHolder.setAnPkRtc(u);//设置对方主播视图
|
||||
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LINK_MIC_PK).param("action", 4)
|
||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("pkuid", u.getId()).param("uid", CommonAppConfig.getInstance().getUid())
|
||||
.param("pkhead", u.getAvatar()).param("pkname", u.getUserNiceName());
|
||||
msg1.create();
|
||||
LivePushSwViewHolder.btn_close.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@ -639,7 +638,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UN_LEAVELIVE));
|
||||
LiveSwAnchorActivity.isDRPK = 1;
|
||||
LivePushSwViewHolder.btn_close.setVisibility(View.VISIBLE);
|
||||
SocketSwLinkMicPkUtil.linkMicPkAccept(mSocketRyClient, mApplyUid, mApplyUrl, mApplyNmae);
|
||||
SocketSwLinkMicPkUtil.linkMicPkAccept(mSocketSwClient, mApplyUid, mApplyUrl, mApplyNmae);
|
||||
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UP_PK_TWO).setObject(mApplyUid));
|
||||
onLinkMicPkStart(mApplyUid, 2);
|
||||
}
|
||||
@ -668,6 +667,19 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
if (mAcceptPk) {
|
||||
isPK(u);
|
||||
/*LiveHttpUtil.livePkCheckLive(u.getId(), "", "", 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) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
isPK(u);
|
||||
}else{
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}}});*/
|
||||
} else {
|
||||
if (mPkWaitCount < 0) {
|
||||
if(rtcRoom==null){
|
||||
@ -908,7 +920,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||
}
|
||||
if (mAcceptPk) {
|
||||
|
||||
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) {
|
||||
@ -1118,8 +1129,22 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
});
|
||||
/*LiveHttpUtil.livePkCheckLive(u.getId(), "", "", 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) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
|
||||
|
||||
} else {
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});*/
|
||||
} else {
|
||||
if (mPkWaitCount < 0) {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
@ -1637,7 +1662,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
mHandler = null;
|
||||
mSocketRyClient = null;
|
||||
mSocketSwClient = null;
|
||||
if (mLiveLinkMicPkViewHolder != null) {
|
||||
mLiveLinkMicPkViewHolder.release();
|
||||
}
|
||||
|
@ -312,14 +312,13 @@ public class SocketSwClient {
|
||||
u.setUserNiceName(map.getString("uname"));
|
||||
u.setId(map.getString("uid"));
|
||||
mListener.onLinkDRMicPkApply(u);
|
||||
}
|
||||
//收到对方同意多人PK邀请
|
||||
else if (action3 == 2) {
|
||||
} else if (action3 == 2) {
|
||||
//收到对方同意多人PK邀请
|
||||
if("0".equals(map.getString("msgtype"))){
|
||||
return;
|
||||
}
|
||||
UserBean u = new UserBean();
|
||||
// u.setUserNiceName(map.getString("uname"));
|
||||
// u.setUserNiceName(map.getString("uname"));
|
||||
u.setId(map.getString("pkuid"));
|
||||
L.eSw("action3 == 2:"+u.getId());
|
||||
L.eSw("收到对方同意多人PK邀请");
|
||||
@ -1280,8 +1279,8 @@ public class SocketSwClient {
|
||||
case 1://收到对方主播PK回调
|
||||
UserBean u = new UserBean();
|
||||
u.setId(map.getString("uid"));
|
||||
u.setUserNiceName(map.getString("pkname"));
|
||||
u.setAvatar(map.getString("pkhead"));
|
||||
u.setUserNiceName(map.getString("uname"));
|
||||
u.setAvatar(map.getString("uhead"));
|
||||
u.setRandomPk("11".equals(map.getString("msgtype")));
|
||||
mListener.onLinkMicPkApply(u, map.getString("stream"), "11".equals(map.getString("msgtype"))?2:1);
|
||||
break;
|
||||
@ -1306,7 +1305,7 @@ public class SocketSwClient {
|
||||
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"));
|
||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("uhead"), map.getString("uname"), map.getString("is_ladders"));
|
||||
break;
|
||||
case 5://PK时候断开连麦的回调
|
||||
// if (rtcRoom != null) {
|
||||
@ -1341,61 +1340,62 @@ public class SocketSwClient {
|
||||
}
|
||||
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("random_pk", "1")
|
||||
.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);
|
||||
if(livePushSwViewHolder!=null){
|
||||
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("random_pk", "1")
|
||||
.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) {
|
||||
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 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);
|
||||
}
|
||||
});
|
||||
@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);
|
||||
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 (livePushSwViewHolder != null) {
|
||||
UserBean userBean = new UserBean();
|
||||
userBean.setId(map.getString("uid"));
|
||||
userBean.setAvatar(data.getAvatar());
|
||||
userBean.setUserNiceName(map.getString("uname"));
|
||||
livePushSwViewHolder.setAnPkRtc(userBean);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
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 (livePushSwViewHolder != null) {
|
||||
UserBean userBean = new UserBean();
|
||||
userBean.setId(map.getString("uid"));
|
||||
userBean.setAvatar(data.getAvatar());
|
||||
userBean.setUserNiceName(map.getString("uname"));
|
||||
livePushSwViewHolder.setAnPkRtc(userBean);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
);
|
||||
}
|
||||
/*JSONObject msg1 = new JSONObject();
|
||||
msg1.put("type", "autoLivePK");
|
||||
msg1.put("uid", CommonAppConfig.getInstance().getUid());
|
||||
|
@ -7,6 +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.common.utils.L;
|
||||
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
@ -47,7 +48,7 @@ public class SocketSwLinkMicPkUtil {
|
||||
@Override
|
||||
public void onSuccess(int code, String msgs, String[] info) {
|
||||
if (code == 0) {
|
||||
|
||||
L.eSw("1111111111111111111111111111");
|
||||
HttpClient.getInstance().get("Livepk.setPK", "Livepk.setPK")
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.params("pkuid", pkUid)
|
||||
@ -58,10 +59,12 @@ public class SocketSwLinkMicPkUtil {
|
||||
public void onSuccess(int code, String msgs, String[] info) {
|
||||
if (code == 0) {
|
||||
Log.e("ry",name+"啊啊"+url);
|
||||
L.eSw("2222222222222222222222");
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
|
||||
.param("action", 4)
|
||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("uname", url)
|
||||
.param("uhead", name)
|
||||
.param("pkuid", pkUid)
|
||||
.param("uid", CommonAppConfig.getInstance().getUid())
|
||||
.param("pkhead", url)
|
||||
|
@ -35,13 +35,20 @@ import com.lxj.xpopup.interfaces.XPopupCallback;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzy.okserver.OkDownload;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.dialog.LiveFontSizeSettingDialog;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.MicUserManager;
|
||||
import com.yunbao.common.manager.MicedUserManager;
|
||||
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;
|
||||
@ -57,6 +64,7 @@ import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.bean.DrPkbean;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -88,6 +96,15 @@ import cn.rongcloud.rtc.base.RCRTCStreamType;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import cn.rongcloud.rtc.core.RendererCommon;
|
||||
import io.agora.beautyapi.faceunity.agora.SWAuManager;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import io.rong.imkit.IMCenter;
|
||||
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 LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
@ -205,8 +222,57 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
|
||||
swAuManager.setAudienceContainer(ry_view);
|
||||
swAuManager.initRtcEngine((Activity) mContext);
|
||||
swAuManager.setupRemoteVideo(Integer.parseInt(liveUid));
|
||||
swAuManager.setSwListener(new SWAuManager.SwListener() {
|
||||
@Override
|
||||
public void onUserOffline(int liveUid) {
|
||||
API.get().createPDLiveApi(false)
|
||||
.killDrLm(CommonAppConfig.getInstance().getUid(), String.valueOf(liveUid))
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<BaseModel> stringResponseModel) throws Exception {
|
||||
|
||||
SocketSendBean socketSendBean = new SocketSendBean()
|
||||
.param("_method_", Constants.LIAN_MAI)
|
||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||
|
||||
ToastUtil.show(mContext.getString(R.string.live_mic_user_down));
|
||||
|
||||
socketSendBean.param("action", 8);
|
||||
socketSendBean.create();
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(socketSendBean.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(CommonAppConfig.getInstance().getUid(), conversationType, messageContent);
|
||||
RongcloudIMManager.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) {
|
||||
Log.e("ry", "发送成功");
|
||||
|
||||
IMCenter.getInstance().deleteRemoteMessages(Conversation.ConversationType.PRIVATE, message.getTargetId(), new Message[]{message}, null);
|
||||
IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, message.getTargetId(), null);
|
||||
MicedUserManager.get().removeMiscUser(CommonAppConfig.getInstance().getUid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + errorCode.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}, Throwable::printStackTrace).isDisposed();
|
||||
}
|
||||
});
|
||||
//进入主播房间
|
||||
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, SWAuManager.getChannelName(liveUid));
|
||||
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken,liveUid, SWAuManager.getChannelName(liveUid));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -303,9 +303,11 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
|
||||
.param("action", 4)
|
||||
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("pkname", u.getUserNiceName())
|
||||
.param("pkuid", u.getId())
|
||||
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||
.param("pkhead", u.getAvatar())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uhead", u.getAvatar())
|
||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||
msg1.create();
|
||||
|
||||
|
@ -344,15 +344,24 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
};
|
||||
|
||||
boolean isChangeSdk = false;
|
||||
|
||||
@Override
|
||||
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk, boolean isSw) {
|
||||
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk, boolean isSw1) {
|
||||
if(isSw==isSw1){
|
||||
L.eSw("直播SDK 没有改变了 "+isSw1);
|
||||
isChangeSdk = false;
|
||||
}else{
|
||||
L.eSw("直播SDK 改变了 "+isSw1);
|
||||
isChangeSdk = true;
|
||||
}
|
||||
isSw = isSw1;
|
||||
isEnterRoom = false;
|
||||
MobclickAgent.onEvent(mContext, "live_room_chat_list", "滑动直播间聊天列表");
|
||||
openParametersModel = new OpenParametersModel();
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
/*if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.UpPkTwo();
|
||||
}
|
||||
}*/
|
||||
mContext.runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
@ -387,23 +396,28 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
frameAnimation.start();
|
||||
liveHandler.removeCallbacks(loadRunnableGone);
|
||||
liveHandler.removeCallbacks(loadTimeoutRunnableGone);
|
||||
if (mLivePlayViewHolder == null) {
|
||||
|
||||
if (mLivePlayViewHolder == null|| isChangeSdk) {
|
||||
|
||||
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(),isSw);
|
||||
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.removeFromParent();
|
||||
mLivePlayViewHolder.addToParent();
|
||||
mLivePlayViewHolder.subscribeActivityLifeCycle();
|
||||
mLivePlayViewHolder.setLoadViewListener(new LiveRoomPlayViewHolder.LoadingListener() {
|
||||
@ -413,11 +427,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
liveHandler.removeCallbacks(loadTimeoutRunnableGone);
|
||||
}
|
||||
});
|
||||
mLiveRoomViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveAudienceViewHolder.addToParent();
|
||||
mLiveRoomViewHolder.removeFromParent();
|
||||
mLiveRoomViewHolder.addToParent();
|
||||
mLiveRoomViewHolder.subscribeActivityLifeCycle();
|
||||
|
||||
mLiveAudienceViewHolder.removeFromParent();
|
||||
mLiveAudienceViewHolder.addToParent();
|
||||
mLiveAudienceViewHolder.subscribeActivityLifeCycle();
|
||||
} else {
|
||||
mLivePlayViewHolder.initSwEngine(mLiveBean.getUid());
|
||||
mLivePlayViewHolder.setLiveBeanLandscape(1);
|
||||
mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
|
||||
mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
|
||||
@ -1012,7 +1030,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRyLinkMicPkPresenter = null;
|
||||
if (PermissionUtils.checkPermission(mContext) && !kick) {
|
||||
LiveFloatView.getInstance()
|
||||
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
|
||||
.cacheLiveData(mLiveBean, mLiveType, isSw? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_KSY, mLiveTypeVal)
|
||||
.builderSystemFloat(mContext, mLiveBean.getPull());
|
||||
mContext.finish();
|
||||
} else {
|
||||
@ -1020,7 +1038,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
EventBus.getDefault()
|
||||
.post(new LiveFloatEvent()
|
||||
.setmLiveBean(mLiveBean)
|
||||
.setmLiveSDK(mLiveSDK)
|
||||
.setmLiveSDK(isSw? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_KSY)
|
||||
.setmLiveType(mLiveType)
|
||||
.setmLiveTypeVal(mLiveTypeVal));
|
||||
}
|
||||
@ -1059,7 +1077,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
boolean floatPermission = PermissionUtils.checkPermission(mContext);
|
||||
if (mLiveBean != null && !isQuitF && !isForeground && floatPermission) {
|
||||
LiveFloatView.getInstance()
|
||||
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
|
||||
.cacheLiveData(mLiveBean, mLiveType, isSw? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_KSY, mLiveTypeVal)
|
||||
.builderSystemFloat(mContext, mLiveBean.getPull());
|
||||
mContext.finish();
|
||||
}
|
||||
|
@ -2,7 +2,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">
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -11,6 +12,7 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/camera"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@ -38,51 +40,53 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dr_pk_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="270dp"
|
||||
android:layout_marginTop="130dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/dr1_preview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@mipmap/live_icon_vacancy" />
|
||||
android:background="@mipmap/live_icon_vacancy"
|
||||
tools:ignore="NestedWeights" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/dr2_preview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
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="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/dr3_preview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/dr2_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@mipmap/live_icon_vacancy" />
|
||||
android:background="@mipmap/live_icon_vacancy"
|
||||
tools:ignore="NestedWeights" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/dr4_preview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@mipmap/live_icon_vacancy" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user