mux-video
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMux Video Platform
Mux 视频平台
Comprehensive guide to building video applications with Mux, the developer-first video infrastructure platform. This skill covers video streaming, live streaming, player integrations, analytics with Mux Data, and AI-powered workflows. Whether you are building a video-on-demand platform, live streaming application, or integrating video into an existing product, this documentation provides the patterns and code examples needed to ship quickly.
这是一份面向开发者的视频基础设施平台Mux的综合应用构建指南。本指南涵盖视频点播、直播、播放器集成、Mux Data分析以及AI驱动的工作流。无论你是要搭建视频点播平台、直播应用,还是在现有产品中集成视频功能,这份文档都能提供快速上线所需的设计模式和代码示例。
Key Capabilities
核心功能
- Video Hosting and Streaming: Upload, transcode, and deliver video content globally via adaptive bitrate streaming (HLS)
- Live Streaming: Real-time video broadcasting with RTMP/SRT ingest, low-latency options, and automatic recording
- Mux Player: Drop-in video player components for web (React, vanilla JS), iOS, and Android with built-in analytics
- Mux Data: Quality of experience analytics, engagement metrics, and real-time monitoring
- Content Security: Signed playback URLs, DRM protection (Widevine/FairPlay), and domain restrictions
- AI Workflows: Automatic chapter generation, video summarization, content moderation, and audio dubbing
- 视频托管与流媒体传输:通过自适应比特率流媒体(HLS)在全球范围内上传、转码并分发视频内容
- 直播流:支持RTMP/SRT推流的实时视频广播,提供低延迟选项和自动录制功能
- Mux Player:适用于Web(React、原生JS)、iOS和Android的即插即用视频播放器组件,内置分析功能
- Mux Data:体验质量分析、参与度指标和实时监控
- 内容安全:带签名的播放URL、DRM保护(Widevine/FairPlay)和域名限制
- AI工作流:自动章节生成、视频摘要、内容审核和音频配音
Quick Start
快速开始
Get streaming in five minutes:
-
Create an API Access Token in the Mux Dashboard with Video Read and Write permissions
-
Create a video asset from a URL:
bash
curl https://api.mux.com/video/v1/assets \
-H "Content-Type: application/json" \
-X POST \
-d '{ "input": [{ "url": "https://muxed.s3.amazonaws.com/leds.mp4" }], "playback_policy": ["public"] }' \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}- Play the video using the returned playback ID:
html
<script src="https://cdn.jsdelivr.net/npm/@mux/mux-player"></script>
<mux-player playback-id="YOUR_PLAYBACK_ID"></mux-player>See examples/quickstart-stream-video.md for the complete walkthrough with SDK examples in Node.js, Python, Ruby, Go, and PHP.
五分钟内开启流媒体服务:
-
在Mux控制台中创建一个具备视频读写权限的API访问令牌
-
通过URL创建视频资源:
bash
curl https://api.mux.com/video/v1/assets \
-H "Content-Type: application/json" \
-X POST \
-d '{ "input": [{ "url": "https://muxed.s3.amazonaws.com/leds.mp4" }], "playback_policy": ["public"] }' \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}- 使用返回的播放ID播放视频:
html
<script src="https://cdn.jsdelivr.net/npm/@mux/mux-player"></script>
<mux-player playback-id="YOUR_PLAYBACK_ID"></mux-player>查看examples/quickstart-stream-video.md获取完整教程,包含Node.js、Python、Ruby、Go和PHP的SDK示例。
Reference Documentation
参考文档
Core Concepts
核心概念
Foundational knowledge for working with Mux APIs and infrastructure.
| File | Description |
|---|---|
| reference/mux-fundamentals.md | Organizations, environments, assets, playback IDs, and API structure |
| reference/api-authentication.md | Access tokens, permissions, and secure API request patterns |
| reference/webhooks.md | Webhook events, signature verification, and event handling |
| reference/content-security-policy.md | CSP configuration for Mux Player and streaming domains |
使用Mux API和基础设施的基础知识。
| 文件 | 描述 |
|---|---|
| reference/mux-fundamentals.md | 组织、环境、资源、播放ID和API结构 |
| reference/api-authentication.md | 访问令牌、权限和安全API请求模式 |
| reference/webhooks.md | Webhook事件、签名验证和事件处理 |
| reference/content-security-policy.md | Mux Player和流域名的CSP配置 |
Mux Player
Mux Player
Drop-in video player components with built-in analytics and adaptive controls.
| File | Description |
|---|---|
| reference/mux-player-overview.md | Platform support (web, iOS, Android), installation, and core features |
| reference/player-setup-integration.md | HTML, React, iframe embed, and native mobile integration |
| reference/player-customization.md | Theming, CSS variables, custom controls, and branding |
| reference/player-advanced-features.md | Chromecast, AirPlay, DVR mode, picture-in-picture, and quality selection |
| reference/playback-security.md | Signed URLs, JWT token generation, and playback restrictions |
| reference/playback-modifiers-resolution.md | Resolution capping, bandwidth hints, and playback URL parameters |
内置分析和自适应控制的即插即用视频播放器组件。
| 文件 | 描述 |
|---|---|
| reference/mux-player-overview.md | 平台支持(Web、iOS、Android)、安装和核心功能 |
| reference/player-setup-integration.md | HTML、React、iframe嵌入和原生移动端集成 |
| reference/player-customization.md | 主题、CSS变量、自定义控件和品牌化 |
| reference/player-advanced-features.md | Chromecast、AirPlay、DVR模式、画中画和画质选择 |
| reference/playback-security.md | 签名URL、JWT令牌生成和播放限制 |
| reference/playback-modifiers-resolution.md | 分辨率限制、带宽提示和播放URL参数 |
Video Upload and Asset Management
视频上传与资源管理
Methods for getting video content into Mux and configuring assets.
| File | Description |
|---|---|
| reference/upload-methods.md | URL ingestion, direct uploads, and resumable upload protocols |
| reference/mux-uploader.md | Drop-in upload components for web with progress and error handling |
| reference/mobile-upload-sdks.md | iOS and Android upload SDKs for native applications |
| reference/asset-configuration.md | Video quality tiers, MP4 support, master access, and encoding settings |
| reference/text-tracks-and-audio.md | Captions, subtitles, audio tracks, and language configuration |
将视频内容上传至Mux并配置资源的方法。
| 文件 | 描述 |
|---|---|
| reference/upload-methods.md | URL导入、直接上传和可恢复上传协议 |
| reference/mux-uploader.md | 适用于Web的即插即用上上传组件,支持进度和错误处理 |
| reference/mobile-upload-sdks.md | 适用于iOS和Android的原生应用上传SDK |
| reference/asset-configuration.md | 视频画质等级、MP4支持、主访问权限和编码设置 |
| reference/text-tracks-and-audio.md | 字幕、副标题、音轨和语言配置 |
Live Streaming
直播流
Real-time video broadcasting with global ingest and low-latency delivery.
| File | Description |
|---|---|
| reference/live-streaming-getting-started.md | Creating live streams, stream keys, and basic broadcasting |
| reference/live-stream-configuration.md | Latency modes, reconnect windows, and recording settings |
| reference/streaming-protocols-encoder-setup.md | RTMP, RTMPS, SRT protocols and encoder configuration |
| reference/live-stream-features.md | Simulcasting, live clipping, DVR mode, and embedded captions |
| reference/live-stream-troubleshooting.md | Common issues, debugging, and encoder compatibility |
支持全球推流和低延迟分发的实时视频广播。
| 文件 | 描述 |
|---|---|
| reference/live-streaming-getting-started.md | 创建直播流、流密钥和基础广播设置 |
| reference/live-stream-configuration.md | 延迟模式、重连窗口和录制设置 |
| reference/streaming-protocols-encoder-setup.md | RTMP、RTMPS、SRT协议和编码器配置 |
| reference/live-stream-features.md | 多平台同步直播、直播剪辑、DVR模式和嵌入式字幕 |
| reference/live-stream-troubleshooting.md | 常见问题、调试和编码器兼容性 |
Mux Data and Analytics
Mux Data与分析
Quality of experience metrics, engagement tracking, and performance monitoring.
| File | Description |
|---|---|
| reference/metrics-overview.md | Views, watch time, QoE scores, and metric definitions |
| reference/dashboards-and-filtering.md | Dashboard navigation, filters, and data exploration |
| reference/custom-metadata-and-dimensions.md | Custom dimensions, video metadata, and viewer identification |
| reference/data-exports.md | CSV exports, S3 delivery, and raw data access |
| reference/alerts-and-monitoring.md | Alert configuration, thresholds, and notification channels |
| reference/privacy-and-configuration.md | Data retention, GDPR compliance, and privacy settings |
体验质量指标、参与度跟踪和性能监控。
| 文件 | 描述 |
|---|---|
| reference/metrics-overview.md | 观看次数、观看时长、QoE分数和指标定义 |
| reference/dashboards-and-filtering.md | 控制台导航、筛选器和数据探索 |
| reference/custom-metadata-and-dimensions.md | 自定义维度、视频元数据和观众识别 |
| reference/data-exports.md | CSV导出、S3交付和原始数据访问 |
| reference/alerts-and-monitoring.md | 警报配置、阈值和通知渠道 |
| reference/privacy-and-configuration.md | 数据保留、GDPR合规和隐私设置 |
Player Monitoring Integrations
播放器监控集成
Integrating Mux Data with third-party video players.
| File | Description |
|---|---|
| reference/web-player-integrations.md | Video.js, HLS.js, Shaka Player, JW Player, and Bitmovin |
| reference/mobile-player-integrations.md | AVPlayer (iOS), ExoPlayer (Android), and native SDKs |
| reference/smart-tv-device-integrations.md | Roku, Fire TV, Apple TV, and smart TV platforms |
| reference/custom-player-integrations.md | Building custom player integrations with Mux Data SDK |
将Mux Data与第三方视频播放器集成。
| 文件 | 描述 |
|---|---|
| reference/web-player-integrations.md | Video.js、HLS.js、Shaka Player、JW Player和Bitmovin |
| reference/mobile-player-integrations.md | AVPlayer(iOS)、ExoPlayer(Android)和原生SDK |
| reference/smart-tv-device-integrations.md | Roku、Fire TV、Apple TV和智能电视平台 |
| reference/custom-player-integrations.md | 使用Mux Data SDK构建自定义播放器集成 |
Video Features and Tools
视频功能与工具
Additional video capabilities beyond basic playback.
| File | Description |
|---|---|
| reference/video-clipping.md | Creating clips from assets, URL-based clipping, and clip management |
| reference/images-and-thumbnails.md | Thumbnail generation, animated GIFs, and timeline previews |
| reference/custom-domains-and-security.md | CNAME setup, SSL certificates, and branded delivery domains |
| reference/social-sharing-and-special-features.md | OG tags, Twitter cards, and social media optimization |
基础播放之外的额外视频功能。
| 文件 | 描述 |
|---|---|
| reference/video-clipping.md | 从资源创建剪辑、基于URL的剪辑和剪辑管理 |
| reference/images-and-thumbnails.md | 缩略图生成、动态GIF和时间轴预览 |
| reference/custom-domains-and-security.md | CNAME设置、SSL证书和品牌化分发域名 |
| reference/social-sharing-and-special-features.md | OG标签、Twitter卡片和社交媒体优化 |
Framework Integrations
框架集成
Platform-specific guides for popular web and mobile frameworks.
| File | Description |
|---|---|
| reference/web-framework-integrations.md | Next.js, Remix, SvelteKit, Nuxt, and other web frameworks |
| reference/react-native-getting-started.md | Setting up Mux in React Native applications |
| reference/react-native-video-features.md | Video playback, uploads, and analytics in React Native |
| reference/react-native-ui-patterns.md | Common UI patterns for video apps (feeds, stories, full-screen) |
| reference/react-native-advanced-topics.md | Performance optimization, offline playback, and background audio |
针对热门Web和移动框架的平台专属指南。
| 文件 | 描述 |
|---|---|
| reference/web-framework-integrations.md | Next.js、Remix、SvelteKit、Nuxt和其他Web框架 |
| reference/react-native-getting-started.md | 在React Native应用中设置Mux |
| reference/react-native-video-features.md | React Native中的视频播放、上传和分析 |
| reference/react-native-ui-patterns.md | 视频应用的常见UI模式(信息流、故事、全屏) |
| reference/react-native-advanced-topics.md | 性能优化、离线播放和后台音频 |
CMS Integrations and SDKs
CMS集成与SDK
Connecting Mux with content management systems and backend services.
| File | Description |
|---|---|
| reference/cms-integrations.md | Sanity, Contentful, WordPress, Strapi, and other CMS platforms |
| reference/server-side-sdks.md | Node.js, Python, Ruby, PHP, Go, Java, and .NET SDKs |
| reference/mcp-server.md | Mux MCP server for AI assistant integrations |
将Mux与内容管理系统和后端服务连接。
| 文件 | 描述 |
|---|---|
| reference/cms-integrations.md | Sanity、Contentful、WordPress、Strapi和其他CMS平台 |
| reference/server-side-sdks.md | Node.js、Python、Ruby、PHP、Go、Java和.NET SDK |
| reference/mcp-server.md | 用于AI助手集成的Mux MCP服务器 |
Pricing and Cost Management
定价与成本管理
Understanding and optimizing Mux costs.
| File | Description |
|---|---|
| reference/pricing-overview.md | Pricing model, billable metrics, and cost calculations |
| reference/cost-optimization.md | Strategies for reducing encoding, storage, and delivery costs |
了解并优化Mux成本。
| 文件 | 描述 |
|---|---|
| reference/pricing-overview.md | 定价模型、计费指标和成本计算 |
| reference/cost-optimization.md | 降低编码、存储和分发成本的策略 |
Examples
示例
Getting Started
入门指南
| File | Description |
|---|---|
| examples/quickstart-stream-video.md | Complete guide to uploading and playing your first video |
| examples/webhook-signature-verification.md | Verifying webhook signatures in Node.js, Python, and Ruby |
| 文件 | 描述 |
|---|---|
| examples/quickstart-stream-video.md | 上传并播放首个视频的完整指南 |
| examples/webhook-signature-verification.md | 在Node.js、Python和Ruby中验证Webhook签名 |
Player Integration
播放器集成
| File | Description |
|---|---|
| examples/mux-player-web-setup.md | Setting up Mux Player in HTML, React, and Vue applications |
| examples/signed-url-playback.md | Generating and using signed playback URLs with JWTs |
| examples/drm-protected-playback.md | Configuring DRM-protected content with Widevine and FairPlay |
| 文件 | 描述 |
|---|---|
| examples/mux-player-web-setup.md | 在HTML、React和Vue应用中设置Mux Player |
| examples/signed-url-playback.md | 生成并使用带JWT的签名播放URL |
| examples/drm-protected-playback.md | 配置带Widevine和FairPlay的DRM保护内容 |
Video Upload
视频上传
| File | Description |
|---|---|
| examples/direct-upload-with-webhooks.md | Client-side uploads with server webhook handling |
| examples/video-with-captions-and-metadata.md | Uploading videos with subtitle tracks and custom metadata |
| 文件 | 描述 |
|---|---|
| examples/direct-upload-with-webhooks.md | 客户端上传搭配服务器Webhook处理 |
| examples/video-with-captions-and-metadata.md | 上传带字幕轨道和自定义元数据的视频 |
Live Streaming
直播流
| File | Description |
|---|---|
| examples/live-streaming-complete-setup.md | End-to-end live streaming implementation |
| examples/live-captions-and-simulcasting.md | Adding live captions and streaming to multiple platforms |
| 文件 | 描述 |
|---|---|
| examples/live-streaming-complete-setup.md | 端到端直播流实现 |
| examples/live-captions-and-simulcasting.md | 添加直播字幕并推流至多个平台 |
Analytics
分析
| File | Description |
|---|---|
| examples/custom-analytics-integration.md | Advanced Mux Data integration with custom dimensions |
| examples/web-player-integration-example.md | Integrating Mux Data with Video.js and HLS.js |
| examples/mobile-player-integration-example.md | iOS and Android analytics SDK integration |
| 文件 | 描述 |
|---|---|
| examples/custom-analytics-integration.md | 带自定义维度的高级Mux Data集成 |
| examples/web-player-integration-example.md | 将Mux Data与Video.js和HLS.js集成 |
| examples/mobile-player-integration-example.md | iOS和Android分析SDK集成 |
Video Features
视频功能
| File | Description |
|---|---|
| examples/video-clipping-workflows.md | Creating clips for social sharing and highlights |
| examples/thumbnail-and-preview-integration.md | Dynamic thumbnails and timeline hover previews |
| 文件 | 描述 |
|---|---|
| examples/video-clipping-workflows.md | 为社交分享和精彩片段创建剪辑 |
| examples/thumbnail-and-preview-integration.md | 动态缩略图和时间轴悬停预览 |
React Native
React Native
| File | Description |
|---|---|
| examples/react-native-stories-app.md | Building an Instagram-style stories feature |
| examples/react-native-video-upload-workflow.md | Complete upload flow with progress and background handling |
| 文件 | 描述 |
|---|---|
| examples/react-native-stories-app.md | 构建Instagram风格的故事功能 |
| examples/react-native-video-upload-workflow.md | 带进度和后台处理的完整上传流程 |
CMS Integration
CMS集成
| File | Description |
|---|---|
| examples/cms-setup-sanity.md | Integrating Mux with Sanity CMS |
| 文件 | 描述 |
|---|---|
| examples/cms-setup-sanity.md | 将Mux与Sanity CMS集成 |
AI Workflows
AI工作流
| File | Description |
|---|---|
| examples/ai-video-workflows.md | Automatic chapters, summarization, and tagging with @mux/ai |
| examples/content-moderation-strategies.md | AI-powered content moderation for user-generated video |
| examples/video-synchronization.md | Syncing video playback across multiple viewers |
| 文件 | 描述 |
|---|---|
| examples/ai-video-workflows.md | 使用@mux/ai实现自动章节、摘要和标签 |
| examples/content-moderation-strategies.md | 针对用户生成视频的AI驱动内容审核 |
| examples/video-synchronization.md | 在多个观众间同步视频播放 |
Important Notes
重要说明
API Authentication
API认证
All Mux API requests require authentication using a Token ID and Token Secret. API requests must be made from a server environment - the API does not support CORS and credentials should never be exposed in client-side code.
所有Mux API请求都需要使用Token ID和Token Secret进行认证。API请求必须在服务器环境中发起——API不支持CORS,且凭据绝不能暴露在客户端代码中。
Playback IDs vs Asset IDs
播放ID vs 资源ID
- Asset IDs are used to manage content via the API ()
api.mux.com - Playback IDs are used to stream content to viewers ()
stream.mux.com - An asset can have multiple playback IDs with different policies (public vs signed)
- 资源ID用于通过API()管理内容
api.mux.com - 播放ID用于向观众分发内容()
stream.mux.com - 一个资源可以有多个播放ID,对应不同的策略(公开 vs 签名)
Webhooks vs Polling
Webhook vs 轮询
Always prefer webhooks over polling to track asset status. Webhooks provide real-time notifications when assets are ready, live streams change state, or uploads complete. Configure webhooks per environment in the Mux Dashboard.
跟踪资源状态时,始终优先使用Webhook而非轮询。Webhook会在资源准备就绪、直播流状态变化或上传完成时提供实时通知。在Mux控制台中按环境配置Webhook。
Video Quality Tiers
视频画质等级
Mux offers different video quality tiers (basic, plus, premium) that affect encoding quality and pricing. Choose the appropriate tier based on your content type and quality requirements.
Mux提供不同的视频画质等级(基础版、增强版、高级版),会影响编码质量和定价。根据内容类型和画质需求选择合适的等级。
Stream Key Security
流密钥安全
Live stream keys should be treated as secrets. Anyone with the stream key can broadcast to your live stream. Reset keys immediately if compromised.
直播流密钥应视为机密信息。任何人获取流密钥后都可以向你的直播流推流。一旦泄露,请立即重置密钥。