i'm using the c# server sdk, trying to send an hls...
# ask-ai
a
i'm using the c# server sdk, trying to send an hls stream request but it's not working
t
Thanks for reaching out, Yahli. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Could you share a bit more about your setup and what you’re experiencing? For example: • Are you using the C# SDK to set up an ingress or egress for HLS streaming? • Are you seeing any specific error messages or behaviors, like connection problems, timeouts, or authentication issues? • Is your goal to do live streaming to HLS, or are you working with recording and replay (VOD)? Knowing these details will really help us get to the bottom of the issue and find the best way to fix it. Sources: A Tale of Two Protocols: WebRTC vs. HLS for Live Streaming | Ingress Overview | LiveKit Docs | Egress output types | LiveKit Docs
a
i'm trying to setup an hls stream for playback and i'm using the c# sdk, it's just returning an error, i'm not getting anything in the server log
t
Hey there! Just wanted to let you know that LiveKit supports HLS playback through its Egress system, which creates HLS segments and manifests for you to play back. That said, there isn’t a specific C# SDK mentioned for setting up HLS egress. You might need to work directly with the LiveKit server APIs using gRPC or REST, or use the CLI alongside your app. Here are a few tips to help you troubleshoot: • Make sure the egress service has the right permissions to write to your cloud storage (like S3, GCP, or Azure). • Double-check your HLS settings—things like the playlist name and segment outputs—to ensure they’re set up correctly. • Take a peek at the LiveKit server logs to see if there are any errors related to egress or HLS setup. If you can share a bit more about your setup—like whether you’re using LiveKit Cloud or self-hosting, and how you’re triggering the HLS egress (gRPC or REST)—I’d be happy to help you out with more specific advice! Sources: Egress output types | LiveKit Docs | Egress output types | LiveKit Docs | Egress examples | LiveKit Docs | RoomComposite Egress | LiveKit Docs
a
i'm using the server sdk, the egress server is connected to redis and the livekit server (should be), i'm adding the code i wrote:
Copy code
if (_egressClient == null)
    _egressClient = new EgressServiceClient("http://localhost:6789", apiKey, apiSecret);
var request = new RoomCompositeEgressRequest
{
    RoomName = "room2",
    CustomBaseUrl = "http://localhost:7980",
    Layout = "grid",
    SegmentOutputs =
    {
        new SegmentedFileOutput
        {
            FilenamePrefix = "hls-output/",
            PlaylistName = "index.m3u8",
            LivePlaylistName = "index-live.m3u8",
            SegmentDuration = 6,
            Protocol = SegmentedFileProtocol.HlsProtocol,
        }
    }
};

