Live Streaming
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Live streaming enables real-time video broadcasting. This guide covers RTMP, HLS, WebRTC, streaming servers, and cloud platforms for building scalable live streaming solutions with appropriate latency and quality.
Why This Matters
Live streaming is critical for video platforms as it directly impacts:
- User Engagement: Real-time interaction and participation
- Reach: Global audiences can watch simultaneously
- Monetization: Live ads, donations, and subscriptions
- Experience: Low latency enables real-time interaction
Core Concepts
- RTMP (Real-Time Messaging Protocol): For stream ingestion from encoders
- HLS (HTTP Live Streaming): For playback with 10-30s latency
- WebRTC: For ultra-low latency (< 1s) streaming
- Streaming Server: NGINX-RTMP, Wowza, or cloud services
- Stream Key: Authentication token for publishing streams
- Adaptive Bitrate: Multiple quality levels for varying bandwidth
- Latency Modes: Low, Normal, Ultra-low latency options
Inputs / Outputs / Contracts
Skill Composition
- Depends on: None
- Compatible with: None
- Conflicts with: None
- Related Skills: None
Quick Start / Implementation Example
- Review requirements and constraints
- Set up development environment
- Implement core functionality following patterns
- Write tests for critical paths
- Run tests and fix issues
- Document any deviations or decisions
# Example implementation following best practices
def example_function():
# Your implementation here
pass
Assumptions
- Sufficient bandwidth for streaming quality
- Encoder software (OBS, FFmpeg) available
- CDN configured for playback distribution
- TURN/STUN servers for WebRTC
Compatibility
| Protocol |
Ingestion |
Playback |
Mobile |
Desktop |
| RTMP |
Yes |
No |
No |
No |
| HLS |
No |
Yes |
Yes |
Yes |
| WebRTC |
Yes |
Yes |
Yes |
Yes |
| DASH |
No |
Yes |
Limited |
Yes |
Test Scenario Matrix (QA Strategy)
| Type |
Focus Area |
Required Scenarios / Mocks |
| Unit |
Core Logic |
Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration |
DB / API |
All external API calls or database connections must be mocked during unit tests |
| E2E |
User Journey |
Critical user flows to test |
| Performance |
Latency / Load |
Benchmark requirements |
| Security |
Vuln / Auth |
SAST/DAST or dependency audit |
| Frontend |
UX / A11y |
Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives
- Always validate stream keys before allowing publishing
- Implement adaptive bitrate for varying network conditions
- Use CDN for global playback distribution
- Monitor stream health and viewer metrics
- Record all streams for VOD and compliance
- Implement failover for critical streams
Definition of Done (DoD) Checklist
Anti-patterns / Pitfalls
- ⛔ Don't: Log PII, catch-all exception, N+1 queries
- ⚠️ Watch out for: Common symptoms and quick fixes
- 💡 Instead: Use proper error handling, pagination, and logging
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: live-streaming3description: Live streaming enables real-time video broadcasting. This guide covers Use when this capability is needed.4---56# Live Streaming78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17Live streaming enables real-time video broadcasting. This guide covers RTMP, HLS, WebRTC, streaming servers, and cloud platforms for building scalable live streaming solutions with appropriate latency and quality.1819## Why This Matters20Live streaming is critical for video platforms as it directly impacts:21- **User Engagement**: Real-time interaction and participation22- **Reach**: Global audiences can watch simultaneously23- **Monetization**: Live ads, donations, and subscriptions24- **Experience**: Low latency enables real-time interaction2526---2728## Core Concepts291. **RTMP (Real-Time Messaging Protocol)**: For stream ingestion from encoders302. **HLS (HTTP Live Streaming)**: For playback with 10-30s latency313. **WebRTC**: For ultra-low latency (< 1s) streaming324. **Streaming Server**: NGINX-RTMP, Wowza, or cloud services335. **Stream Key**: Authentication token for publishing streams346. **Adaptive Bitrate**: Multiple quality levels for varying bandwidth357. **Latency Modes**: Low, Normal, Ultra-low latency options3637## Inputs / Outputs / Contracts38#3940## Skill Composition41* **Depends on**: None42* **Compatible with**: None43* **Conflicts with**: None44* **Related Skills**: None4546## Quick Start / Implementation Example47481. Review requirements and constraints492. Set up development environment503. Implement core functionality following patterns514. Write tests for critical paths525. Run tests and fix issues536. Document any deviations or decisions5455```python56# Example implementation following best practices57def example_function():58 # Your implementation here59 pass60```616263## Assumptions64- Sufficient bandwidth for streaming quality65- Encoder software (OBS, FFmpeg) available66- CDN configured for playback distribution67- TURN/STUN servers for WebRTC6869## Compatibility70| Protocol | Ingestion | Playback | Mobile | Desktop |71|----------|-----------|----------|---------|---------|72| RTMP | Yes | No | No | No |73| HLS | No | Yes | Yes | Yes |74| WebRTC | Yes | Yes | Yes | Yes |75| DASH | No | Yes | Limited | Yes |7677---7879## Test Scenario Matrix (QA Strategy)8081| Type | Focus Area | Required Scenarios / Mocks |82| :--- | :--- | :--- |83| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |84| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |85| **E2E** | User Journey | Critical user flows to test |86| **Performance** | Latency / Load | Benchmark requirements |87| **Security** | Vuln / Auth | SAST/DAST or dependency audit |88| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |899091## Technical Guardrails & Security Threat Model9293### 1. Security & Privacy (Threat Model)94* **Top Threats**: Injection attacks, authentication bypass, data exposure95- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII96- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager97- [ ] **Authorization**: Validate user permissions before state changes9899### 2. Performance & Resources100- [ ] **Execution Efficiency**: Consider time complexity for algorithms101- [ ] **Memory Management**: Use streams/pagination for large data102- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks103104### 3. Architecture & Scalability105- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection106- [ ] **Modularity**: Decouple logic from UI/Frameworks107108### 4. Observability & Reliability109- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`110- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`111- [ ] **Error Handling**: Standardized error codes, no bare except112- [ ] **Observability Artifacts**:113 - **Log Fields**: timestamp, level, message, request_id114 - **Metrics**: request_count, error_count, response_time115 - **Dashboards/Alerts**: High Error Rate > 5%116117118## Agent Directives1191. Always validate stream keys before allowing publishing1202. Implement adaptive bitrate for varying network conditions1213. Use CDN for global playback distribution1224. Monitor stream health and viewer metrics1235. Record all streams for VOD and compliance1246. Implement failover for critical streams125126## Definition of Done (DoD) Checklist127128- [ ] Tests passed + coverage met129- [ ] Lint/Typecheck passed130- [ ] Logging/Metrics/Trace implemented131- [ ] Security checks passed132- [ ] Documentation/Changelog updated133- [ ] Accessibility/Performance requirements met (if frontend)134135136## Anti-patterns / Pitfalls137138* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries139* ⚠️ **Watch out for**: Common symptoms and quick fixes140* 💡 **Instead**: Use proper error handling, pagination, and logging141142143## Reference Links & Examples144145* Internal documentation and examples146* Official documentation and best practices147* Community resources and discussions148149150## Versioning & Changelog151152* **Version**: 1.0.0153* **Changelog**:154 - 2026-02-22: Initial version with complete template structure155156---157> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.158<!-- tomevault:4.0:skill_md:2026-04-13 -->