0

I am trying to create a video session between two iOS devices(both iOS version 7.0.4) using the opentok webrtc. Both the devices share the same api key and session id and different tokens as publishers. I am able to establish a session successfully as I can see the subscriber video as well as the publisher video on one device; but I am unable to see the video from other device and gets an error as "Error Domain=OTSubscriberErrorDomain Code=1542 "Timed out while attempting to subscribe to the stream." UserInfo=0x15984e40 {NSLocalizedDescription=Timed out while attempting to subscribe to the stream.}"

In short, I want to create a video session where both devices are able too see each others video stream, which is not happening in this case because of this error.

The point to be noted here is, the same code was working fine previously but not now(there isn't any code change).

Can anyone help??

Varsha
  • 29
  • 6
  • Did you find any thing? I guess its happening when you simultaneously try to connect or sometime it happens to me that audio get passed through but video won't. – Waleed Mahmood Aug 21 '15 at 14:42
  • No. Not yet. The tech support team has replied that they are looking into the issue, as to why it is occurring at the first place. – Varsha Aug 24 '15 at 05:55

3 Answers3

0

The error message you see indicates that the second device is having network connectivity problems. This should not occur regularly, but will occur in situations where the network is weak or flakey. You should handle this error by showing the proper information to the user in the UI, most likely something like "Network connection issues. Please try again later".

Ankur
  • 2,792
  • 3
  • 23
  • 26
  • I have tried switching the devices, i.e. connecting the second device first and vice versa. If there was a connectivity issue, then this should not be the case, I guess. – Varsha Aug 13 '15 at 05:42
  • @VarshaBawari can you try running the Connectivity Doctor to see if the network is having issues? https://itunes.apple.com/us/app/opentok-connectivity-doctor/id902048239?mt=8 – Ankur Sep 08 '15 at 01:09
0

Following are the tweaks which worked out for me step by step.

1) There is an option in Settings->Developer->Status. If its 'Enabled' turn it off or change to desired setting. Also, as 'Ankur' said check with you network administrator (if there is any) if he've added some limitations.

2) Check the subscriber object you created to connect to stream after - (void)subscriberDidConnectToStream:(OTSubscriberKit*)subscriber is called. Put subscriber.view in a simple UIViewController's view to see if video is received it properly.

Last thing to check is if you're using individual tokens (generated from dashboard) for each device.

Cheers & Good Luck.

Edited:

For multiparty, the solution/best way to avoid time out issue is:

Since the device resources are limited, so try not to subscribe to all parties video feeds present in the that room. Make a list like Hangouts app do. Make it switchable to other feeds and when you switch unsubscribe to video of all others except the one whose was tapped in list (some what like this list example, you can plan according to your app requirement).

Also, important thing is, you generate proper tokens according to room requirement, i.e., relayed for two users and routed for multiparty. Make sure they are generated correctly, along with their 'Role'.

Waleed Mahmood
  • 1,356
  • 12
  • 13
  • I'm able to resolve it for two devices but for multi-user video session, third device that connect at end. It receives two streams but timeout to connect to those streams. :( – Waleed Mahmood Aug 25 '15 at 11:43
0

Just to make sure that the simplest thing does not happen to anyone, please make sure that if you use some of the sample classes of TOKBOX, you have changed the value

static bool subscribeToSelf

to NO, if you want to subscribe to someone else's stream.

If you leave it YES, it tries to subscribe to your published stream, but the token is not correct for that, so it times out.