【发布时间】:2015-01-06 06:45:25
【问题描述】:
我正在使用 QuickBlox 库进行视频聊天。我该如何管理它的会话?因为当我从实时聊天活动转到下一个活动时,我刚刚失去了会话,因为它说“聊天无法初始化”,然后我必须再次创建会话才能进行通话。那么 quickblox 会话的生命周期是多少,我该如何管理它。
当我停止通话或转移到下一个活动并尝试回忆我无法做到这一点时,我也面临召回问题,实际上我尝试了不同的事情,所以每次我都会遇到不同的错误。因此,如果任何人有使用 QuickBlox 库的经验,都需要在这里获得帮助。
当我停止通话时,我会调用此函数。
private void stopCall() {
//Toggle view show the smile view again
//ToggleSmileView();
try
{
cancelCallTimer();
if (videoChat != null) {
videoChat.stopCall();
videoChat = null;
}
if (videoChannel != null) {
videoChannel.close();
videoChannel = null;
}
sessionId = null;
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
当我打电话时,我会调用这个函数
private void call() {
//toggle view
//ToggleSmileView();
// get opponent
//
VideoChatApplication app = (VideoChatApplication)getApplication();
opponent = new QBUser();
opponent.setId((app.getCurrentUser().getId() == VideoChatApplication.FIRST_USER_ID ? VideoChatApplication.SECOND_USER_ID : VideoChatApplication.FIRST_USER_ID));
// call
//
callTimer = new Timer();
callTimer.schedule(new CancelCallTimerTask(), 30 * 1000);
createSenderChannel();
initVideoChat();
if (videoChat != null)
{
videoChat.call(opponent, getCallType(), 3000);
//toggleMicrophoneMute();
}
else
{
logAndToast("Stop current chat before call");
}
}
【问题讨论】:
-
如果您使用的是 Android SDK 或使用 REST API (?) 会有所帮助
-
我正在使用android sdk
-
你能用代码解释一下吗,你试过的,第二段不清楚
-
here 是一个使用 Quickblox 的示例聊天应用程序。会有帮助的
-
请检查编辑