FAQ
Frequently asked questions about Lunar Stream integration.
General
What credentials do I need to get started?
You need two things from Lunar Stream admin:
- API Key:
ls_proj_v1_xxx...for authentication - Project ID: UUID for identifying your project
What is the API base URL?
https://api.lunarstream.kozow.com/api/v1What authentication method should I use?
Use API Key authentication for all API calls. Include it in the ls-api-key header.
Streaming
How do I get the RTMP URL for broadcasting?
Create a livestream via API, then use the response:
RTMP Server: {rmtpServer}
Stream Key: {streamKeyWithParams}Full URL: {rmtpServer}/{streamKeyWithParams}
How long does a push token last?
Default is 1 hour. You can specify custom duration (in seconds) when creating a stream or generating a new token:
{
"expiresIn": 7200
}Can I extend a push token?
No, but you can generate a new one using /livestream/generate-push-token.
What video formats are supported?
Input (RTMP):
- Video: H.264
- Audio: AAC
- Container: FLV
Output (HLS):
- Video: H.264
- Audio: AAC
- Container: MPEG-TS segments
What are the recommended encoding settings?
| Setting | Recommended |
|---|---|
| Video Codec | H.264 |
| Video Bitrate | 2500-6000 Kbps |
| Audio Codec | AAC |
| Audio Bitrate | 128-320 Kbps |
| Keyframe Interval | 2 seconds |
| Resolution | 1920x1080 or 1280x720 |
| Frame Rate | 30 or 60 fps |
Playback
How do I get the HLS URL for viewers?
From the livestream response, use hlsSources[0].url or any URL from hlsPaths.
Why are there multiple HLS URLs?
Lunar Stream provides multiple CDN endpoints for redundancy:
- Origin server
- BunnyCDN
- Gcore CDN
Implement failover to switch CDNs if one fails.
Can viewers watch without authentication?
Yes, the public API /livestreams/stream-info/{streamKey} and HLS URLs don't require authentication.
API
What's the rate limit?
| Endpoint Type | Limit |
|---|---|
| Livestream CRUD | 100 req/min |
| Public APIs | 1000 req/min |
How do I handle pagination?
Use page and limit query parameters:
GET /livestream?projectId=xxx&page=1&limit=10Response includes pagination metadata:
{
"meta": {
"pagination": {
"page": 1,
"limit": 10,
"total": 50,
"totalPages": 5
}
}
}Can I delete a livestream while it's live?
Yes, but the stream will be immediately terminated.
Security
Should I expose my API Key to the frontend?
No. API Key should only be used server-side. For client apps:
- Your backend calls Lunar Stream API
- Your backend returns only necessary data to frontend
- Frontend uses public APIs (no auth) for stream info
How do I secure my streams?
- Use push tokens for RTMP authentication
- Keep API Key server-side only
- Implement your own viewer authentication
- Use HTTPS for all communications