Expand my Community achievements bar.

SOLVED

Session timer

Avatar

Former Community Member

Is there any way I can get the total duration of an ongoing session ?...besides of course making my own timer in flash.

1 Accepted Solution

Avatar

Correct answer by
Employee

There is a method in AccountManager called getRoomInfo(room). If you call it when a room is running it will return a snipped of XML with a bunch of information.

In there there are a few "dateTime" fields:

- dateCreated : the date/time the room started

- dateStarted : the date/time the first user succesfully entered the room

- dateEnded : the date/time the last user exited the room

- dateExpired : the date/time the room is going to "stop"

If the room has already stopped (and all the resources got released) you'll get an error when you call the method.

If the room is still running you can get your "session" time by looking at the current time compared with dateStarted.

If I have a chance I'll make this method return a more usable "object" before next SDK drop, but for now this should get you started.

View solution in original post

4 Replies

Avatar

Correct answer by
Employee

There is a method in AccountManager called getRoomInfo(room). If you call it when a room is running it will return a snipped of XML with a bunch of information.

In there there are a few "dateTime" fields:

- dateCreated : the date/time the room started

- dateStarted : the date/time the first user succesfully entered the room

- dateEnded : the date/time the last user exited the room

- dateExpired : the date/time the room is going to "stop"

If the room has already stopped (and all the resources got released) you'll get an error when you call the method.

If the room is still running you can get your "session" time by looking at the current time compared with dateStarted.

If I have a chance I'll make this method return a more usable "object" before next SDK drop, but for now this should get you started.