/**
* 加入房间(房间不存在则创建)
*/
public void onClickJoinRoom(View view) {
String roomId = etRoomId.getText().toString();
String userName = etUserName.getText().toString();
if (roomId.length() == 0) {
Toast.makeText(this, "RoomId 为空!", Toast.LENGTH_SHORT).show();
return;
}
AVDManager.getInstance()
// 设置服务器地址和鉴权信息,不调用则使用默认的测试服务器
.AVDAuthentication(new Setting.AVDAuthentication(
CommonBean.serverURI,
CommonBean.accessKey,
CommonBean.secretKey))
// 设置AVDSDK选项,不调用则使用默认参数
.setOption(new Setting.AVDOption(
true,
false,
CommonBean.Resolution.MIDDLE))
// 初始化AVD SDK
.init(this, new RoomManager.RoomParams(roomId, userName), new AVDManager.AVDSetupListener() {
@Override
public void success() {
Intent intent = new Intent(JoinMeetActivity.this, MeetingActivity.class);
startActivity(intent);
}
@Override
public void error(String errorCode) {
MyToast.showToast(JoinMeetActivity.this, errorCode, true, true);
}
});
}
网友评论