Quickblox iOS: Connecting 2 users in video chat without initiating a call

匆匆过客 提交于 2020-01-02 23:48:17

问题


I have a video chat requirement wherein I have to connect 2 (somewhat related) users through video chat. I am not finding necessary api to call, hence the question.

I am basically following this tutorial but it seems it doesn't have everything I need. I do not need explicit "call to this user" sort of function. The user never gets to see entire user list.

As a result, I wonder if I could have X number of users calling and another X number of users waiting to accept that call.

To summarize:

I just want to connect users based on some traits (like their registered tags). For any user A, there can be more than one users having similar tags as A - so all of them are prospect video chat users for user A.

I need to pick one of them (random may work) and stream A's video / audio among them.

What all things do I have to do? Here is partial list but I don't know I am right at the end.

1 - Call [QBAuth createSessionWithDelegate:self]

2 - From the resulting session, call [QBUsers logInWithUserLogin]

3 - From the resulting session, call [[QBChat instance] loginWithUser:user]

4 - From the resulting chatDidLogin delegate, call what?

Should it be entering some chat room, or use of some code using chatRoomDidChangeOnlineUsers? I don't know.

Please help me with the minimal required sequence of things to call, in short, modify 1-2-3-4 above.

Update on why it would not be possible to initiate a call:

This is because since chat is involuntary, calls may collide. If I use calluser api, everyone would end up calling. Likewise is true for waiting to accept a call. I am unable to think of a fair strategy wherein the system does not get overwhelmed with call requests, or silent due to everyone keeps waiting.

In other words I am for the solution wherein every user can pick a random person to call, but does not mind if someone else calls him, and he should be able to handle it gracefully.


回答1:


First of all you should register new user and send him some tag. To do this you have to:

1) Create a session

[QBAuth createSessionWithDelegate:self]

2) Register new User and set him some tag:

 QBUUser *user = [QBUUser user];
 user.login = @"someuser";
 user.password = @"somepass";
 user.tags = @[@"Tag1"];

3) Create more users with the same tag

Next, in order to have a call with some user you have to randomly get it. Here is a request to get all the users with particular tag:

[QBUsers usersWithTags:@[@"Tag1"] delegate:self];

you will get all users with this tag. Next - choose one of them randomly

Finally, make a video call to this user

Use Users sample to learn how to work with Users module http://quickblox.com/developers/SimpleSample-users-ios

btw: QuickBlox released SDK 2.0 with new blocks API - you can try it http://quickblox.com/developers/IOS#iOS_SDK_Transition_guide_from_version_1.9_to_2.0



来源:https://stackoverflow.com/questions/24764844/quickblox-ios-connecting-2-users-in-video-chat-without-initiating-a-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!