what is the egress limit per day
# ask-ai
v
what is the egress limit per day
g
It could be possible that the egress limits are not explicitly defined on a per-day basis in the provided data sources. However, according to the LiveKit Quotas and Limits documentation, the limits are generally defined in terms of concurrent egress requests. For example, the Ship plan allows for 100 concurrent egress requests, and the Scale plan offers unlimited concurrent participants with 100 concurrent egress requests. Would you like more detailed information on how these limits might apply to your specific use case or plan? Sources: - LiveKit Quotas and Limits documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
v
@millions-hair-24956 what is error egress minutes exhausted
g
The error "egress minutes exhausted" likely refers to exceeding the allocated egress time limits for your LiveKit plan. According to the LiveKit Quotas and Limits documentation, each plan has specific limits on egress time, such as 3 hours for file outputs and 12 hours for HLS/RTMP streaming. When these limits are reached, the egress process automatically ends with a status of
LIMIT_REACHED
. Would you like more detailed information on how to manage or extend these limits? Sources: - LiveKit Quotas and Limits documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
v
@millions-hair-24956 how to hook into room exit events so I can save the duration of the call
g
To hook into room exit events and save the duration of a call, you can use the
RoomEvent.Disconnected
event in the LiveKit SDK. This event is triggered when a participant disconnects from the room. You can calculate the call duration by recording the time when the participant joins and subtracting it from the time when the
Disconnected
event is fired. Here's a basic example in JavaScript:
Copy code
import { Room, RoomEvent } from 'livekit-client';

const room = new Room();
let startTime;

// Connect to the room
room.connect('ws://localhost:7800', token).then(() => {
  startTime = Date.now();
  console.log('Connected to room');
});

// Listen for the Disconnected event
room.on(RoomEvent.Disconnected, () => {
  const endTime = Date.now();
  const duration = (endTime - startTime) / 1000; // duration in seconds
  console.log(`Call duration: ${duration} seconds`);
});
Would you like more detailed information or assistance with a different programming language? Sources: - https://livekit-users.slack.com/archives/C07FY8WHGPM/p1730726960.854159 - https://docs.livekit.io/home/server/webhooks/ 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
v
@millions-hair-24956 I need python example
g
To capture the duration of a call in Python using LiveKit, you can listen for the
participant_connected
and
participant_disconnected
events. Here's a Python example using the LiveKit SDK:
Copy code
import asyncio
from datetime import datetime
from livekit import rtc

async def main():
    room = rtc.Room()
    start_time = None

    # Listen for participant connected event
    @room.on("participant_connected")
    def on_participant_connected(participant):
        nonlocal start_time
        start_time = datetime.now()
        print(f"Participant connected: {participant.identity}")

    # Listen for participant disconnected event
    @room.on("participant_disconnected")
    def on_participant_disconnected(participant):
        end_time = datetime.now()
        duration = (end_time - start_time).total_seconds()
        print(f"Participant disconnected: {participant.identity}")
        print(f"Call duration: {duration} seconds")

    # Connect to the room
    await room.connect("ws://localhost:7880", "your_token")

    # Keep the connection alive
    try:
        while True:
            await asyncio.sleep(1)
    except KeyboardInterrupt:
        print("Disconnecting from room...")
        await room.disconnect()

if __name__ == '__main__':
    asyncio.run(main())
This script connects to a LiveKit room, records the start time when a participant connects, and calculates the call duration when the participant disconnects. Would you like more detailed information or assistance with another aspect of LiveKit? Sources: - LiveKit Python SDK Documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.