add[声望升级]
This commit is contained in:
@@ -898,6 +898,66 @@ public class UserBean implements Parcelable {
|
||||
this.bubble = bubble;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserBean{" +
|
||||
"id='" + id + '\'' +
|
||||
", userNiceName='" + userNiceName + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", avatarThumb='" + avatarThumb + '\'' +
|
||||
", sex=" + sex +
|
||||
", signature='" + signature + '\'' +
|
||||
", coin='" + coin + '\'' +
|
||||
", gold='" + gold + '\'' +
|
||||
", votes='" + votes + '\'' +
|
||||
", consumption='" + consumption + '\'' +
|
||||
", votestotal='" + votestotal + '\'' +
|
||||
", province='" + province + '\'' +
|
||||
", city='" + city + '\'' +
|
||||
", location='" + location + '\'' +
|
||||
", birthday='" + birthday + '\'' +
|
||||
", level=" + level +
|
||||
", levelAnchor=" + levelAnchor +
|
||||
", lives=" + lives +
|
||||
", follows=" + follows +
|
||||
", fans=" + fans +
|
||||
", vip=" + vip +
|
||||
", liang=" + liang +
|
||||
", car=" + car +
|
||||
", medal_level=" + medal_level +
|
||||
", medal_name='" + medal_name + '\'' +
|
||||
", Dress=" + Dress +
|
||||
", noble_id='" + noble_id + '\'' +
|
||||
", yuanbao='" + yuanbao + '\'' +
|
||||
", noble_name='" + noble_name + '\'' +
|
||||
", islive='" + islive + '\'' +
|
||||
", medal_no_display_src='" + medal_no_display_src + '\'' +
|
||||
", hot_num='" + hot_num + '\'' +
|
||||
", goodnum='" + goodnum + '\'' +
|
||||
", fans_pic='" + fans_pic + '\'' +
|
||||
", gifticon='" + gifticon + '\'' +
|
||||
", department_name='" + department_name + '\'' +
|
||||
", token_rong='" + token_rong + '\'' +
|
||||
", noble_end_time='" + noble_end_time + '\'' +
|
||||
", slide='" + slide + '\'' +
|
||||
", users_type='" + users_type + '\'' +
|
||||
", is_bind='" + is_bind + '\'' +
|
||||
", mobile='" + mobile + '\'' +
|
||||
", front_task='" + front_task + '\'' +
|
||||
", is_admin='" + is_admin + '\'' +
|
||||
", praise=" + praise +
|
||||
", isHide=" + isHide +
|
||||
", randomPk=" + randomPk +
|
||||
", mRankPkImgUrl='" + mRankPkImgUrl + '\'' +
|
||||
", user_info_complete=" + user_info_complete +
|
||||
", fansLevel=" + fansLevel +
|
||||
", typeMic=" + typeMic +
|
||||
", isMicList=" + isMicList +
|
||||
", isRequest=" + isRequest +
|
||||
", fansEnterRoomUrl='" + fansEnterRoomUrl + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import io.agora.rtc2.ChannelMediaOptions;
|
||||
import io.agora.rtc2.Constants;
|
||||
import io.agora.rtc2.IRtcEngineEventHandler;
|
||||
import io.agora.rtc2.RtcConnection;
|
||||
import io.agora.rtc2.RtcEngine;
|
||||
import io.agora.rtc2.RtcEngineConfig;
|
||||
import io.agora.rtc2.RtcEngineEx;
|
||||
import io.agora.rtc2.video.VideoCanvas;
|
||||
@@ -55,7 +54,6 @@ public class SWManager extends BaseCacheManager {
|
||||
|
||||
/**
|
||||
* 获取单列
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static SWManager get() {
|
||||
@@ -117,6 +115,10 @@ public class SWManager extends BaseCacheManager {
|
||||
mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置清晰度
|
||||
* @param selectClarity
|
||||
*/
|
||||
public void setDimensions(int selectClarity) {
|
||||
if (cfg != null && mRtcEngine != null) {
|
||||
switch (selectClarity) {
|
||||
@@ -135,9 +137,9 @@ public class SWManager extends BaseCacheManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建房间
|
||||
* 创建直播间
|
||||
*/
|
||||
public void createRoom(String token, String channelName) {
|
||||
public void createChannel(String token, String channelName) {
|
||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||
// 设置角色 BROADCASTER (主播) 或 AUDIENCE (观众)
|
||||
options.clientRoleType = Constants.CLIENT_ROLE_BROADCASTER;
|
||||
@@ -145,23 +147,28 @@ public class SWManager extends BaseCacheManager {
|
||||
mRtcEngine.joinChannel(token, channelName, uid, options);
|
||||
}
|
||||
|
||||
public void updateMyVideoView(FrameLayout frameLayout, String channelName) {
|
||||
mRtcEngine.setupRemoteVideoEx(null, null);
|
||||
|
||||
RtcConnection rtcConnection = new RtcConnection();
|
||||
rtcConnection.channelId = channelName; //自己频道名称
|
||||
rtcConnection.localUid = uid;//自己的ID
|
||||
|
||||
/**
|
||||
* 更新主播视图
|
||||
* @param frameLayout
|
||||
*/
|
||||
public void updateMyChannelView(FrameLayout frameLayout) {
|
||||
mRtcEngine.setupLocalVideo(null);
|
||||
SurfaceView surfaceView = new SurfaceView(mContext);
|
||||
surfaceView.setZOrderMediaOverlay(true);
|
||||
frameLayout.addView(surfaceView);
|
||||
|
||||
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid);
|
||||
mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
|
||||
mRtcEngine.setupLocalVideo(videoCanvas);
|
||||
}
|
||||
|
||||
|
||||
public void joinExRoomEx(String strUid, String token,String toUid, String channelName) {
|
||||
/**
|
||||
* PK-加入对方主播直播间
|
||||
* @param strUid
|
||||
* @param token
|
||||
* @param toUid
|
||||
* @param channelName
|
||||
*/
|
||||
public void joinChannelEx(String strUid, String token, String toUid, String channelName) {
|
||||
int tempUid;
|
||||
if (StringUtil.isEmpty(strUid)) {
|
||||
tempUid = 0;
|
||||
@@ -199,6 +206,11 @@ public class SWManager extends BaseCacheManager {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeaveChannel(RtcStats stats) {
|
||||
super.onLeaveChannel(stats);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int err) {
|
||||
super.onError(err);
|
||||
@@ -207,6 +219,30 @@ public class SWManager extends BaseCacheManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出对方直播间
|
||||
* @param uid 自己的ID
|
||||
* @param liveUid 对方直播间号
|
||||
*/
|
||||
public void exitChannelToUid(int uid, String liveUid){
|
||||
RtcConnection rtcConnection = new RtcConnection();
|
||||
rtcConnection.channelId = getChannelName(liveUid); //對方主播的頻道
|
||||
rtcConnection.localUid = uid;//自己的ID
|
||||
mRtcEngine.leaveChannelEx(rtcConnection);
|
||||
}
|
||||
|
||||
//设置对方主播视图
|
||||
private void setupRemoteVideo(int uid) {
|
||||
SurfaceView surfaceView = new SurfaceView(mContext);
|
||||
surfaceView.setZOrderMediaOverlay(true);
|
||||
pkContainer1.addView(surfaceView);
|
||||
// 将 SurfaceView 对象传入声网实时互动 SDK,设置远端视图
|
||||
mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_FIT, uid));
|
||||
}
|
||||
|
||||
public void setAnchorContainer(FrameLayout anchorContainer) {
|
||||
this.anchorContainer = anchorContainer;
|
||||
}
|
||||
//远程监听
|
||||
private final IRtcEngineEventHandler mRtcEventHandler = new IRtcEngineEventHandler() {
|
||||
@Override
|
||||
@@ -224,6 +260,7 @@ public class SWManager extends BaseCacheManager {
|
||||
@Override
|
||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
super.onJoinChannelSuccess(channel, uid, elapsed);
|
||||
L.eSw("onJoinChannelSuccess 加入频道:channel"+channel+" uid:"+uid+" elapsed:"+elapsed);
|
||||
if (onRtcEngineListener != null) {
|
||||
onRtcEngineListener.onOpenSuccess(channel, uid);
|
||||
}
|
||||
@@ -232,20 +269,29 @@ public class SWManager extends BaseCacheManager {
|
||||
@Override
|
||||
public void onError(int err) {
|
||||
super.onError(err);
|
||||
L.eSw("onError 错误码:"+err);
|
||||
ToastUtil.show("onError:" + err);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTokenPrivilegeWillExpire(String token) {
|
||||
super.onTokenPrivilegeWillExpire(token);
|
||||
L.eSw("onTokenPrivilegeWillExpire_Token 即将失效");
|
||||
refreshToken();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestToken() {
|
||||
super.onRequestToken();
|
||||
L.eSw("onRequestToken_Token失效");
|
||||
refreshToken();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeaveChannel(RtcStats stats) {
|
||||
super.onLeaveChannel(stats);
|
||||
L.eSw("onLeaveChannel退出頻道");
|
||||
}
|
||||
};
|
||||
|
||||
private void refreshToken() {
|
||||
@@ -255,6 +301,7 @@ public class SWManager extends BaseCacheManager {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.renewToken(data.getToken());
|
||||
}
|
||||
L.eSw("refreshToken_重新获取Token成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -264,19 +311,6 @@ public class SWManager extends BaseCacheManager {
|
||||
});
|
||||
}
|
||||
|
||||
//设置对方主播视图
|
||||
private void setupRemoteVideo(int uid) {
|
||||
SurfaceView surfaceView = new SurfaceView(mContext);
|
||||
surfaceView.setZOrderMediaOverlay(true);
|
||||
pkContainer1.addView(surfaceView);
|
||||
// 将 SurfaceView 对象传入声网实时互动 SDK,设置远端视图
|
||||
mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_FIT, uid));
|
||||
}
|
||||
|
||||
public void setAnchorContainer(FrameLayout anchorContainer) {
|
||||
this.anchorContainer = anchorContainer;
|
||||
}
|
||||
|
||||
public interface onRtcEngineListener {
|
||||
void onOpenSuccess(String channel, int uid);
|
||||
}
|
||||
@@ -296,4 +330,7 @@ public class SWManager extends BaseCacheManager {
|
||||
public void setLinkUserContainer(FrameLayout linkUserContainer) {
|
||||
this.linkUserContainer = linkUserContainer;
|
||||
}
|
||||
public static String getChannelName(String liveUid) {
|
||||
return CommonAppConfig.SWChannelPrefix + liveUid;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user