Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/stream/gotchas.md
1# Stream Gotchas23## Common Errors45### "ERR_NON_VIDEO"67**Cause:** Uploaded file is not a valid video format8**Solution:** Ensure file is in supported format (MP4, MKV, MOV, AVI, FLV, MPEG-2 TS/PS, MXF, LXF, GXF, 3GP, WebM, MPG, QuickTime)910### "ERR_DURATION_EXCEED_CONSTRAINT"1112**Cause:** Video duration exceeds `maxDurationSeconds` constraint13**Solution:** Increase `maxDurationSeconds` in direct upload config or trim video before upload1415### "ERR_FETCH_ORIGIN_ERROR"1617**Cause:** Failed to download video from URL (upload from URL)18**Solution:** Ensure URL is publicly accessible, uses HTTPS, and video file is available1920### "ERR_MALFORMED_VIDEO"2122**Cause:** Video file is corrupted or improperly encoded23**Solution:** Re-encode video using FFmpeg or check source file integrity2425### "ERR_DURATION_TOO_SHORT"2627**Cause:** Video must be at least 0.1 seconds long28**Solution:** Ensure video has valid duration (not a single frame)2930## Troubleshooting3132### Video stuck in "inprogress" state33- **Cause**: Processing large/complex video34- **Solution**: Wait up to 5 minutes for processing; use webhooks instead of polling3536### Signed URL returns 40337- **Cause**: Token expired or invalid signature38- **Solution**: Check expiration timestamp, verify JWK is correct, ensure clock sync3940### Live stream not connecting41- **Cause**: Invalid RTMPS URL or stream key42- **Solution**: Use exact URL/key from API, ensure firewall allows outbound 4434344### Webhook signature verification fails45- **Cause**: Incorrect secret or timestamp window46- **Solution**: Use exact secret from webhook setup, allow 5-minute timestamp drift4748### Video uploads but isn't visible49- **Cause**: `requireSignedURLs` enabled without providing token50- **Solution**: Generate signed token or set `requireSignedURLs: false` for public videos5152### Player shows infinite loading53- **Cause**: CORS issue with allowedOrigins54- **Solution**: Add your domain to `allowedOrigins` array5556## Limits5758| Resource | Limit |59|----------|-------|60| Max file size | 30 GB |61| Max frame rate | 60 fps (recommended) |62| Max duration per direct upload | Configurable via `maxDurationSeconds` |63| Token generation (API endpoint) | 1,000/day recommended (use signing keys for higher) |64| Live input outputs (simulcast) | 5 per live input |65| Webhook retry attempts | 5 (exponential backoff) |66| Webhook timeout | 30 seconds |67| Caption file size | 5 MB |68| Watermark image size | 2 MB |69| Metadata keys per video | Unlimited |70| Search results per page | Max 1,000 |7172## Performance Issues7374### Upload is slow75- **Cause**: Large file size or network constraints76- **Solution**: Use TUS resumable upload, compress video before upload, check bandwidth7778### Playback buffering79- **Cause**: Network congestion or low bandwidth80- **Solution**: Use ABR (adaptive bitrate) with HLS/DASH, reduce max bitrate8182### High processing time83- **Cause**: Complex video codec, high resolution84- **Solution**: Pre-encode with H.264 (most efficient), reduce resolution8586## Type Safety8788```typescript89// Error response type90interface StreamError {91success: false;92errors: Array<{93code: number;94message: string;95}>;96}9798// Handle errors99async function uploadWithErrorHandling(url: string, file: File) {100const formData = new FormData();101formData.append('file', file);102const response = await fetch(url, { method: 'POST', body: formData });103const result = await response.json();104105if (!result.success) {106throw new Error(result.errors[0]?.message || 'Upload failed');107}108return result;109}110```111112## Security Gotchas1131141. **Never expose API token in frontend** - Use direct creator uploads1152. **Always verify webhook signatures** - Prevent spoofed notifications1163. **Set appropriate token expiration** - Short-lived for security1174. **Use requireSignedURLs for private content** - Prevent unauthorized access1185. **Whitelist allowedOrigins** - Prevent hotlinking/embedding on unauthorized sites119120## In This Reference121122- [README.md](./README.md) - Overview and quick start123- [configuration.md](./configuration.md) - Setup and config124- [api.md](./api.md) - On-demand video APIs125- [api-live.md](./api-live.md) - Live streaming APIs126- [patterns.md](./patterns.md) - Full-stack flows, best practices127128## See Also129130- [workers](../workers/) - Deploy Stream APIs securely131