How to track per room video minutes?

Hello, dear daily people :)

We are currently working on a workshop app using daily.co. We would like to track and limit video minutes per user per month.

The problem right now is we are not sure which is the best way to implement that feature using your API.


The first idea was that we track a OurUser <-> DailyRoom in our Database and then regularly call the /meeting/:name endpoint to calculate the usage of that user. Or is there a way to add some metadata to the daily room, so we can connect it to a specific user on our side?

Also, could you maybe provide some information on how the duration of the /meeting/:name object is calculated? Is it an accurate representation of video minutes spend in that room?


Any help is greatly appreciated,


Cheers Max

Best Answer

  • daily_joey
    daily_joey Moderator, Dailynista admin
    Answer ✓

    Hi @Max_Richter , we don't have an existing tutorial for this yet but this can definitely be done with the API.

    First off, you're correct in referencing the /meetings REST API endpoint, as that returns all of the necessary information to determine usage. Here's a sample of what is returned:

    {
      "id": "82b92a0b-52cf-4495-f1bf-4d58a98a99b7",
      "room": "room-3",
      "start_time": 1549391714,
      "duration": 1650,
      "ongoing": true,
      "max_participants": 2,
      "participants": [
        {
          "user_id": null,
          "user_name": null,
          "participant_id": "11111111-2222-3333-4444-555555555555",
          "join_time": 1549391690,
          "duration": 1626
        },
        {
          "user_id": null,
          "user_name": null,
          "participant_id": "66666666-7777-8888-9999-000000000000",
          "join_time": 1549391714,
          "duration": 1650
        }
      ]
    }
    

    With this information, we can see two different durations:

    1. meeting duration which represents the total length of the session in seconds, from the first user joining to the last user leaving
    2. participant duration which only counts the time in seconds that specific users was in the session

    The sum of all participant duration values will not necessarily equal the same as the meeting duration times the number of participants, based on how much overlap each users had and their join and leave times.

    Depending on your use case, you can sum up each duration across the entire domain for a given time period to determine the total amount of usage. To make separating and combining different users easier, there's a few different approaches:

    For billing purposes, Daily calculates the total number of participant-minutes by summing each individual participant's duration value, rounded up to the nearest minute.

    Finally, configurable room-level metadata isn't available yet, but is on our feature request list!

    Hopefully that helps! Let me know if anything needs clarification.

Answers

  • Hi Joey,

    Thank you so much for taking the time and writing such a detailed response! This is very helpful.

    We had some issues adding our user_id to the room name, because our daily domain name plus the user_id is too long for the 41 character limit. But I am almost finished implementing a solution, thanks your help!


    Cheers,

    Max