|
你好,这个android客户端demo代码我做了下简单修改。我只改了下面这两个地方,但是视频不显示了。
控制台会一致报这个 Surface::dequeueBuffer returned error -22
修改的第一处:改了LoginActivity 类中的onCreate方法,跳转到其他activity如下:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setDisPlayMetrics();
// configEntity = ConfigService.LoadConfig(this);
// InitialSDK();
// InitialLayout();
Intent intent = new Intent();
intent.setClass(this, UserListActivity.class);
startActivity(intent);
}
修改的第二处:我增加了一个Activity,在这个里面我获得在线人员并跳到视频页面
public class UserListActivity extends Activity implements AnyChatBaseEvent {
@Override
protected void onDestroy() {
anychat.Release(); // 关闭SDK
super.onDestroy();
}
public AnyChatCoreSDK anychat;
private ConfigEntity configEntity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
configEntity = ConfigService.LoadConfig(this);
configEntity.IsSaveNameAndPw = true;
configEntity.name = "testtest_1";
configEntity.password = "123456";
configEntity.ip = "192.168.1.114";
configEntity.port = 8906;
ConfigService.SaveConfig(this, configEntity);
InitialSDK();
connec();
}
private void InitialSDK()
{
if (anychat == null) {
anychat = new AnyChatCoreSDK();
anychat.SetBaseEvent(this);
if (configEntity.useARMv6Lib != 0)
AnyChatCoreSDK.SetSDKOptionInt(AnyChatDefine.BRAC_SO_CORESDK_USEARMV6LIB, 1);
anychat.InitSDK(android.os.Build.VERSION.SDK_INT, 0);
}
}
public void connec(){
anychat.Connect("192.168.1.114", 8906);
anychat.Login("testtest_1", "123456");
anychat.EnterRoom(1, "");
}
public void getUser(){
int[] user = anychat.GetOnlineUser();
System.out.println(">>>>>>>>>>>>>>>user>>>>>>>>>>>>>>>> "+user.length);
Log.e("UserListActivity", "***************开始跳转***************** "+user[0]);
Intent intent = new Intent();
intent.setClass(this, VideoActivity.class);
intent.putExtra("UserID", ""+user[0]);
startActivity(intent);
}
@Override
protected void onResume() {
super.onResume();
}
@Override
public void OnAnyChatConnectMessage(boolean bSuccess) {
// TODO Auto-generated method stub
}
@Override
public void OnAnyChatLoginMessage(int dwUserId, int dwErrorCode) {
// TODO Auto-generated method stub
}
@Override
public void OnAnyChatEnterRoomMessage(int dwRoomId, int dwErrorCode) {
// TODO Auto-generated method stub
getUser();
}
@Override
public void OnAnyChatOnlineUserMessage(int dwUserNum, int dwRoomId) {
// TODO Auto-generated method stub
}
@Override
public void OnAnyChatUserAtRoomMessage(int dwUserId, boolean bEnter) {
// TODO Auto-generated method stub
}
@Override
public void OnAnyChatLinkCloseMessage(int dwErrorCode) {
// TODO Auto-generated method stub
}
}
|
|