一键导入
video-streaming
Stream video to mobile with HLS/DASH adaptive bitrate and optional DRM. Use when building or integrating a video delivery pipeline for a mobile app.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Stream video to mobile with HLS/DASH adaptive bitrate and optional DRM. Use when building or integrating a video delivery pipeline for a mobile app.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
When and how to use a Backend-for-Frontend (BFF) for mobile -- scoping, ownership, and anti-patterns. Use when deciding whether a BFF is justified or designing one.
GraphQL server design tuned for mobile -- persisted queries, batching, N+1 mitigation, and Apollo client integration. Use when building or reviewing a GraphQL API for mobile apps.
Design mobile-friendly HTTP APIs with predictable pagination, filtering, sorting, sparse/partial responses, and a consistent error envelope. Use when specifying new endpoints or reviewing existing ones for mobile use.
REST conventions tuned for mobile clients -- resources, HTTP caching, idempotency, and versioning. Use when designing or reviewing RESTful endpoints.
Server-side OAuth 2.1 + PKCE for native mobile apps -- authorization endpoint, token endpoint, refresh rotation, and device binding. Use when implementing or reviewing the auth server for mobile clients.
Model multi-device sessions on the backend with sliding vs absolute expiry, device listing, and remote logout. Use when building the session model or a "Your devices" screen.
| name | video-streaming |
| description | Stream video to mobile with HLS/DASH adaptive bitrate and optional DRM. Use when building or integrating a video delivery pipeline for a mobile app. |
Mobile video requires adaptive bitrate (ABR) streaming -- the client switches between renditions based on bandwidth. Serve HLS on iOS (mandatory) and HLS or DASH on Android (HLS is simplest cross-platform).
Source file -> transcoded into multiple renditions -> packaged as HLS/DASH -> stored on object storage -> served through a CDN.
Renditions for UGC-style content (rules of thumb):
| Resolution | Bitrate (video) | Audio |
|---|---|---|
| 240p | 250 kbps | 64 kbps |
| 360p | 500 kbps | 64 kbps |
| 480p | 1.0 Mbps | 96 kbps |
| 720p | 2.5 Mbps | 128 kbps |
| 1080p | 4.5 Mbps | 128 kbps |
upload -> transcode worker (ffmpeg / AWS MediaConvert / Mux) -> HLS/DASH output
-> object storage (media/<id>/hls/master.m3u8, media/<id>/hls/720p/*.ts)
-> CDN
ffmpeg one-shot HLS (simplified):
ffmpeg -i input.mp4 \
-filter_complex "[0:v]split=3[v1][v2][v3]; \
[v1]scale=w=854:h=480[v1out]; \
[v2]scale=w=1280:h=720[v2out]; \
[v3]scale=w=1920:h=1080[v3out]" \
-map "[v1out]" -c:v:0 libx264 -b:v:0 1000k \
-map "[v2out]" -c:v:1 libx264 -b:v:1 2500k \
-map "[v3out]" -c:v:2 libx264 -b:v:2 4500k \
-map a:0 -map a:0 -map a:0 -c:a aac -b:a 128k \
-var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2" \
-f hls -hls_time 4 -hls_playlist_type vod \
-master_pl_name master.m3u8 \
-hls_segment_filename "out/%v/seg_%03d.ts" "out/%v/index.m3u8"
For production, a managed service (AWS MediaConvert, Google Transcoder API, Mux, Bitmovin) saves a huge amount of ops work.
Prefer CMAF (fragmented MP4) segments. The same fMP4 files serve both HLS and DASH manifests; you halve storage and invalidation overhead. Required for low-latency HLS and for Widevine + FairPlay + PlayReady shared DRM.
Needed for live/near-live use cases (sub-5 s). Requires partial segments, blocking playlist reload, and CDN support. Most VoD apps do not need this; live-ish apps (sports, auctions, collab) do.
iOS (AVPlayer): HLS is native; set AVPlayerItem.preferredPeakBitRate to cap on cellular:
let asset = AVURLAsset(url: URL(string: "https://cdn/media/\(id)/hls/master.m3u8")!)
let item = AVPlayerItem(asset: asset)
if networkMonitor.isCellular { item.preferredPeakBitRate = 1_500_000 }
let player = AVPlayer(playerItem: item)
Android: ExoPlayer supports HLS and DASH:
val player = ExoPlayer.Builder(context).build()
val source = HlsMediaSource.Factory(DefaultHttpDataSource.Factory())
.createMediaSource(MediaItem.fromUri("https://cdn/media/$id/hls/master.m3u8"))
player.setMediaSource(source)
player.prepare()
For Flutter / React Native, wrap the native players; do not roll your own.
Two tiers:
CMAF + CENC + multi-DRM lets one set of files serve both. License exchange happens between the player and the license server; your backend signs a short-lived license request token.
user_id + video_id + TTL.LANGUAGE tags.audio background mode; the manifest must allow extraction.