5

This question is not only aimed at code but my app design as well.

I have an iphone app that requires opentok to handle the video/audio sessions. I have gone through basic samples but what I am confused about is session management.

For example, if my iphone app wants to call a user from a mapview, how do I do that if all I have is this user's location (coordinates)?

How do I ensure that the session I am publishing gets to that particular user somehow and that user subscribes to it? Currently I don't have any backend in my app. All I may have is location data of N users, who can possibly talk with each other through my iphone app, via opentok session. Let's just assume currently only 2 users per session is my requirement.

I also know there is some integration between opentok and parse but I simply can't gather everything in a neat pack and build it. I mean to ask, what should I store in Parse? What should I expect it to do automatically with opentok? And so on.

Any help or any code example where someone has opentok video integrated will be highly appreciated. If anyone uses parse for handling opentok sessions it would be the thing I want.

Update:

OK, I have parse set up and also have data under data tab. From this point, I wonder what all I need to do for the ability to incorporate opentok video? Broadcast tutorial is a starting point but does not put things quite in context, I still feel disconnected. Some more practical example is needed.

2 Answers 2

6

I strongly felt that the tokbox tutorial was quite basic, accomplished the requirement but had steeper learning curve. So I ended up wrote out my own app-cum-tutorial:

I feel compelled to post it here: How To write your first iPhone Video Chat App using parse and opentok(tokbox)

2
  • on slightly different tone. How can the PubNub be related to opentok
    – zeal
    Sep 22, 2015 at 10:02
  • 1
    The project doesn't work anymore. Could you potentially fix it?
    – Viper
    Nov 7, 2015 at 2:41
4

Whenever a person connects to Opentok, they need two things: session id and token

You can think of session ids as room ids. People who connect to the same session ids are able to talk to everyone else in the same session.

Tokens are just passwords to get into the session.

In your app, this may be the best flow:

  1. Two people using your app want to communicate with each other.
  2. Your app signals your server that they want to talk to each other.
  3. Your server will ask our server for a session id.
  4. Your server will generate a valid token that works for the session id.
  5. Your server will relay the session id and token to your two people.
  6. Both users will connect to the session using the session id and token, and then they will be able to talk to each other

If you can individually tackle each of those steps, it shouldn't be too hard.

It is up to your app implementation on how you will communicate that two users will want to start a session with each other. After that, you can follow the OpenTok documentations on how to do the rest of the steps (3-4 and 6)

References:

Please note that generating a session and a token should be done server-side, so the client does not see your api secret.

6
  • 1
    Many thanks, this very much answers the questions I had for the desired flow. The only things left are items 1 and 2. Probably, this link (tokbox.com/blog/…) does it the way it wants. My case wants that person A (publisher) decides to call person B (subscriber), and then it will be on person B's decision whether to connect or not. To sum up, I am yet to come across any Parse.com implementation that does exactly that. Mar 8, 2013 at 22:42
  • 1
    Would you be having any successful iOS opentok implementation link? Apart from the ones on github? Unfortunately none of them mention the part you mention which is point 1 and 2 as you mention. Mar 8, 2013 at 23:47
  • The only tutorial given (tokbox.com/blog/…) is highly vague and I really wonder if people are really able to implement opentok in their parse.com backend. Besides, I am awestruck with the total indifference shown by opentok people, despite shouting on their forums no one has cared to even understand my problem. With their thing still catching up, I am sure they need developers to showcase their stuff. Alas, if they could understand. Mar 9, 2013 at 21:01
  • 2
    Unfortunately, I am not an iOS developer, so can't help you with specifics 1 and 2. I would suggest using Pusher or PubNub to communicate between iOS devices. In pusher, you can sense presence of people.. Also, I'm not too sure what you mean by asking on the forums. Do you have a link of where you asked the question? I try to answer any non-mobile related questions on the forums (I go by jtsai).
    – John T
    Mar 11, 2013 at 21:53
  • 1
    this is where I queried - tokbox.com/forums/post32646#p32646 - by this time I got some responses too. I will check pusher and pubnub for sure. Thanks for your keen and continued attention. Mar 12, 2013 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.