我在QuickBlox中使用OnQBVideoChatListener时出现问题,从不调用onOpponentVideoDataReceive
和onOpponentAudioDataReceive
两种方法。以下是我实现cameraView和opponentView的方法。它与给定here的示例应用程序基本相同。我试图在我的手机和平板电脑上运行示例视频聊天应用程序然而同样的问题发生,只有cameraView得到更新。对手的观点总是黑的。有没有人经历过同样的麻烦并有解决方案?
非常感谢!
private void initViews() {
// Setup UI
opponentView = (OpponentGlSurfaceView) findViewById(R.id.opponentView);
cameraView = (CameraView) findViewById(R.id.cameraView);
cameraView.setCameraFrameProcess(true);
// Set VideoChat listener
cameraView.setQBVideoChatListener(qbVideoChatListener);
// Set Camera init callback
cameraView.setFPS(6);
cameraView.setOnCameraViewListener(new OnCameraViewListener() {
@Override
public void onCameraSupportedPreviewSizes(List<Camera.Size> supportedPreviewSizes) {
Camera.Size firstFrameSize = supportedPreviewSizes.get(0);
Camera.Size lastFrameSize = supportedPreviewSizes.get(supportedPreviewSizes.size() - 1);
cameraView.setFrameSize(firstFrameSize.width > lastFrameSize.width ? lastFrameSize : firstFrameSize);
}
});
// VideoChat settings
videoChatConfig = (VideoChatConfig) GlobalVar.getObject(tag);
try {
QBVideoChatController.getInstance().setQBVideoChatListener((QBUser)GlobalVar.getObject(GlobalVar.CURRENT_USER_KEY), qbVideoChatListener);
} catch (XMPPException e) {
e.printStackTrace();
}
}
OnQBVideoChatListener qbVideoChatListener = new OnQBVideoChatListener() {
@Override
public void onCameraDataReceive(byte[] videoData) {
if (videoChatConfig.getCallType() != CallType.VIDEO_AUDIO) {
//...
}
else{
QBVideoChatController.getInstance().sendVideo(videoData);
Log.i(tag,"videoData sent!"); // THIS IS EXECUTED
}
}
@Override
public void onMicrophoneDataReceive(byte[] audioData) {
QBVideoChatController.getInstance().sendAudio(audioData);
Log.i(tag,"AudioData sent!"); //SO IS THIS
}
@Override
public void onOpponentVideoDataReceive(byte[] videoData) {
Log.i(tag,"received img from opponent"); //NOT CALLED
opponentView.loadOpponentImage(videoData);
}
@Override
public void onOpponentAudioDataReceive(byte[] audioData) {
Log.i(tag,"received Audio from opponent"); //NOT CALLED
QBVideoChatController.getInstance().playAudio(audioData);
}
@Override
public void onProgress(boolean progress) {
}
@Override
public void onVideoChatStateChange(CallState callState, VideoChatConfig chat) {
//... STUFF
}
};