|
您好,为什么我在由A向B发送请求之后,日志返回的是
Invoke VideoCallControl(EventType:1, UserId:-5244, ErrorCode:0, dwFlags:0, dwParam:0, UserStr:zhkmxx930@door)=0
Message OnVideoCallEvent(EventType:2, UserId:-5244, ErrorCode:100103, dwFlags:0x0, dwParam:0
然后接收方那边日志是
Message OnVideoCallEvent(EventType:1, UserId:-5245, ErrorCode:0, dwFlags:0x0, dwParam:0
然后我的 OnAnyChatVideoCallEvent 这个回调函数没有执行。
这里我将我的请求端的代码贴一下,您看下谢谢:- public class MainActivity extends AppCompatActivity implements AnyChatVideoCallEvent {
- private AnyChatCoreSDK anyChatCoreSDK = null;
- private SurfaceView mSurfaceLocal = null;
- private EditText et_remoteId = null;
- private Button btn_remote = null;
- private int userId = 0;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- InitLayout();
- InitSDK();
- GetLocalVideo();
- ConnectServer();
- btn_remote.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- //在输入框中输入的远程用户ID
- userId = Integer.parseInt(et_remoteId.getText().toString());
- // GetRemoteVideo();
- anyChatCoreSDK.VideoCallControl(AnyChatDefine.BRAC_VIDEOCALL_EVENT_REQUEST, userId, 0, 0, 0, "zhkmxx930@door");
- }
- });
- }
- private void InitLayout(){
- mSurfaceLocal = (SurfaceView) findViewById(R.id.surfaceView_local);
- et_remoteId = (EditText) findViewById(R.id.et_remoteId);
- btn_remote = (Button) findViewById(R.id.btn_remote);
- }
- private void InitSDK(){
- anyChatCoreSDK = new AnyChatCoreSDK();
- anyChatCoreSDK.InitSDK(Build.VERSION.SDK_INT, 0);
- anyChatCoreSDK.SetVideoCallEvent(this);
- }
- private void ConnectServer(){
- anyChatCoreSDK.Connect("demo.anychat.cn", 8906);
- anyChatCoreSDK.Login("zhkmxx930@door", "");
- anyChatCoreSDK.EnterRoom(1, "");
- anyChatCoreSDK.UserCameraControl(-1,1);
- anyChatCoreSDK.UserSpeakControl(-1,1);
- }
- // private void GetRemoteVideo(){
- // int index = anyChatCoreSDK.mVideoHelper.bindVideo(mSurfaceLocal.getHolder());
- // anyChatCoreSDK.mVideoHelper.SetVideoUser(index,userId);
- // anyChatCoreSDK.UserCameraControl(userId, 1);
- // anyChatCoreSDK.UserSpeakControl(userId, 1);
- // }
- private void GetLocalVideo(){
- anyChatCoreSDK.mSensorHelper.InitSensor(this);
- AnyChatCoreSDK.mCameraHelper.SetContext(this);
- mSurfaceLocal.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
- mSurfaceLocal.getHolder().addCallback(AnyChatCoreSDK.mCameraHelper);
- }
- @Override
- public void OnAnyChatVideoCallEvent(int dwEventType, int dwUserId, int dwErrorCode, int dwFlags, int dwParam, String userStr) {
- System.out.println("===0===");
- switch (dwEventType){
- case AnyChatDefine.BRAC_VIDEOCALL_EVENT_REPLY:
- System.out.println("回复收到");
- switch (dwErrorCode){
- case AnyChatDefine.BRAC_ERRORCODE_SUCCESS:
- System.out.println("呼叫成功");
- Toast.makeText(this,"呼叫成功",Toast.LENGTH_LONG).show();
- break;
- case AnyChatDefine.BRAC_ERRORCODE_SESSION_BUSY:
- System.out.println("目标用户忙");
- Toast.makeText(this,"目标用户忙",Toast.LENGTH_LONG).show();
- break;
- case AnyChatDefine.BRAC_ERRORCODE_SESSION_DISCONNECT:
- System.out.println("网络断线");
- Toast.makeText(this,"网络断线",Toast.LENGTH_LONG).show();
- break;
- case AnyChatDefine.BRAC_ERRORCODE_SESSION_OFFLINE:
- System.out.println("目标用户不在线");
- Toast.makeText(this,"目标用户不在线",Toast.LENGTH_LONG).show();
- break;
- case AnyChatDefine.BRAC_ERRORCODE_SESSION_REFUSE:
- System.out.println("目标用户拒绝会话");
- Toast.makeText(this,"目标用户拒绝会话",Toast.LENGTH_LONG).show();
- break;
- case AnyChatDefine.BRAC_ERRORCODE_SESSION_TIMEOUT:
- System.out.println("会话请求超时");
- Toast.makeText(this,"会话请求超时",Toast.LENGTH_LONG).show();
- break;
- case AnyChatDefine.BRAC_ERRORCODE_SESSION_QUIT:
- System.out.println("源用户主动放弃会话");
- Toast.makeText(this,"源用户主动放弃会话",Toast.LENGTH_LONG).show();
- break;
- }
- break;
- case AnyChatDefine.BRAC_VIDEOCALL_EVENT_START:
- System.out.println("开始通信");
- Toast.makeText(this,"开始通信",Toast.LENGTH_LONG).show();
- break;
- case AnyChatDefine.BRAC_VIDEOCALL_EVENT_REQUEST:
- System.out.println("收到请求");
- }
- }
- }
复制代码 |
|