AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing livekit/server-sdk-go in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewLiveKit Go SDK Use this SDK to interact with LiveKit server APIs and create access tokens from your Go backend. [!NOTE] Version 2 of the SDK contains a small set of breaking changes. Read the migration guide for a detailed overview of what has changed. Installation Note: since v1.0 release, this package requires Go 1.18+ in order to build. Token creation RoomService API RoomService gives you complete control over rooms and participants within them. It includes selective track subscriptions as well as moderation capabilities. Interacting as a participant The Real-time SDK gives you access programmatic access as a client enabling you to publish and record audio/video/data to the room. For more advanced usage, see the examples directory. Publishing tracks to Room With the Go SDK, you can publish existing files encoded in H.264, VP8, and Opus to the room. First, you will need to encode media into the right format. VP8 / Opus The above encodes VP8 at average 1Mbps / max 2Mbps with a minimum keyframe interval of 120. H.264 / Opus The above encodes H264 with CBS of 2Mbps with a minimum keyframe interval of 120. Publish from file Publish from io.ReadCloser implementation For a full working example, refer to filesender. This example sends all audio/video files in the current directory. Publishing audio from PCM16 Samples In order to publish audio from PCM16 Samples, you can use the NewPCMLocalTrack API as follows: You can then write PCM16 samples to the like: The SDK will encode the sample to Opus and write it to the track. If the sourceSampleRate is not 48000, resampling is also handled internally. To close the track, you can call on the , this will stop accepting samples, write the existing buffer and then close the track. If you wish to clear the buffer manually, use the on the track. There's also a API if you want to wait for existing buffer to be written before writing something to the track. **Note**: Stereo audio is currently not supported, it may result in unpleasant audio. Publish from other sources In order to publish from non-file sources, you will have to implement your own , that could provide frames of data with a method. The SDK takes care of sending the samples to the room. Using a pacer With video publishing, keyframes can be an order of magnitude larger than delta frames. This size difference can cause a significant increase in bitrate when a keyframe is transmitted, leading to a surge in packet flow. Such spikes might result in packet loss at the forwarding layer. To maintain a consistent packet flow, you can enable the use of a pacer. Receiving tracks from Room With the Go SDK, you can accept media from the room. For a full working example, refer to filesaver. This example saves the audio/video in the LiveKit room to the local disk. Decoding an Opus track to PCM16 To get PCM audio out of a remote Opus audio track, you can use the following API: The SDK will then read the provided remote track, decode the audio and write the PCM16 samples to the provided writer. By defeault, it pushes out 48kHz mono audio. The output sample rate and channels can also be configured by passsing as an option: Resampling to the target sample rate is handled internally, and so is upmixing/downmixing to the target channel count. The API also provides an option to handle jitter, this is enabled by default but you can disable it using: Receiving webhooks The Go SDK helps you to verify and decode webhook callbacks to ensure their authenticity. See webhooks guide for configuration. LiveKit Ecosystem LiveKit SDKs Browser · iOS/macOS/visionOS · Android · Flutter · React Native · Rust · Node.js · Python · Unity · Unity (WebGL) · ESP32 Server APIs Node.js · Golang · Ruby · Java/Kotlin · Python · Rust · PHP (community) · .NET (community) UI Components React · Android Compose · SwiftUI · Flutter Agents Frameworks Python · Node.js · Playground Services LiveKit server · Egress · Ingress · SIP Resources Docs · Example apps · Cloud · Self-hosting · CLI