try
{
    var response = await _egressClient.StartRoomCompositeEgress(request);
    callback?.Invoke(response.EgressId);
}
catch (Exception e)
{
    callback?.Invoke(e.ToString());
}
t
Thanks so much for sharing your code! Based on what you’ve got set up, here are a few friendly steps to help troubleshoot the issue: • First, double-check that your Egress server is properly connected to both the LiveKit server and Redis. It’s a good idea to peek at the connection settings and logs on both ends to make sure they’re chatting with each other. • Take a look at the API key and secret you’re using in the `EgressServiceClient`—are they valid and do they have the right permissions for egress operations? • Make sure your
CustomBaseUrl
(like
<CUSTOM_BASE_URL>
) is reachable and set up correctly to handle HLS output. • Check that your
SegmentOutputs
settings look good, including the
FilenamePrefix
,
PlaylistName
, and
LivePlaylistName
. Also, confirm that the
Protocol
matches the output format you want. • Take a peek at the LiveKit server logs for any errors or warnings related to your egress request. If you don’t see any logs, it might be worth making sure logging is turned on and configured properly. If you’re still running into trouble, could you let me know: • Are there any specific error messages or exceptions popping up in your code? • Is your egress server running on the same machine as the LiveKit server, or are they on different hosts? • Have you tested the connection to Redis to confirm it’s working as expected? Sharing these details will really help us get to the bottom of this together.
a
what should the base custom url point to?
t
Hey there! The
CustomBaseUrl
in your configuration should point to the URL of your custom recording app. This app takes care of rendering and laying out the egress content. If you don’t have a custom app yet, no worries—the default is
https://recorder.livekit.io
. If you do have a custom app, just make sure it’s deployed and accessible at the URL you specify. You can also add authentication parameters in the URL if that’s something you need, like
<CUSTOM_TEMPLATE_URL>?auth_param=value
. Feel free to reach out if you want me to walk you through setting up the
CustomBaseUrl
or if you have any other questions! Sources: livekit/livekit_egress.pb.go | Custom Recording Template | LiveKit Docs | Egress examples | LiveKit Docs | packages/livekit-server-sdk/src/EgressClient.ts
a
this is the errror i'm getting: An established connection was aborted by the software in your host machine.
t
Hey there! That error message, "An established connection was aborted by the software in your host machine," usually means the connection got cut off right on your end. This can happen because of firewall settings, network hiccups, or other software getting in the way. Let’s try a few things to get to the bottom of it: • Double-check that your local firewalls or security software aren’t blocking traffic to the LiveKit server or the egress service. • Make sure the egress server and LiveKit server are properly connected and that your machine can reach them. • Take a look at Redis to see if it’s running smoothly and that the egress service can talk to it without issues. • Peek at the logs for both the LiveKit server and egress server to catch any errors or warnings about the connection. If you’re still stuck, could you let me know: • Are the egress server and LiveKit server running on the same machine or on different hosts? • Have you tried testing the connection to Redis to confirm it’s working properly? • Do you see any other error messages or logs coming from the egress server? Sharing these details will really help us figure out what’s going on and get you back on track. Sources: Diagnosing Connection Errors with Connection Test Utility | Connecting to LiveKit | LiveKit Docs | README.md | Webhooks | LiveKit Docs | Firewall Tips
a
the egress server, livekit server and redis server all work in seperate containers in docker, their ports are properly exposed
t
Since your egress server, LiveKit server, and Redis are running in separate Docker containers, here are a few helpful things to check: • Make sure the
ws_url
in your egress server configuration is pointing to the right WebSocket URL of the LiveKit server. In Docker setups, this is usually the internal network IP (like
172.17.0.1
on Linux) or
host.docker.internal
if you’re on macOS or Windows. • Double-check that Redis is set up to accept connections from your Docker containers. You can do this by updating the
redis.conf
file: comment out
bind 127.0.0.1
and set
protected-mode no
. • When running the egress container, don’t forget to add the
--cap-add=SYS_ADMIN
flag. This enables Chrome sandboxing, which is necessary for Room Composite egress to work smoothly. • Take a look at your egress server’s YAML configuration to confirm it has the correct
api_key
,
api_secret
, and
redis
settings. If you’re still running into issues, could you please share: • What value do you have set for
ws_url
in your egress server config? • Are there any logs from the egress server showing connection problems? • Have you tried testing the connection between the containers, maybe with
ping
or
curl
? With these details, we’ll be in a better spot to figure out what might be going on and help you get everything running smoothly. Sources: Self-hosting the Egress Service | LiveKit Docs | .github/workflows/test-integration.yaml | Self-hosting the Egress Service | LiveKit Docs
a
how do i check connectivity between the livekit websocket and egress server?
t
Hey there! To check if the LiveKit WebSocket is connecting smoothly with your egress server, here’s a simple way to go about it: 1. Ping the LiveKit server: Hop into your egress server container and run
ping <LiveKit_Server_IP>
. This helps us see if the LiveKit server is reachable. 2. Test the WebSocket connection: Try using a tool like
curl
or
wscat
to connect to the WebSocket URL. For example:
wscat -c ws://<LiveKit_Server_IP>:7880
If you don’t have
wscat
installed, no worries—you can add it to your container or use another WebSocket client you prefer. 3. Check Docker network: Make sure both your containers are on the same Docker network. You can check this by running
docker network inspect <network_name>
and seeing if both containers show up there. 4. Verify ports: Double-check that the WebSocket port (usually 7880) is open and accessible from the egress server container. A quick way is to use
telnet <LiveKit_Server_IP> 7880
to see if the port responds. If you hit any snags or want me to walk you through any of these steps, just give me a shout—I’m here to help!
a
the ping command is not available from the egress server bash
t
If the
ping
command isn’t available in your egress server container, no worries! Here are some other ways you can check connectivity: 1. Try using `curl`: If
curl
is installed, you can test the WebSocket URL like this:
curl -v ws://<LiveKit_Server_IP>:7880
This will help you see if the WebSocket server is reachable. 2. Install
ping
if possible:
If you have the right permissions, you can add
ping
to the container. For example, on Alpine Linux containers, just run:
apk add iputils
3. Give
telnet
a try:
If
telnet
is available, you can check the WebSocket port with:
telnet <LiveKit_Server_IP> 7880
4. Take a look at the Docker network: On the host machine, use
docker network inspect <network_name>
to make sure the egress and LiveKit server containers are on the same network. If you hit any bumps or want a hand with these steps, just let me know—I’m here to help!