Adaptive Bitrate
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Adaptive Bitrate (ABR) streaming automatically adjusts video quality based on network conditions. This guide covers HLS, DASH, and player implementation for building video streaming solutions that provide smooth playback across varying network conditions.
Why This Matters
Adaptive Bitrate streaming is critical for video platforms as it directly impacts:
- User Experience: Smooth playback without buffering
- Reach: Works across diverse network conditions globally
- Quality: Delivers optimal quality based on available bandwidth
- Efficiency: Reduces bandwidth costs through smart quality selection
Core Concepts
- ABR (Adaptive Bitrate): Dynamic quality adjustment based on network conditions
- HLS (HTTP Live Streaming): Apple's streaming protocol using m3u8 playlists
- DASH (MPEG-DASH): ISO standard for adaptive streaming
- Segmentation: Video divided into small chunks for flexible switching
- Manifest Files: Playlists/MPD describing available quality levels
- Bandwidth Estimation: Real-time network speed detection
- Buffer Management: Balancing quality and playback stability
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
- Source video is in compatible format (MP4, MOV, etc.)
- Sufficient storage for multiple quality versions
- CDN available for global distribution
- Modern browser with Media Source Extensions support
Compatibility
| Protocol |
Browser Support |
| HLS |
Safari (native), Chrome/Firefox (via hls.js) |
| DASH |
Chrome/Firefox (via Shaka), Safari (limited) |
| Progressive |
All browsers |
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 encode multiple quality levels
- Use 6-10 second segments for optimal adaptation
- Configure appropriate buffer sizes
- Implement error handling for network issues
- Monitor quality switches and buffering
- Use CDN for global delivery
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
1---2name: adaptive-bitrate3description: Adaptive Bitrate (ABR) streaming automatically adjusts video quality based on network conditions. This guide covers HLS, DASH, and player implementation for building video streaming solutions that pro4---56# Adaptive Bitrate78## 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## Overview17Adaptive Bitrate (ABR) streaming automatically adjusts video quality based on network conditions. This guide covers HLS, DASH, and player implementation for building video streaming solutions that provide smooth playback across varying network conditions.1819## Why This Matters20Adaptive Bitrate streaming is critical for video platforms as it directly impacts:21- **User Experience**: Smooth playback without buffering22- **Reach**: Works across diverse network conditions globally23- **Quality**: Delivers optimal quality based on available bandwidth24- **Efficiency**: Reduces bandwidth costs through smart quality selection2526---2728## Core Concepts291. **ABR (Adaptive Bitrate)**: Dynamic quality adjustment based on network conditions302. **HLS (HTTP Live Streaming)**: Apple's streaming protocol using m3u8 playlists313. **DASH (MPEG-DASH)**: ISO standard for adaptive streaming324. **Segmentation**: Video divided into small chunks for flexible switching335. **Manifest Files**: Playlists/MPD describing available quality levels346. **Bandwidth Estimation**: Real-time network speed detection357. **Buffer Management**: Balancing quality and playback stability3637## 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- Source video is in compatible format (MP4, MOV, etc.)65- Sufficient storage for multiple quality versions66- CDN available for global distribution67- Modern browser with Media Source Extensions support6869## Compatibility70| Protocol | Browser Support |71|----------|----------------|72| HLS | Safari (native), Chrome/Firefox (via hls.js) |73| DASH | Chrome/Firefox (via Shaka), Safari (limited) |74| Progressive | All browsers |7576---7778## Test Scenario Matrix (QA Strategy)7980| Type | Focus Area | Required Scenarios / Mocks |81| :--- | :--- | :--- |82| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |83| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |84| **E2E** | User Journey | Critical user flows to test |85| **Performance** | Latency / Load | Benchmark requirements |86| **Security** | Vuln / Auth | SAST/DAST or dependency audit |87| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |888990## Technical Guardrails & Security Threat Model9192### 1. Security & Privacy (Threat Model)93* **Top Threats**: Injection attacks, authentication bypass, data exposure94- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII95- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager96- [ ] **Authorization**: Validate user permissions before state changes9798### 2. Performance & Resources99- [ ] **Execution Efficiency**: Consider time complexity for algorithms100- [ ] **Memory Management**: Use streams/pagination for large data101- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks102103### 3. Architecture & Scalability104- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection105- [ ] **Modularity**: Decouple logic from UI/Frameworks106107### 4. Observability & Reliability108- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`109- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`110- [ ] **Error Handling**: Standardized error codes, no bare except111- [ ] **Observability Artifacts**:112 - **Log Fields**: timestamp, level, message, request_id113 - **Metrics**: request_count, error_count, response_time114 - **Dashboards/Alerts**: High Error Rate > 5%115116117## Agent Directives1181. Always encode multiple quality levels1192. Use 6-10 second segments for optimal adaptation1203. Configure appropriate buffer sizes1214. Implement error handling for network issues1225. Monitor quality switches and buffering1236. Use CDN for global delivery124125## Definition of Done (DoD) Checklist126127- [ ] Tests passed + coverage met128- [ ] Lint/Typecheck passed129- [ ] Logging/Metrics/Trace implemented130- [ ] Security checks passed131- [ ] Documentation/Changelog updated132- [ ] Accessibility/Performance requirements met (if frontend)133134135## Anti-patterns / Pitfalls136137* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries138* ⚠️ **Watch out for**: Common symptoms and quick fixes139* 💡 **Instead**: Use proper error handling, pagination, and logging140141142## Reference Links & Examples143144* Internal documentation and examples145* Official documentation and best practices146* Community resources and discussions147148149## Versioning & Changelog150151* **Version**: 1.0.0152* **Changelog**:153 - 2026-02-22: Initial version with complete template structure154