In Web Video SDK UIToolKit, how to get the session duration using API?

I’m using Web Video SDK UIToolkit 2.1.0-1 in Angular application and my question is how can I get a session duration using API?

Suppose Host ‘A’ is joined and ‘B’ joined as participant, and ‘A’ joined at 10:00 AM and ‘B’ joined at 10:05 AM and session ended on 10:30 AM, I want to get this duration of 25 minutes, why 25 minutes as participant joined 10:05 AM, so 10:05 AM to 10:30 AM.

CC: @tommy

You can use the Video SDK API for getting user list from a session including their join and leave time:

GET /videosdk/sessions/{sessionId}/users
{
...
  "users": [
    {
      "id": "32dsfsd4g5gd",
      "name": "exampleuser",
      "join_time": "2019-08-20T19:09:01Z",
      "leave_time": "2019-08-20T19:19:01Z",
      "user_key": "myUserKey",
    }
  ]
....
}

@ekaansh.zoom,
Thanks for the reply.
can you tell me the how duration is getting calculated?

Here is the example, what I’m expecting the session duration based on participant joining time.
Suppose Host ‘A’ is joined and ‘B’ joined as participant, and ‘A’ joined at 10:00 AM and ‘B’ joined at 10:05 AM and session ended on 10:30 AM, duration will be 25 minutes, why 25 minutes because participant joined 10:05 AM, so 10:05 AM to 10:30 AM.

And is there any way we can get duration liked above mentioned scenario?

Also is it possible to get session details base on session name not on session id?
Because, if user joined the one session multiple times and then for every time there is new session id I can see there, so how I can log proper session duration?
Regardless of joining multiple times this is a single session at the end, as user joining the same session.

@ekaansh.zoom, any update on above?

Hey @vishwajeetbhosale ,

To calculate duration you can add each user join and leave time together for a session. Minutes are rounded up in terms of billing calculations.

We are working on adding a new property to the API called total_minutes to make it easier to get the total session participants calculation.

You can also get a session based on session name by using the session_name query param on the List Sessions API:

Best,
Tommy