Http video streaming headers

From divinevideo/divine-mobile · View interactive version

Http video streaming headers is an AI agent skill from the GitHub repository divinevideo/divine-mobile. Fix "Failed to load video" errors when network requests succeed (200/206 status). Use when: (1) Video element shows error but DevTools shows successful requests, (2) Videos download correctly via curl but fail in browser, (3) Range requests work but video won't play, (4) Building CDN/media server fo

How to use this skill

Skill file

HTTP Video Streaming Header Requirements

Problem

HTML5 video elements fail to play with "Failed to load video" error even though

network requests show successful 200/206 responses. The video file downloads

correctly when tested with curl, but browsers refuse to play it.

Context / Trigger Conditions

Solution

Required Headers for Video Streaming

  1. Accept-Ranges: bytes (CRITICAL)
  1. Content-Type: video/mp4 (or appropriate MIME type)
  1. Content-Length (for full responses)
  1. For Range Requests (206 Partial Content):

Server Implementation

// Fastly Compute@Edge example
resp.set_header("Accept-Ranges", "bytes");
resp.set_header("Content-Type", "video/mp4");

// For full responses only (not 206):
if resp.get_status() != StatusCode::PARTIAL_CONTENT {
    resp.set_header("Content-Length", file_size.to_string());
}

CDN Considerations

Verification

# Check Accept-Ranges header
curl -I https://cdn.example.com/video.mp4 | grep -i accept-ranges
# Expected: accept-ranges: bytes

# Test range request support
curl -I -H "Range: bytes=0-1023" https://cdn.example.com/video.mp4
# Expected: HTTP/2 206 with Content-Range header

# Verify partial download works
curl -H "Range: bytes=0-100" https://cdn.example.com/video.mp4 | wc -c
# Expected: 101 (bytes 0-100 inclusive)

Example

Before (broken):

HTTP/2 200
content-type: video/mp4
x-custom-header: value

Video fails to load in browser.

After (working):

HTTP/2 200
content-type: video/mp4
content-length: 1443199
accept-ranges: bytes

Video plays correctly with seeking support.

Notes

include Accept-Ranges: bytes in the response headers

proper range support while Chrome may work without

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.