How do I know when the session finished loading?

Ask questions about the JavaScript API here

How do I know when the session finished loading?

Postby giladani » Mon May 21, 2012 1:48 pm

Hi,

sometimes I see that it takes the session a lot of time to load from the point that I subscribe to stream and I see the 'Loading' icon in the middle of the video - most cases in slow connections.
I want to count the chat time, but I want it to start only from the time that I see the remote camera.

Is there a way to get a trigger not for when we connect to a session, but rather from the time that the 'loading' has completed?

Thanks,
Gil.
Was this post helpful? (0)
giladani
 
Posts: 187
Joined: Wed Apr 11, 2012 8:05 am
Thumbs Up: 2

Re: How do I know when the session finished loading?

Postby jtsai » Mon May 21, 2012 2:39 pm

Unfortunately, we don't have a callback you can use to determine when it stops showing the loading screen.

You can try doing this:
Subscribe like normal. However, have the video displayed OFF the screen (1x1 pixel in -1, -1 coordinates). Have the audio set to mute. Wait 10 seconds to make sure the loading bar is gone. Then put the video on the page, un-mute the audio, and start keeping track of time. You can then determine when the user starts actually seeing the video. Basically start timing them 10 seconds after they subscribe. You can put a little loading bar yourself that goes away after 10 seconds.

John
Was this post helpful? (0)
Very helpful resource: Devs Checklist
Examples with OpenTok: Examples
User avatar
jtsai
 
Posts: 2035
Joined: Wed Sep 14, 2011 3:00 pm
Thumbs Up: 159

Re: How do I know when the session finished loading?

Postby giladani » Mon May 21, 2012 11:50 pm

Hi,

I already have such a scree, since I'm waiting for at least 2 people to connect. I'll just stay additional 10 seconds.
Isn't 10 seconds quite a lot? Does it really depend on the internet speed?

FYI - There is a bug that I published in the bugs forum, sometimes the "loading" doesn't disappear at all.. (or at least for a few mins).
This solution is really valid only if that bug won't appear.

Cheers,
Gil.
Was this post helpful? (0)
giladani
 
Posts: 187
Joined: Wed Apr 11, 2012 8:05 am
Thumbs Up: 2

Re: How do I know when the session finished loading?

Postby jtsai » Wed May 23, 2012 1:32 pm

It does depend on the internet speed. Has the bug you mentioned in the other thread appeared since then?

John
Was this post helpful? (0)
Very helpful resource: Devs Checklist
Examples with OpenTok: Examples
User avatar
jtsai
 
Posts: 2035
Joined: Wed Sep 14, 2011 3:00 pm
Thumbs Up: 159

Re: How do I know when the session finished loading?

Postby giladani » Sat May 26, 2012 9:32 am

Didn't occurred in the last week.
Was this post helpful? (0)
giladani
 
Posts: 187
Joined: Wed Apr 11, 2012 8:05 am
Thumbs Up: 2


Return to JavaScript



Who is online

Users browsing this forum: No registered users and 1 guest

cron