在过去的两天里,我一直在尝试让视频聊天为 quickblox 的 android 2.0 SDK 工作。我可以接受、拨打、拒绝视频通话,但视频不会在 Surfaceview 上发送或接收。
我可以看到我自己的相机视频并很好地切换相机。
我已经多次查看演示,并且几乎逐行复制了它。
谁能给我一些关于如何让它工作的提示?我会非常感谢。
这是我的 QBChatListener 声明
OnQBVideoChatListener qbVideoChatListener = new OnQBVideoChatListener() {
@Override
public void onCameraDataReceive(byte[] videoData) {
QBVideoChatController.getInstance().sendVideo(videoData);
Log.d("send", "video");
}
@Override
public void onMicrophoneDataReceive(byte[] audioData) {
if (!muteOn) {
QBVideoChatController.getInstance().sendAudio(audioData);
Log.d("send", "audio");
}
}
@Override
public void onOpponentVideoDataReceive(byte[] videoData) {
toUserSurfaceView.render(videoData);
Log.d("receive", "video");
}
@Override
public void onOpponentAudioDataReceive(byte[] audioData) {
QBVideoChatController.getInstance().playAudio(audioData);
Log.d("receive", "audio");
}
@Override
public void onProgress(boolean progress) {
// progressBar.setVisibility(progress ? View.VISIBLE : View.GONE);
}
@Override
public void onVideoChatStateChange(CallState callState, VideoChatConfig receivedVideoChatConfig) {
videoChatConfig = receivedVideoChatConfig;
switch (callState) {
case ON_CALL_START:
Log.d("ON_CALL_START", "ON_CALL_START");
break;
case ON_CANCELED_CALL:
videoChatConfig = null;
Log.d("on_cancel", "on_cancel");
//play sound
goBack();
break;
case ON_CALL_END:
Log.d("oncallend", "oncallend");
// clear opponent view
toUserSurfaceView.clear();
goBack();
break;
case ACCEPT:
callingTitle.setText("Attempting to connect with \n" + callTitle);
mySurfaceView.setVisibility(View.VISIBLE);
toUserSurfaceView.setVisibility(View.VISIBLE);
QBVideoChatController.getInstance().acceptCallByFriend(videoChatConfig, null);
Log.d("accept", "accept");
break;
case ON_ACCEPT_BY_USER:
callingTitle.setText(callTitle + "\n accepted. Attempting to connect");
mySurfaceView.setVisibility(View.VISIBLE);
toUserSurfaceView.setVisibility(View.VISIBLE);
QBVideoChatController.getInstance().onAcceptFriendCall(videoChatConfig, null);
Log.d("ON_ACCEPT_BY_USER", "ON_ACCEPT_BY_USER");
break;
case ON_REJECTED_BY_USER:
break;
case ON_DID_NOT_ANSWERED:
break;
case ON_CONNECTED:
hideTitleAndIndicator();
Log.d("onConnected", "onConnected");
switchCameraButton.setEnabled(true);
break;
case ON_START_CONNECTING:
Log.d("onstartconnection", "onstartconnection");
break;
}
}
以下是我在日志中遇到的错误:
10-03 21:08:36.910 D/QBDataSenders﹕ true false false
10-03 21:08:36.910 D/QBDataSenders﹕ videoData didn`t send
10-03 21:08:36.918 D/CameraView﹕ time=368 9600 1000
10-03 21:08:36.918 D/CameraView﹕ processed my audio frame, time=368, size=0.9765625 kb false
10-03 21:08:36.918 D/QBDataSenders﹕ audiData didn`t send
10-03 21:08:36.918 D/send﹕ audio
10-03 21:08:36.957 D/skia﹕ onFlyCompress
10-03 21:08:37.012 GC_FOR_ALLOC freed 1218K, 13% free 13441K/15392K, paused 32ms, total 32ms
10-03 21:08:37.051 D/QBDataSenders﹕ true false false
10-03 21:08:37.051 D/QBDataSenders﹕ videoData didn`t send
还
10-03 21:23:09.528 W/System.err﹕ java.lang.InterruptedException
10-03 21:23:09.528 W/System.err﹕ at java.lang.VMThread.sleep(Native Method)
10-03 21:23:09.528 W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1031)
10-03 21:23:09.535 W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1013)
10-03 21:23:09.535 W/System.err﹕ at com.quickblox.module.videochat.core.objects.AudioRecorder$AudioPlayingRunnable.run(AudioRecorder.java:126)
10-03 21:23:09.535 W/System.err﹕ at java.lang.Thread.run(Thread.java:856)
10-03 21:23:09.535 W/System.err﹕ java.lang.InterruptedException
10-03 21:23:09.535 W/System.err﹕ java.lang.InterruptedException
10-03 21:23:09.535 W/System.err﹕ at java.lang.VMThread.sleep(Native Method)
10-03 21:23:09.535 W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1031)
10-03 21:23:09.535 W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1013)
10-03 21:23:09.535 W/System.err﹕ at com.quickblox.module.videochat.core.objects.AudioRecorder$AudioPlayingRunnable.run(AudioRecorder.java:126)
10-03 21:23:09.535 W/System.err﹕ at java.lang.Thread.run(Thread.java:856)
和
10-03 22:27:49.824 W/System.err﹕ java.lang.InterruptedException
10-03 22:27:49.831 W/System.err﹕ at java.lang.VMThread.sleep(Native Method)
10-03 22:27:49.831 W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1031)
10-03 22:27:49.831 W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1013)
10-03 22:27:49.831 W/System.err﹕ at com.quickblox.module.videochat.core.objects.XMPPConnectionClient$CallingRunnable.run(XMPPConnectionClient.java:150)