gpt4 book ai didi

java - 在 QuickBlox 中接受 Android 和 iOS 之间的调用

转载 作者:太空宇宙 更新时间:2023-11-04 13:11:41 25 4
gpt4 key购买 nike

我使用该框架在 Android 和 IOS 之间创建视频信使。要做的事情:在 iOS 中创建 session 并调用用户,该用户通过 Android 设备进入。但在通话过程中,在 Android 上调用电话之前 - Android 应用程序崩溃了。

也许有人遇到过这样的情况?或者我做错了什么?我不明白如何处理来电...(

我的 Android 设备代码

    onCreate(...){

QBSettings.getInstance().fastConfigInit(APPLICATION_ID,AUTHORIZATION_KEY,AUTHORIZATION_SECRET);
}

public void createSessionButton(View view){

//Log.d("Tag","onSuccess");

QBAuth.createSession(currentUser,new QBEntityCallbackImpl<QBSession>() {

@Override
public void onSuccess(QBSession session, Bundle params) {

currentUser.setId(session.getUserId());

Log.d("Tag","call set id success");

QBChatService chatService;

if (!QBChatService.isInitialized()) {

Log.d("Tag","QBChatService do not initialize");

QBChatService.init(getApplicationContext());

}

chatService = QBChatService.getInstance();

Log.d("Tag","QBChatService initialize");

// LOG IN CHAT SERVICE
chatService.login(currentUser, new QBEntityCallbackImpl<QBUser>() {

@Override
public void onSuccess() {

runOnUiThread(new Runnable() {
@Override
public void run() {

processTextView.setText("LOG IN CHAT SERVICE onSuccess");
}
});

//processTextView.setText("LOG IN CHAT SERVICE onSuccess");

Log.d("Tag","LOG IN CHAT SERVICE onSuccess");

}

@Override
public void onError(List errors) {

Log.d("Tag","LOG IN CHAT SERVICE onError");

}
});

}

@Override
public void onError(List<String> errors) {

AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Важное сообщение!")
.setMessage("onError")
//.setIcon(R.drawable.ic_android_cat)
.setCancelable(false)
.setNegativeButton("ОК",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
}

public void createSignalingManager(View view) {
QBChatService.getInstance().getVideoChatWebRTCSignalingManager().addSignalingManagerListener(new QBVideoChatSignalingManagerListener() {

@Override
public void signalingCreated(QBSignaling qbSignaling, boolean b) {
if (!b) {

QBRTCClient.getInstance().addSignaling((QBWebRTCSignaling) qbSignaling);

runOnUiThread(new Runnable() {
@Override
public void run() {

processTextView.setText("addSignalingManagerListener");

}
});
}
}
});

// Add activity as callback to RTCClient
QBRTCClient.getInstance().addSessionCallbacksListener(this);
QBRTCClient.getInstance().addConnectionCallbacksListener(this);
QBRTCClient.getInstance().addVideoTrackCallbacksListener(this);
QBRTCClient.getInstance().prepareToProcessCalls(this);

}

我在 iOS 中的代码

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.


[QBRTCClient.instance addDelegate:self];

[[QBChat instance] addDelegate:self];


[QBRTCConfig setDisconnectTimeInterval:10];

self.callTestButton.hidden = YES;

}

#pragma mark - Action

- (IBAction)loginAction:(id)sender {


QBUUser* currentUser = [[QBUUser alloc] init];

currentUser.password = pass;

currentUser.login = login;


// connect to Chat
[[QBChat instance] connectWithUser:currentUser completion:^(NSError * error) {

NSLog(@"Error: %@", error);

}];

[QBRequest logInWithUserLogin:login password:pass successBlock:^(QBResponse *response, QBUUser *user) {

NSLog(@"logInWithUserLogin:");

[QBRequest usersWithSuccessBlock:^(QBResponse * response, QBGeneralResponsePage * page, NSArray * users) {

NSLog(@"usersWithSuccessBlock:");

self.callTestButton.hidden = NO;

} errorBlock:^(QBResponse * response) {

}];

} errorBlock:^(QBResponse *response) {

NSLog(@"error: %@", response.error);
}];

}

- (IBAction)callAction:(UIButton *)sender {


NSArray *opponentsIDs = [[NSArray alloc] initWithObjects:[NSNumber numberWithInteger:6919398], nil];

NSLog(@"%ld", (long)[opponentsIDs[0] integerValue]);

QBRTCSession* session = [QBRTCClient.instance createNewSessionWithOpponents:opponentsIDs
withConferenceType:QBRTCConferenceTypeAudio];
session.localMediaStream.videoTrack.enabled = NO;

if (session) {
NSLog(@"new session");
}

NSDictionary *userInfo = @{@"startCall" : @"userInfo"};
[session startCall:userInfo];


}

最佳答案

请查看显示如何使用 Quickblox SDK for videocalls 的文档并检查 sample code

关于java - 在 QuickBlox 中接受 Android 和 iOS 之间的调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33891088/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com