Skip to Content
Engineering11 Documentation 🔥

Video API

Multi-platform video hosting abstraction for Mux and Cloudflare Stream.

What It Does

The Video API provides a unified interface for managing video operations across multiple hosting platforms (Mux, Cloudflare Stream). It handles video upload from cloud storage, streaming URL generation with JWT signing, and video deletion with provider-specific implementations.

Key Capabilities

  • Multi-Provider Support: Mux and Cloudflare Stream implementations
  • Secure Streaming: JWT-signed URLs with configurable expiration
  • Mobile Optimization: HLS manifest URLs for mobile streaming
  • Cloud Storage Integration: Upload videos from GCS buckets
  • Composite Key System: Multi-platform video identification
  • Factory Pattern: Automatic provider selection via DI

Main Components

VideoService (Abstract Base)

abstract signedURL(compositeKey, expirationTime): Promise<string> abstract signedMobileURL(compositeKey, expirationTime): Promise<string> abstract add(srcName, srcPath, srcBucket, destName?, allowedOrigins?, makePrivate?): Promise<string> abstract delete(compositeKey): Promise<boolean>

MuxVideoService

  • JWT token signing (RS256)
  • Streaming URL: https://stream.mux.com/{playbackId}.m3u8?token={jwt}
  • Max resolution: 1080p
  • Public or signed playback policies

CloudflareVideoService

  • JWT token signing (RS256)
  • Streaming URL: https://iframe.videodelivery.net/{token}
  • Configurable CORS and download restrictions

Common Use Cases

  • Video streaming platforms
  • E-learning content delivery
  • Media management systems
  • Multi-tenant video hosting
  • Mobile video apps (HLS)

What Customers Don’t Have to Build

  • Multi-provider video abstraction
  • JWT-signed streaming URLs
  • Cloud storage video upload
  • HLS mobile streaming
  • Composite key management
  • Provider switching logic
Last updated on