add[声望升级-多人PK]
This commit is contained in:
@@ -76,6 +76,21 @@ public class SWAuManager extends BaseCacheManager {
|
||||
//mRtcEngine.startPreview();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主播视图
|
||||
* @param frameLayout
|
||||
*/
|
||||
public void updateMyChannelView(FrameLayout frameLayout,int uid) {
|
||||
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.setupRemoteVideo(videoCanvas);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 加入房间
|
||||
*/
|
||||
@@ -101,14 +116,7 @@ public class SWAuManager extends BaseCacheManager {
|
||||
}
|
||||
|
||||
|
||||
public void joinExRoomEx(String strUid, String token, String channelName) {
|
||||
int uid;
|
||||
if (StringUtil.isEmpty(strUid)) {
|
||||
uid = 0;
|
||||
} else {
|
||||
uid = Integer.parseInt(strUid);
|
||||
}
|
||||
|
||||
public void joinExRoomEx(int strUid, String token, String channelName) {
|
||||
// 创建 ChannelMediaOptions 对象,并进行配置
|
||||
ChannelMediaOptions options = new ChannelMediaOptions();
|
||||
// 根据场景将用户角色设置为 AUDIENCE (观众)
|
||||
@@ -119,23 +127,24 @@ public class SWAuManager extends BaseCacheManager {
|
||||
options.autoSubscribeAudio = true;
|
||||
|
||||
RtcConnection rtcConnection = new RtcConnection();
|
||||
rtcConnection.channelId = "g99411"; //對方主播的頻道
|
||||
rtcConnection.localUid = 99412;//自己的ID
|
||||
rtcConnection.channelId = channelName; //對方主播的頻道
|
||||
rtcConnection.localUid = Integer.parseInt(CommonAppConfig.getInstance().getUid());//自己的ID
|
||||
|
||||
mRtcEngine.joinChannelEx(token, rtcConnection, options, new IRtcEngineEventHandler() {
|
||||
@Override
|
||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
super.onJoinChannelSuccess(channel, uid, elapsed);
|
||||
L.eSw("onJoinChannelSuccess:" + channel + " uid " +uid+ " elapsed: " + elapsed);
|
||||
|
||||
SurfaceView surfaceView = new SurfaceView(mContext);
|
||||
surfaceView.setZOrderMediaOverlay(true);
|
||||
pkContainer1.addView(surfaceView);
|
||||
|
||||
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, 99411);
|
||||
|
||||
mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
|
||||
|
||||
mContext.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
L.eSw("onJoinChannelSuccess:" + channel + " uid " +uid+ " elapsed: " + elapsed);
|
||||
SurfaceView surfaceView = new SurfaceView(mContext);
|
||||
surfaceView.setZOrderMediaOverlay(true);
|
||||
pkContainer1.addView(surfaceView);
|
||||
VideoCanvas videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, strUid);
|
||||
mRtcEngine.setupRemoteVideoEx(videoCanvas, rtcConnection);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,6 +155,18 @@ public class SWAuManager 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);
|
||||
}
|
||||
|
||||
public static String getChannelName(String liveUid) {
|
||||
return CommonAppConfig.SWChannelPrefix + liveUid;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public class SWManager extends BaseCacheManager {
|
||||
anchorContainer.addView(surfaceView);
|
||||
Config config = new Config(mContext, mRtcEngine, FURenderer.INSTANCE.mFURenderKit, null, CaptureMode.Agora, 0, false, new CameraConfig(MirrorMode.MIRROR_NONE,MirrorMode.MIRROR_NONE));
|
||||
faceUnityBeautyAPI.initialize(config);
|
||||
faceUnityBeautyAPI.enable(true);
|
||||
faceUnityBeautyAPI.enable(false);
|
||||
|
||||
faceUnityBeautyAPI.setBeautyPreset(BeautyPreset.CUSTOM);
|
||||
//FaceUnityBeautyManage.getInstance().mFURenderKit.setFaceBeauty();
|
||||
|
||||
Reference in New Issue
Block a user