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() {
|
public void removeFromParent() {
|
||||||
ViewParent parent = mContentView.getParent();
|
ViewParent parent = mContentView.getParent();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
#Thu Feb 04 00:05:45 CST 2021
|
#Thu Feb 04 00:05:45 CST 2021
|
||||||
android.injected.testOnly=false
|
android.injected.testOnly=false
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.configureondemand=true
|
org.gradle.configureondemand=true
|
||||||
@ -25,4 +25,6 @@ systemProp.http.proxyHost=127.0.0.1
|
|||||||
systemProp.https.proxyHost=127.0.0.1
|
systemProp.https.proxyHost=127.0.0.1
|
||||||
systemProp.https.proxyPort=10809
|
systemProp.https.proxyPort=10809
|
||||||
systemProp.http.proxyPort=10809
|
systemProp.http.proxyPort=10809
|
||||||
|
|
||||||
|
|
||||||
#android.enableR8.fullMode=true
|
#android.enableR8.fullMode=true
|
@ -94,7 +94,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
swAuManager.initRtcEngine( mContext);
|
swAuManager.initRtcEngine( mContext);
|
||||||
swAuManager.setupRemoteVideo(Integer.parseInt(mLiveBean.getUid()));
|
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{
|
}else{
|
||||||
videoView = magnetView.findViewById(R.id.video_view);
|
videoView = magnetView.findViewById(R.id.video_view);
|
||||||
mPlayer = new TXLivePlayer(mContext);
|
mPlayer = new TXLivePlayer(mContext);
|
||||||
@ -145,7 +145,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
});
|
});
|
||||||
if(mLiveSDK == Constants.LIVE_SDK_SW){
|
if(mLiveSDK == Constants.LIVE_SDK_SW){
|
||||||
ViewClicksAntiShake.clicksAntiShake(videoFrameLayout, () -> {
|
ViewClicksAntiShake.clicksAntiShake(videoFrameLayout, () -> {
|
||||||
mPlayer.stopPlay(true);
|
SWAuManager.get().exitChannelAll();
|
||||||
APPEasyFloat.getInstance().dismiss(mContext);
|
APPEasyFloat.getInstance().dismiss(mContext);
|
||||||
new Handler().post(liveCheck);
|
new Handler().post(liveCheck);
|
||||||
});
|
});
|
||||||
@ -166,8 +166,13 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
if (mPlayer != null)
|
if(mLiveSDK == Constants.LIVE_SDK_SW){
|
||||||
mPlayer.stopPlay(true);
|
SWAuManager.get().exitChannelAll();
|
||||||
|
}else{
|
||||||
|
if (mPlayer != null)
|
||||||
|
mPlayer.stopPlay(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.show(mContext);
|
.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) {
|
public LiveFloatView cacheLiveData(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) {
|
||||||
this.mLiveBean = mLiveBean;
|
this.mLiveBean = mLiveBean;
|
||||||
this.mLiveType = mLiveType;
|
this.mLiveType = mLiveType;
|
||||||
this.mLiveSDK = Constants.LIVE_SDK_SW;
|
this.mLiveSDK = mLiveSDK;
|
||||||
this.mLiveTypeVal = mLiveTypeVal;
|
this.mLiveTypeVal = mLiveTypeVal;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@ -249,7 +254,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
swAuManager.initRtcEngine( mContext);
|
swAuManager.initRtcEngine( mContext);
|
||||||
swAuManager.setupRemoteVideo(Integer.parseInt(mLiveBean.getUid()));
|
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{
|
}else{
|
||||||
TXCloudVideoView videoView = view.findViewById(R.id.video_view);
|
TXCloudVideoView videoView = view.findViewById(R.id.video_view);
|
||||||
mPlayer = new TXLivePlayer(mContext);
|
mPlayer = new TXLivePlayer(mContext);
|
||||||
|
@ -2,15 +2,24 @@ package io.agora.beautyapi.faceunity.agora;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.CommonAppContext;
|
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.base.BaseCacheManager;
|
||||||
|
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
|
||||||
import io.agora.rtc2.ChannelMediaOptions;
|
import io.agora.rtc2.ChannelMediaOptions;
|
||||||
import io.agora.rtc2.Constants;
|
import io.agora.rtc2.Constants;
|
||||||
@ -19,6 +28,15 @@ import io.agora.rtc2.RtcConnection;
|
|||||||
import io.agora.rtc2.RtcEngineConfig;
|
import io.agora.rtc2.RtcEngineConfig;
|
||||||
import io.agora.rtc2.RtcEngineEx;
|
import io.agora.rtc2.RtcEngineEx;
|
||||||
import io.agora.rtc2.video.VideoCanvas;
|
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 pkContainer3; //pk主播视图3
|
||||||
private FrameLayout linkUserContainer;//连麦用户视图
|
private FrameLayout linkUserContainer;//连麦用户视图
|
||||||
|
|
||||||
|
private int liveMicUid;
|
||||||
|
|
||||||
|
private SwListener swListener;
|
||||||
|
|
||||||
|
public void setSwListener(SwListener swListener) {
|
||||||
|
this.swListener = swListener;
|
||||||
|
}
|
||||||
|
|
||||||
public SWAuManager(Context context) {
|
public SWAuManager(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
@ -57,13 +83,13 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
@Override
|
@Override
|
||||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||||
super.onJoinChannelSuccess(channel, uid, elapsed);
|
super.onJoinChannelSuccess(channel, uid, elapsed);
|
||||||
L.eSw("加入房间成功 channel"+channel+" uid"+uid);
|
L.eSw("加入房间成功 channel" + channel + " uid" + uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUserJoined(int uid, int elapsed) {
|
public void onUserJoined(int uid, int elapsed) {
|
||||||
super.onUserJoined(uid, 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.");
|
throw new RuntimeException("Check the error.");
|
||||||
}
|
}
|
||||||
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING); // 直播模式,引擎級別
|
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING); // 直播模式,引擎級別
|
||||||
// 启用视频模块
|
|
||||||
mRtcEngine.enableVideo();
|
|
||||||
// 开启本地预览
|
// 开启本地预览
|
||||||
//mRtcEngine.startPreview();
|
//mRtcEngine.startPreview();
|
||||||
}
|
}
|
||||||
@ -112,19 +136,20 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建语音房
|
* 创建语音房
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @param channelName
|
* @param channelName
|
||||||
* @param uid
|
* @param uid
|
||||||
*/
|
*/
|
||||||
public void joinAudioRoom(String channelName,String token,int uid){
|
public void joinAudioRoom(String channelName, String token, int uid) {
|
||||||
L.eSw("加入房间"+channelName+" uid"+uid);
|
L.eSw("加入房间" + channelName + " uid" + uid);
|
||||||
|
// 直播场景下,设置频道场景为 BROADCASTING (直播场景)
|
||||||
|
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
|
||||||
// 创建 ChannelMediaOptions 对象,并进行配置
|
// 创建 ChannelMediaOptions 对象,并进行配置
|
||||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||||
// 根据场景将用户角色设置为 AUDIENCE (观众)
|
// 根据场景将用户角色设置为 AUDIENCE (观众)
|
||||||
options.clientRoleType = Constants.CLIENT_ROLE_AUDIENCE;
|
options.clientRoleType = Constants.CLIENT_ROLE_AUDIENCE;
|
||||||
// 直播场景下,设置频道场景为 BROADCASTING (直播场景)
|
mRtcEngine.disableVideo();
|
||||||
options.audienceLatencyLevel = Constants.CHANNEL_PROFILE_LIVE_BROADCASTING; // 觀眾走極速直播
|
|
||||||
options.autoSubscribeVideo = false;
|
|
||||||
options.autoSubscribeAudio = true;
|
options.autoSubscribeAudio = true;
|
||||||
mRtcEngine.joinChannel(token, channelName, uid, options);
|
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;
|
int uid;
|
||||||
if (StringUtil.isEmpty(strUid)) {
|
if (StringUtil.isEmpty(strUid)) {
|
||||||
uid = 0;
|
uid = 0;
|
||||||
@ -159,6 +185,13 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
SurfaceView surfaceView = new SurfaceView(mContext);
|
SurfaceView surfaceView = new SurfaceView(mContext);
|
||||||
audienceContainer.addView(surfaceView);
|
audienceContainer.addView(surfaceView);
|
||||||
|
|
||||||
|
// 启用视频模块
|
||||||
|
mRtcEngine.enableVideo();
|
||||||
|
|
||||||
|
//走媒体音量,和音质有关
|
||||||
|
mRtcEngine.setAudioProfile(Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY);
|
||||||
|
mRtcEngine.setAudioScenario(Constants.AUDIO_SCENARIO_GAME_STREAMING);
|
||||||
|
|
||||||
// 创建 ChannelMediaOptions 对象,并进行配置
|
// 创建 ChannelMediaOptions 对象,并进行配置
|
||||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||||
// 根据场景将用户角色设置为 AUDIENCE (观众)
|
// 根据场景将用户角色设置为 AUDIENCE (观众)
|
||||||
@ -229,10 +262,11 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
mRtcEngine.updateChannelMediaOptions(options);
|
mRtcEngine.updateChannelMediaOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMicAudio(int toUid,boolean isEn) {
|
public void setMicAudio(int toUid, boolean isEn) {
|
||||||
L.eSw("setMicAudio:toUid" +toUid+"isEn "+ isEn);
|
L.eSw("setMicAudio:toUid" + toUid + "isEn " + isEn);
|
||||||
mRtcEngine.muteRemoteAudioStream(toUid,isEn);
|
mRtcEngine.muteRemoteAudioStream(toUid, isEn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PK-加入对方主播直播间
|
* PK-加入对方主播直播间
|
||||||
*
|
*
|
||||||
@ -310,7 +344,7 @@ public class SWAuManager extends BaseCacheManager {
|
|||||||
*/
|
*/
|
||||||
public void exitChannelAll() {
|
public void exitChannelAll() {
|
||||||
L.eSw("exitChannelAll exitChannelAll exitChannelAll");
|
L.eSw("exitChannelAll exitChannelAll exitChannelAll");
|
||||||
if(mRtcEngine!=null){
|
if (mRtcEngine != null) {
|
||||||
mRtcEngine.leaveChannel();
|
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;
|
this.linkUserContainer = linkUserContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface SwListener {
|
||||||
|
void onUserOffline(int liveUid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ public class SWManager extends BaseCacheManager {
|
|||||||
cfg.dimensions = VideoEncoderConfiguration.VD_1920x1080;
|
cfg.dimensions = VideoEncoderConfiguration.VD_1920x1080;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cfg.frameRate = 24;
|
cfg.frameRate = 20;
|
||||||
cfg.bitrate = 0;
|
cfg.bitrate = 0;
|
||||||
cfg.mirrorMode = VideoEncoderConfiguration.MIRROR_MODE_TYPE.MIRROR_MODE_ENABLED; //镜像
|
cfg.mirrorMode = VideoEncoderConfiguration.MIRROR_MODE_TYPE.MIRROR_MODE_ENABLED; //镜像
|
||||||
mRtcEngine.setVideoEncoderConfiguration(cfg);
|
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
|
* @param selectClarity
|
||||||
*/
|
*/
|
||||||
public void setDimensions(int selectClarity) {
|
public void setDimensions(int selectClarity) {
|
||||||
@ -221,6 +224,10 @@ public class SWManager extends BaseCacheManager {
|
|||||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||||
// 设置角色 BROADCASTER (主播) 或 AUDIENCE (观众)
|
// 设置角色 BROADCASTER (主播) 或 AUDIENCE (观众)
|
||||||
options.clientRoleType = Constants.CLIENT_ROLE_BROADCASTER;
|
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);
|
mRtcEngine.joinChannel(token, channelName, uid, options);
|
||||||
}
|
}
|
||||||
@ -297,6 +304,12 @@ public class SWManager extends BaseCacheManager {
|
|||||||
super.onError(err);
|
super.onError(err);
|
||||||
L.eSw("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 {
|
} else {
|
||||||
ToastUtil.show("主播正在PK,稍後再試");
|
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,8 +366,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
loadData(viewGroup, mCurrentItem);
|
loadData(viewGroup, mCurrentItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
getDrawer();
|
getDrawer();
|
||||||
|
|
||||||
@ -412,7 +410,9 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
} else {
|
} else {
|
||||||
new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||||
@Override
|
@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;
|
liveIndex = false;
|
||||||
try {
|
try {
|
||||||
mLiveSDK = Integer.parseInt(liveSdk);
|
mLiveSDK = Integer.parseInt(liveSdk);
|
||||||
@ -915,10 +915,11 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||||
@Override
|
@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) {
|
if (liveBean == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
isSw = isSw1;
|
||||||
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
||||||
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||||
return;
|
return;
|
||||||
|
@ -1237,8 +1237,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
JSONObject obj = JSON.parseObject(info[0]);
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
if (obj.getString("ispk").equals("0")) {
|
if (obj.getString("ispk").equals("0")) {
|
||||||
|
|
||||||
|
|
||||||
IMRTCManager.getInstance().requestJoinOtherRoom(pkUid, true, extra, new IRCRTCResultCallback() {
|
IMRTCManager.getInstance().requestJoinOtherRoom(pkUid, true, extra, new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@ -1270,7 +1268,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.show("主播正在PK,稍後再試");
|
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||||
if (RandomPkManager.getInstance().isRandomModel()) {
|
if (RandomPkManager.getInstance().isRandomModel()) {
|
||||||
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
||||||
}
|
}
|
||||||
@ -1345,7 +1343,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} 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) {
|
if (mLiveRoomViewHolder != null) {
|
||||||
mLiveRoomViewHolder.seisShowGif(true);
|
mLiveRoomViewHolder.seisShowGif(true);
|
||||||
mLiveRoomViewHolder.endDRGif();
|
if(isDRPK==1){
|
||||||
|
mLiveRoomViewHolder.endDRGif();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// if (mLiveRoomViewHolder != null) {
|
// if (mLiveRoomViewHolder != null) {
|
||||||
// mLiveRoomViewHolder.hotAddVisibility(false);
|
// mLiveRoomViewHolder.hotAddVisibility(false);
|
||||||
|
@ -1262,7 +1262,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.show("主播正在PK,稍後再試");
|
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||||
if (RandomPkManager.getInstance().isRandomModel()) {
|
if (RandomPkManager.getInstance().isRandomModel()) {
|
||||||
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
||||||
}
|
}
|
||||||
@ -1341,7 +1341,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} 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) {
|
if (mLiveRoomViewHolder != null) {
|
||||||
mLiveRoomViewHolder.seisShowGif(true);
|
mLiveRoomViewHolder.seisShowGif(true);
|
||||||
mLiveRoomViewHolder.endDRGif();
|
if(isDRPK==1){
|
||||||
|
mLiveRoomViewHolder.endDRGif();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if (mLiveRoomViewHolder != null) {
|
// if (mLiveRoomViewHolder != null) {
|
||||||
// mLiveRoomViewHolder.hotAddVisibility(false);
|
// mLiveRoomViewHolder.hotAddVisibility(false);
|
||||||
|
@ -21,6 +21,7 @@ import com.yunbao.common.CommonAppConfig;
|
|||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.common.bean.BaseModel;
|
import com.yunbao.common.bean.BaseModel;
|
||||||
|
import com.yunbao.common.bean.MsgSwitchFollowlModel;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.custom.CommonRefreshView;
|
import com.yunbao.common.custom.CommonRefreshView;
|
||||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
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.SVGAViewUtils;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.activity.LiveActivity;
|
import com.yunbao.live.activity.LiveActivity;
|
||||||
import com.yunbao.live.socket.SocketSendBean;
|
import com.yunbao.live.socket.SocketSendBean;
|
||||||
@ -123,23 +125,23 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<UserBean> {
|
|||||||
if (MicedUserManager.get().getMicUserList().size() < 3) {
|
if (MicedUserManager.get().getMicUserList().size() < 3) {
|
||||||
if (v.getTag() != null) {
|
if (v.getTag() != null) {
|
||||||
UserBean tag = (UserBean) v.getTag();
|
UserBean tag = (UserBean) v.getTag();
|
||||||
if (tag.getTypeMic() == TYPE_MIC_REQUEST) {
|
ViewClicksAntiShake.clicksAntiShake(mBtn, () -> {
|
||||||
SocketSendBean bean = createSocketSendBean().param("targetId", tag.getId());
|
if (tag.getTypeMic() == TYPE_MIC_REQUEST) {
|
||||||
applyMic(tag, 1, bean);
|
applyMic(tag, 4, createSocketSendBean());
|
||||||
ToastUtil.show(mContext.getString(R.string.live_mic_invite));
|
ToastUtil.show(mContext.getString(R.string.live_mic_request));
|
||||||
} else if (tag.getTypeMic() == TYPE_MIC_INVITE) {
|
for (int i = 0; i < mList.size(); i++) {
|
||||||
applyMic(tag, 4, createSocketSendBean());
|
if (TextUtils.equals(mList.get(i).getId(), tag.getId())) {
|
||||||
ToastUtil.show(mContext.getString(R.string.live_mic_request));
|
mList.get(i).setRequest(true);
|
||||||
for (int i = 0; i < mList.size(); i++) {
|
notifyItemChanged(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 {
|
}else {
|
||||||
ToastUtil.show(mContext.getString(R.string.live_mic_max));
|
ToastUtil.show(mContext.getString(R.string.live_mic_max));
|
||||||
}
|
}
|
||||||
@ -167,7 +169,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<UserBean> {
|
|||||||
return new SocketSendBean()
|
return new SocketSendBean()
|
||||||
.param("_method_", Constants.LIAN_MAI)
|
.param("_method_", Constants.LIAN_MAI)
|
||||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||||
.param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
.param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
|||||||
}
|
}
|
||||||
if (freePkNum == 0 && mDrPkNum == -1) {
|
if (freePkNum == 0 && mDrPkNum == -1) {
|
||||||
ToastUtil.show(mContext.getString(R.string.free_pk_num_null));
|
ToastUtil.show(mContext.getString(R.string.free_pk_num_null));
|
||||||
// return;
|
return;
|
||||||
}
|
}
|
||||||
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,6 +17,7 @@ public class LivePkBean {
|
|||||||
private String avatar;
|
private String avatar;
|
||||||
private String stream;
|
private String stream;
|
||||||
private String pkUid;
|
private String pkUid;
|
||||||
|
private String drpkStatus;
|
||||||
private int level;
|
private int level;
|
||||||
private int levelAnchor;
|
private int levelAnchor;
|
||||||
private int sex;
|
private int sex;
|
||||||
@ -69,6 +70,19 @@ public class LivePkBean {
|
|||||||
this.stream = stream;
|
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")
|
@JSONField(name = "pkuid")
|
||||||
public String getPkUid() {
|
public String getPkUid() {
|
||||||
if (pkUid == null) {
|
if (pkUid == null) {
|
||||||
|
@ -343,7 +343,11 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
|||||||
userBean.setId(bean.getUid());
|
userBean.setId(bean.getUid());
|
||||||
userBean.setUserNiceName(bean.getUserNiceName());
|
userBean.setUserNiceName(bean.getUserNiceName());
|
||||||
userBean.setAvatar(bean.getAvatar());
|
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");
|
userBean.setAttention("1");
|
||||||
list.add(userBean);
|
list.add(userBean);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import android.widget.PopupWindow;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.tencent.trtc.TRTCCloud;
|
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.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.http.HttpClient;
|
import com.yunbao.common.http.HttpClient;
|
||||||
|
import com.yunbao.common.http.LiveHttpUtil;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.manager.IMRTCManager;
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
@ -1047,7 +1049,20 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||||
}
|
}
|
||||||
if (mAcceptPk) {
|
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 {
|
} else {
|
||||||
if (mPkWaitCount < 0) {
|
if (mPkWaitCount < 0) {
|
||||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
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);
|
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||||
}
|
}
|
||||||
if (mAcceptPk) {
|
if (mAcceptPk) {
|
||||||
|
|
||||||
HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive")
|
HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive")
|
||||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||||
.params("pkuid", u.getId())
|
.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 {
|
} else {
|
||||||
if (mPkWaitCount < 0) {
|
if (mPkWaitCount < 0) {
|
||||||
|
@ -29,16 +29,22 @@ import android.widget.PopupWindow;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.google.gson.Gson;
|
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.tencent.trtc.TRTCCloud;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.event.AnchorInfoEvent;
|
import com.yunbao.common.event.AnchorInfoEvent;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.http.HttpClient;
|
import com.yunbao.common.http.HttpClient;
|
||||||
|
import com.yunbao.common.http.LiveHttpUtil;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.manager.IMRTCManager;
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
@ -109,7 +115,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
private Context mContext;
|
private Context mContext;
|
||||||
private View mRoot;
|
private View mRoot;
|
||||||
private boolean mIsAnchor;//自己是否是主播
|
private boolean mIsAnchor;//自己是否是主播
|
||||||
private SocketSwClient mSocketRyClient;
|
private SocketSwClient mSocketSwClient;
|
||||||
private ViewGroup mPkContainer;
|
private ViewGroup mPkContainer;
|
||||||
private boolean mIsApplyDialogShow;//是否显示了申请PK的弹窗
|
private boolean mIsApplyDialogShow;//是否显示了申请PK的弹窗
|
||||||
private boolean mAcceptPk;//是否接受连麦
|
private boolean mAcceptPk;//是否接受连麦
|
||||||
@ -285,7 +291,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSocketRyClient(SocketSwClient SocketRyClient) {
|
public void setSocketRyClient(SocketSwClient SocketRyClient) {
|
||||||
mSocketRyClient = SocketRyClient;
|
mSocketSwClient = SocketRyClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLiveUid(String liveUid, String url) {
|
public void setLiveUid(String liveUid, String url) {
|
||||||
@ -471,7 +477,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mPkSend = true;
|
mPkSend = true;
|
||||||
SocketSwLinkMicPkUtil.linkMicPkApply(mSocketRyClient, pkUid, stream);
|
SocketSwLinkMicPkUtil.linkMicPkApply(mSocketSwClient, pkUid, stream);
|
||||||
ToastUtil.show(mContext.getString(R.string.link_mic_apply_pk));
|
ToastUtil.show(mContext.getString(R.string.link_mic_apply_pk));
|
||||||
|
|
||||||
if (mLiveLinkMicPkViewHolder == null) {
|
if (mLiveLinkMicPkViewHolder == null) {
|
||||||
@ -571,13 +577,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
LivePushSwViewHolder.btn_close.setVisibility(View.VISIBLE);
|
LivePushSwViewHolder.btn_close.setVisibility(View.VISIBLE);
|
||||||
LiveSwAnchorActivity.isDRPK = 1;
|
LiveSwAnchorActivity.isDRPK = 1;
|
||||||
livePushSwViewHolder.setAnPkRtc(u);//设置对方主播视图
|
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);
|
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));
|
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UN_LEAVELIVE));
|
||||||
LiveSwAnchorActivity.isDRPK = 1;
|
LiveSwAnchorActivity.isDRPK = 1;
|
||||||
LivePushSwViewHolder.btn_close.setVisibility(View.VISIBLE);
|
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));
|
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UP_PK_TWO).setObject(mApplyUid));
|
||||||
onLinkMicPkStart(mApplyUid, 2);
|
onLinkMicPkStart(mApplyUid, 2);
|
||||||
}
|
}
|
||||||
@ -668,6 +667,19 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
if (mAcceptPk) {
|
if (mAcceptPk) {
|
||||||
isPK(u);
|
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 {
|
} else {
|
||||||
if (mPkWaitCount < 0) {
|
if (mPkWaitCount < 0) {
|
||||||
if(rtcRoom==null){
|
if(rtcRoom==null){
|
||||||
@ -908,7 +920,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||||
}
|
}
|
||||||
if (mAcceptPk) {
|
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() {
|
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
|
@Override
|
||||||
public void onSuccess(int code, String msgs, String[] info) {
|
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 {
|
} else {
|
||||||
if (mPkWaitCount < 0) {
|
if (mPkWaitCount < 0) {
|
||||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||||
@ -1637,7 +1662,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
mHandler.removeCallbacksAndMessages(null);
|
mHandler.removeCallbacksAndMessages(null);
|
||||||
}
|
}
|
||||||
mHandler = null;
|
mHandler = null;
|
||||||
mSocketRyClient = null;
|
mSocketSwClient = null;
|
||||||
if (mLiveLinkMicPkViewHolder != null) {
|
if (mLiveLinkMicPkViewHolder != null) {
|
||||||
mLiveLinkMicPkViewHolder.release();
|
mLiveLinkMicPkViewHolder.release();
|
||||||
}
|
}
|
||||||
|
@ -312,14 +312,13 @@ public class SocketSwClient {
|
|||||||
u.setUserNiceName(map.getString("uname"));
|
u.setUserNiceName(map.getString("uname"));
|
||||||
u.setId(map.getString("uid"));
|
u.setId(map.getString("uid"));
|
||||||
mListener.onLinkDRMicPkApply(u);
|
mListener.onLinkDRMicPkApply(u);
|
||||||
}
|
} else if (action3 == 2) {
|
||||||
//收到对方同意多人PK邀请
|
//收到对方同意多人PK邀请
|
||||||
else if (action3 == 2) {
|
|
||||||
if("0".equals(map.getString("msgtype"))){
|
if("0".equals(map.getString("msgtype"))){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserBean u = new UserBean();
|
UserBean u = new UserBean();
|
||||||
// u.setUserNiceName(map.getString("uname"));
|
// u.setUserNiceName(map.getString("uname"));
|
||||||
u.setId(map.getString("pkuid"));
|
u.setId(map.getString("pkuid"));
|
||||||
L.eSw("action3 == 2:"+u.getId());
|
L.eSw("action3 == 2:"+u.getId());
|
||||||
L.eSw("收到对方同意多人PK邀请");
|
L.eSw("收到对方同意多人PK邀请");
|
||||||
@ -1280,8 +1279,8 @@ public class SocketSwClient {
|
|||||||
case 1://收到对方主播PK回调
|
case 1://收到对方主播PK回调
|
||||||
UserBean u = new UserBean();
|
UserBean u = new UserBean();
|
||||||
u.setId(map.getString("uid"));
|
u.setId(map.getString("uid"));
|
||||||
u.setUserNiceName(map.getString("pkname"));
|
u.setUserNiceName(map.getString("uname"));
|
||||||
u.setAvatar(map.getString("pkhead"));
|
u.setAvatar(map.getString("uhead"));
|
||||||
u.setRandomPk("11".equals(map.getString("msgtype")));
|
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"), "11".equals(map.getString("msgtype"))?2:1);
|
||||||
break;
|
break;
|
||||||
@ -1306,7 +1305,7 @@ public class SocketSwClient {
|
|||||||
L.eSw("所有人收到PK开始址的回调");
|
L.eSw("所有人收到PK开始址的回调");
|
||||||
// RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
|
// RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
|
||||||
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(map.getString("pkuid")));
|
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;
|
break;
|
||||||
case 5://PK时候断开连麦的回调
|
case 5://PK时候断开连麦的回调
|
||||||
// if (rtcRoom != null) {
|
// if (rtcRoom != null) {
|
||||||
@ -1341,61 +1340,62 @@ public class SocketSwClient {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 10://系统发起PK回调
|
case 10://系统发起PK回调
|
||||||
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK)
|
if(livePushSwViewHolder!=null){
|
||||||
.param("action", 2)
|
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK)
|
||||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
.param("action", 2)
|
||||||
.param("pkuid", CommonAppConfig.getInstance().getUid())
|
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||||
.param("msgtype", 2)
|
.param("pkuid", CommonAppConfig.getInstance().getUid())
|
||||||
.param("uid", CommonAppConfig.getInstance().getUid())
|
.param("msgtype", 2)
|
||||||
.param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
.param("uid", CommonAppConfig.getInstance().getUid())
|
||||||
.param("random_pk", "1")
|
.param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||||
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
.param("random_pk", "1")
|
||||||
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||||
msg1.create();
|
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
msg1.create();
|
||||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(map.getString("uid"), conversationType, messageContent);
|
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() {
|
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onAttached(io.rong.imlib.model.Message message) {
|
public void onAttached(io.rong.imlib.model.Message message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||||
Log.e("tx", "aaa" + errorCode.toString());
|
Log.e("tx", "aaa" + errorCode.toString());
|
||||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
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();
|
/*JSONObject msg1 = new JSONObject();
|
||||||
msg1.put("type", "autoLivePK");
|
msg1.put("type", "autoLivePK");
|
||||||
msg1.put("uid", CommonAppConfig.getInstance().getUid());
|
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.bean.UserBean;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.http.HttpClient;
|
import com.yunbao.common.http.HttpClient;
|
||||||
|
import com.yunbao.common.utils.L;
|
||||||
|
|
||||||
import io.rong.imlib.IRongCallback;
|
import io.rong.imlib.IRongCallback;
|
||||||
import io.rong.imlib.RongIMClient;
|
import io.rong.imlib.RongIMClient;
|
||||||
@ -47,7 +48,7 @@ public class SocketSwLinkMicPkUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msgs, String[] info) {
|
public void onSuccess(int code, String msgs, String[] info) {
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
|
L.eSw("1111111111111111111111111111");
|
||||||
HttpClient.getInstance().get("Livepk.setPK", "Livepk.setPK")
|
HttpClient.getInstance().get("Livepk.setPK", "Livepk.setPK")
|
||||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||||
.params("pkuid", pkUid)
|
.params("pkuid", pkUid)
|
||||||
@ -58,10 +59,12 @@ public class SocketSwLinkMicPkUtil {
|
|||||||
public void onSuccess(int code, String msgs, String[] info) {
|
public void onSuccess(int code, String msgs, String[] info) {
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
Log.e("ry",name+"啊啊"+url);
|
Log.e("ry",name+"啊啊"+url);
|
||||||
|
L.eSw("2222222222222222222222");
|
||||||
final SocketSendBean msg1 = new SocketSendBean()
|
final SocketSendBean msg1 = new SocketSendBean()
|
||||||
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
|
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
|
||||||
.param("action", 4)
|
.param("action", 4)
|
||||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
.param("uname", url)
|
||||||
|
.param("uhead", name)
|
||||||
.param("pkuid", pkUid)
|
.param("pkuid", pkUid)
|
||||||
.param("uid", CommonAppConfig.getInstance().getUid())
|
.param("uid", CommonAppConfig.getInstance().getUid())
|
||||||
.param("pkhead", url)
|
.param("pkhead", url)
|
||||||
|
@ -35,13 +35,20 @@ import com.lxj.xpopup.interfaces.XPopupCallback;
|
|||||||
import com.lzf.easyfloat.EasyFloat;
|
import com.lzf.easyfloat.EasyFloat;
|
||||||
import com.lzy.okserver.OkDownload;
|
import com.lzy.okserver.OkDownload;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
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.EnterRoomNewModel;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.dialog.LiveFontSizeSettingDialog;
|
import com.yunbao.common.dialog.LiveFontSizeSettingDialog;
|
||||||
|
import com.yunbao.common.http.API;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.http.HttpClient;
|
import com.yunbao.common.http.HttpClient;
|
||||||
|
import com.yunbao.common.http.ResponseModel;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
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.Bus;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
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.activity.LiveAudienceActivity;
|
||||||
import com.yunbao.live.bean.DrPkbean;
|
import com.yunbao.live.bean.DrPkbean;
|
||||||
import com.yunbao.live.event.LiveAudienceEvent;
|
import com.yunbao.live.event.LiveAudienceEvent;
|
||||||
|
import com.yunbao.live.socket.SocketSendBean;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
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.base.RTCErrorCode;
|
||||||
import cn.rongcloud.rtc.core.RendererCommon;
|
import cn.rongcloud.rtc.core.RendererCommon;
|
||||||
import io.agora.beautyapi.faceunity.agora.SWAuManager;
|
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 {
|
public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
|
||||||
|
|
||||||
@ -205,8 +222,57 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
swAuManager.setAudienceContainer(ry_view);
|
swAuManager.setAudienceContainer(ry_view);
|
||||||
swAuManager.initRtcEngine((Activity) mContext);
|
swAuManager.initRtcEngine((Activity) mContext);
|
||||||
swAuManager.setupRemoteVideo(Integer.parseInt(liveUid));
|
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()
|
final SocketSendBean msg1 = new SocketSendBean()
|
||||||
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
|
.param("_method_", Constants.SOCKET_LINK_MIC_PK)
|
||||||
.param("action", 4)
|
.param("action", 4)
|
||||||
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
.param("pkname", u.getUserNiceName())
|
||||||
.param("pkuid", u.getId())
|
.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());
|
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||||
msg1.create();
|
msg1.create();
|
||||||
|
|
||||||
|
@ -344,15 +344,24 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boolean isChangeSdk = false;
|
||||||
|
|
||||||
@Override
|
@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;
|
isEnterRoom = false;
|
||||||
MobclickAgent.onEvent(mContext, "live_room_chat_list", "滑动直播间聊天列表");
|
MobclickAgent.onEvent(mContext, "live_room_chat_list", "滑动直播间聊天列表");
|
||||||
openParametersModel = new OpenParametersModel();
|
openParametersModel = new OpenParametersModel();
|
||||||
if (mLiveRoomViewHolder != null) {
|
/*if (mLiveRoomViewHolder != null) {
|
||||||
mLiveRoomViewHolder.UpPkTwo();
|
mLiveRoomViewHolder.UpPkTwo();
|
||||||
}
|
}*/
|
||||||
mContext.runOnUiThread(new Runnable() {
|
mContext.runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -387,23 +396,28 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
frameAnimation.start();
|
frameAnimation.start();
|
||||||
liveHandler.removeCallbacks(loadRunnableGone);
|
liveHandler.removeCallbacks(loadRunnableGone);
|
||||||
liveHandler.removeCallbacks(loadTimeoutRunnableGone);
|
liveHandler.removeCallbacks(loadTimeoutRunnableGone);
|
||||||
if (mLivePlayViewHolder == null) {
|
|
||||||
|
if (mLivePlayViewHolder == null|| isChangeSdk) {
|
||||||
|
|
||||||
if (isSw) {
|
if (isSw) {
|
||||||
mLivePlayViewHolder = new LivePlaySwViewHolder(mContext, playContainer, 1);
|
mLivePlayViewHolder = new LivePlaySwViewHolder(mContext, playContainer, 1);
|
||||||
} else {
|
} else {
|
||||||
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
|
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
mLivePlayViewHolder.initSwEngine(mLiveBean.getUid());
|
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);
|
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);
|
mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
|
||||||
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
|
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
|
||||||
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
|
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
|
||||||
|
|
||||||
if (isSw) {
|
if (isSw) {
|
||||||
mLiveSwLinkMicPkPresenter = new LiveSwLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
mLiveSwLinkMicPkPresenter = new LiveSwLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
||||||
} else {
|
} else {
|
||||||
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mLivePlayViewHolder.removeFromParent();
|
||||||
mLivePlayViewHolder.addToParent();
|
mLivePlayViewHolder.addToParent();
|
||||||
mLivePlayViewHolder.subscribeActivityLifeCycle();
|
mLivePlayViewHolder.subscribeActivityLifeCycle();
|
||||||
mLivePlayViewHolder.setLoadViewListener(new LiveRoomPlayViewHolder.LoadingListener() {
|
mLivePlayViewHolder.setLoadViewListener(new LiveRoomPlayViewHolder.LoadingListener() {
|
||||||
@ -413,11 +427,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
liveHandler.removeCallbacks(loadTimeoutRunnableGone);
|
liveHandler.removeCallbacks(loadTimeoutRunnableGone);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mLiveRoomViewHolder.subscribeActivityLifeCycle();
|
mLiveRoomViewHolder.removeFromParent();
|
||||||
mLiveAudienceViewHolder.addToParent();
|
|
||||||
mLiveRoomViewHolder.addToParent();
|
mLiveRoomViewHolder.addToParent();
|
||||||
|
mLiveRoomViewHolder.subscribeActivityLifeCycle();
|
||||||
|
|
||||||
|
mLiveAudienceViewHolder.removeFromParent();
|
||||||
|
mLiveAudienceViewHolder.addToParent();
|
||||||
mLiveAudienceViewHolder.subscribeActivityLifeCycle();
|
mLiveAudienceViewHolder.subscribeActivityLifeCycle();
|
||||||
} else {
|
} else {
|
||||||
|
mLivePlayViewHolder.initSwEngine(mLiveBean.getUid());
|
||||||
mLivePlayViewHolder.setLiveBeanLandscape(1);
|
mLivePlayViewHolder.setLiveBeanLandscape(1);
|
||||||
mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
|
mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
|
||||||
mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
|
mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
|
||||||
@ -1012,7 +1030,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveRyLinkMicPkPresenter = null;
|
mLiveRyLinkMicPkPresenter = null;
|
||||||
if (PermissionUtils.checkPermission(mContext) && !kick) {
|
if (PermissionUtils.checkPermission(mContext) && !kick) {
|
||||||
LiveFloatView.getInstance()
|
LiveFloatView.getInstance()
|
||||||
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
|
.cacheLiveData(mLiveBean, mLiveType, isSw? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_KSY, mLiveTypeVal)
|
||||||
.builderSystemFloat(mContext, mLiveBean.getPull());
|
.builderSystemFloat(mContext, mLiveBean.getPull());
|
||||||
mContext.finish();
|
mContext.finish();
|
||||||
} else {
|
} else {
|
||||||
@ -1020,7 +1038,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
EventBus.getDefault()
|
EventBus.getDefault()
|
||||||
.post(new LiveFloatEvent()
|
.post(new LiveFloatEvent()
|
||||||
.setmLiveBean(mLiveBean)
|
.setmLiveBean(mLiveBean)
|
||||||
.setmLiveSDK(mLiveSDK)
|
.setmLiveSDK(isSw? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_KSY)
|
||||||
.setmLiveType(mLiveType)
|
.setmLiveType(mLiveType)
|
||||||
.setmLiveTypeVal(mLiveTypeVal));
|
.setmLiveTypeVal(mLiveTypeVal));
|
||||||
}
|
}
|
||||||
@ -1059,7 +1077,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
boolean floatPermission = PermissionUtils.checkPermission(mContext);
|
boolean floatPermission = PermissionUtils.checkPermission(mContext);
|
||||||
if (mLiveBean != null && !isQuitF && !isForeground && floatPermission) {
|
if (mLiveBean != null && !isQuitF && !isForeground && floatPermission) {
|
||||||
LiveFloatView.getInstance()
|
LiveFloatView.getInstance()
|
||||||
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
|
.cacheLiveData(mLiveBean, mLiveType, isSw? Constants.LIVE_SDK_SW:Constants.LIVE_SDK_KSY, mLiveTypeVal)
|
||||||
.builderSystemFloat(mContext, mLiveBean.getPull());
|
.builderSystemFloat(mContext, mLiveBean.getPull());
|
||||||
mContext.finish();
|
mContext.finish();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -11,6 +12,7 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/camera"
|
android:id="@+id/camera"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -38,51 +40,53 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/dr_pk_view"
|
android:id="@+id/dr_pk_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="270dp"
|
||||||
android:layout_marginTop="130dp"
|
android:layout_marginTop="130dp"
|
||||||
android:orientation="vertical"
|
android:orientation="horizontal"
|
||||||
android:visibility="gone">
|
android:visibility="visible">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/dr1_preview"
|
android:id="@+id/dr1_preview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@mipmap/live_icon_vacancy" />
|
android:background="@mipmap/live_icon_vacancy"
|
||||||
|
tools:ignore="NestedWeights" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/dr2_preview"
|
android:id="@+id/dr3_preview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@mipmap/live_icon_vacancy" />
|
android:background="@mipmap/live_icon_vacancy" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/dr3_preview"
|
android:id="@+id/dr2_preview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@mipmap/live_icon_vacancy" />
|
android:background="@mipmap/live_icon_vacancy"
|
||||||
|
tools:ignore="NestedWeights" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/dr4_preview"
|
android:id="@+id/dr4_preview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@mipmap/live_icon_vacancy" />
|
android:background="@mipmap/live_icon_vacancy" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user