LiveTran SDK is the official TypeScript client for LiveTran β a self-hostable, high-performance live streaming media server.
It provides a simple API to interact with the LiveTran Server: start/stop streams, fetch status, and integrate streaming into your Node.js or frontend applications.
- π Stream Management β Start, stop, and monitor streams programmatically
- π Adaptive Bitrate (ABR) playback integration
- π HMAC-secured APIs with signed requests
- β‘ TypeScript-first β Includes full typings and intellisense
- π Works in Node.js & Browser environments (Cloudflare Workers, Bun, Deno)
- π Universal Crypto β Uses Web Crypto API with Node.js fallback
npm i @vijayvenkatj/livetran-sdkThe SDK provides two client classes depending on your deployment:
For self-hosted LiveTran instances:
import { SelfHostedLiveTran } from "@vijayvenkatj/livetran-sdk";
const client = new SelfHostedLiveTran({
baseURL: "http://localhost:8080", // your self-hosted server URL
sharedSecret: process.env.LIVETRAN_SHARED_SECRET, // HMAC signing secret
});const response = await client.startStream({
stream_id: "my-awesome-stream",
webhook_urls: ["https://my-service.com/webhook"],
abr: true, // enable adaptive bitrate
});
console.log(response);
// { success: true, data: "..." }const response = await client.stopStream({
stream_id: "my-awesome-stream",
});
console.log(response);
// { success: true, data: "..." }const response = await client.status({
stream_id: "my-awesome-stream",
});
console.log(response);
// { success: true, data: "..." }For the hosted LiveTran platform:
import { LiveTranSDK } from "@vijayvenkatj/livetran-sdk";
const client = new LiveTranSDK({
baseURL: "https://api.livetran.com", // LiveTran API base URL
sharedSecret: process.env.LIVETRAN_SHARED_SECRET, // HMAC signing secret
projectID: process.env.LIVETRAN_PROJECT_ID, // your project ID
apiKey: process.env.LIVETRAN_API_KEY, // your API key
});const response = await client.startStream({
title: "My Live Stream",
description: "Optional stream description",
stream_key: "your-stream-key",
});
console.log(response);
// {
// data: {
// output_url: "https://...",
// srt_url: "srt://...",
// }
// }const response = await client.stopStream({
stream_key: "your-stream-key",
});
console.log(response);
// {
// data: {
// message: "Stream stopped successfully",
// }
// }The SDK throws SDKError for API errors:
import { SDKError } from "@vijayvenkatj/livetran-sdk";
try {
await client.startStream({ ... });
} catch (error) {
if (error instanceof SDKError) {
console.error(`API Error (${error.statusCode}): ${error.message}`);
} else {
console.error("Unexpected error:", error);
}
}new SelfHostedLiveTran(config: SelfHostedLiveTranConfig)Config:
baseURL: stringβ Your self-hosted LiveTran server URLsharedSecret: stringβ HMAC signing secret for request authentication
-
startStream(args: SelfHostedStartArgs): Promise<SelfHostedServerResponse>stream_id: stringβ Unique identifier for the streamwebhook_urls: string[]β Array of webhook URLs to notifyabr: booleanβ Enable adaptive bitrate streaming
-
stopStream(args: SelfHostedStopArgs): Promise<SelfHostedServerResponse>stream_id: stringβ Stream identifier to stop
-
status(args: SelfHostedStopArgs): Promise<SelfHostedServerResponse>stream_id: stringβ Stream identifier to check status
new LiveTranSDK(config: LiveTranConfig)Config:
baseURL: stringβ LiveTran API base URLsharedSecret: stringβ HMAC signing secretprojectID: stringβ Your LiveTran project IDapiKey: stringβ Your LiveTran API key
-
startStream(args: LiveTranStartArgs): Promise<StartResponse>title: stringβ Stream titledescription?: stringβ Optional stream descriptionstream_key: stringβ Stream key for authentication
-
stopStream(args: LiveTranStopArgs): Promise<StopResponse>stream_key: stringβ Stream key to stop
All requests are signed using HMAC-SHA256 signatures. The SDK automatically:
- Generates signatures using your
sharedSecret - Includes the signature in the
LT-SIGNATUREheader - Works across different JavaScript runtimes (Node.js, Cloudflare Workers, Bun, Deno)
Full TypeScript definitions are included. All types are exported:
import type {
SelfHostedLiveTranConfig,
SelfHostedStartArgs,
SelfHostedStopArgs,
SelfHostedServerResponse,
LiveTranConfig,
LiveTranStartArgs,
LiveTranStopArgs,
StartResponse,
StopResponse,
} from "@vijayvenkatj/livetran-sdk";- Node.js β₯ 18 (or compatible runtime)
- A running LiveTran server (for self-hosted) or LiveTran account (for hosted)
- Automating stream lifecycle in your backend
- Embedding secure low-latency playback into web apps
- Building dashboards or monitoring tools around LiveTran
- Integrating streaming into serverless functions (Cloudflare Workers, Vercel, etc.)
# Build the project
npm run build
# The build output will be in the `dist/` directoryContributions are welcome to improve the SDK!
- Fork the repo
- Create a feature branch
- Submit a PR
MIT