-
Notifications
You must be signed in to change notification settings - Fork 1
rtc_mode
Su, Jia edited this page Jan 3, 2018
·
3 revisions
当连麦人数只有两人时,demo中呈现了两张窗口的显示模式:
//画中画(大小窗口)模式
public static final int RTC_DEFAULT_MODE = 0;
//1:1 PK模式
public static final int RTC_PK_MODE = 1;
在调用startRTC接口时,可根据mRTCMode的值在不同模式间切换:
private void startRTC() {
if (!isNetworkConnectionAvailable(this)) {
makeToast("网络错误,请检查网络设置");
return;
}
if (mRTCMode == DemoActivity.RTC_DEFAULT_MODE) {
//设置连麦时小窗口位置尺寸
mStreamer.setRTCSubScreenRect(0.6f, 0.05f, 0.35f, 0.35f, KMCAgoraStreamer
.SCALING_MODE_CENTER_CROP);
//设置连麦时本地camera窗口位置尺寸
mStreamer.setRTCMainScreenRect(0.f, 0.f, 1.0f, 1.0f,
KMCAgoraStreamer.SCALING_MODE_CENTER_CROP);
//设置主窗口为camera窗口
mStreamer.setRTCMainScreen(KMCAgoraStreamer.RTC_MAIN_SCREEN_CAMERA);
} else if (mRTCMode == DemoActivity.RTC_PK_MODE) {
//设置连麦时小窗口位置尺寸
mStreamer.setRTCSubScreenRect(0.5f, 0.25f, 0.5f, 0.5f, KMCAgoraStreamer
.SCALING_MODE_CENTER_CROP);
//设置连麦时本地camera窗口位置尺寸
mStreamer.setRTCMainScreenRect(0.f, 0.25f, 0.5f, 0.5f,
KMCAgoraStreamer.SCALING_MODE_CENTER_CROP);
//设置主窗口为camera窗口
mStreamer.setRTCMainScreen(KMCAgoraStreamer.RTC_MAIN_SCREEN_CAMERA);
mShowBgPicture = true;
showBgPicture();
}
String tempChannel = "ksy24";
mStreamer.startRTC(tempChannel);
mIsCaling = true;
mRTCText.setText("停止RTC");
mRTCText.postInvalidate();
}