我正在尝试集成QuickBlox以进行音频和视频通话。我遵循教程,但行不通。要启用接收传入WebRTC调用的能力,需要添加信号管理器,但方法
public void signalingCreated(QBSignaling qbSignaling, boolean createdLocally)
不打电话。怎么了?添加了Jnilibs和权限构建:添加依赖性
compile 'com.quickblox:quickblox-android-sdk-videochat-webrtc:3.3.0'
在这里代码:
private EditText mUsername;
private EditText mPassword;
private Button mSignUp;
private Button mSignIn;
private Button mCall;
private QBUser mUser;
QBRTCClient client;
QBSessionManager sessionManager;
QBChatService chatService;
QBRTCSession qbrtcSession;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
QBSettings.getInstance().init(getApplicationContext(), APP_ID, AUTH_KEY, AUTH_SECRET);
QBSettings.getInstance().setAccountKey(ACCOUNT_KEY);
mUsername = (EditText) findViewById(R.id.username);
mPassword = (EditText) findViewById(R.id.password);
mSignIn = (Button) findViewById(R.id.sign_in);
mSignUp = (Button) findViewById(R.id.sign_up);
mCall = (Button) findViewById(R.id.button_call);
client = QBRTCClient.getInstance(MainActivity.this);
QBChatService.setDebugEnabled(true);
QBChatService.setDefaultAutoSendPresenceInterval(60);
chatService = QBChatService.getInstance();
mSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mUser = new QBUser(mUsername.getText().toString(), mPassword.getText().toString());
// QBUsers.signIn(mUser).performAsync(new QBEntityCallback<QBUser>() {
QBAuth.createSession(mUser).performAsync(new QBEntityCallback<QBSession>() {
@Override
public void onSuccess(QBSession qbUser, Bundle bundle) {
Log.d(TAG, "My user: " + mUser);
Log.d(TAG, "received user: " + qbUser);
Log.d(TAG, "user logged in");
mUser.setId(qbUser.getUserId());
chatService.login(mUser, new QBEntityCallback<QBUser>() {
@Override
public void onSuccess(QBUser qbUser, Bundle bundle) {
Log.d(TAG, "user logged in to the chat");
client.prepareToProcessCalls();
chatService.getVideoChatWebRTCSignalingManager().addSignalingManagerListener(new QBVideoChatSignalingManagerListener() {
@Override
public void signalingCreated(QBSignaling qbSignaling, boolean createdLocally) {
Log.d(TAG, "created locally: " + createdLocally);
if (!createdLocally) {
client.addSignaling((QBWebRTCSignaling) qbSignaling);
}
}
});
此行永远不会致电:
Log.d(TAG, "created locally: " + createdLocally);
当您拨打电话或接听电话时,方法信号created()是调用的。您可以查看视频示例,一切正常。顺便说一句,您无需手动管理会话,也无需致电创建方法。只需使用qbusers.signin()即可。文档。