使用 Astro 进行图片和视频托管
请参考我们的指南,集成来自托管媒体服务的图片和视频。
¥Follow one of our guides to integrate images and videos from a hosted media service.
托管媒体指南
Section titled “托管媒体指南”¥Hosted Media Guides
为什么要使用托管媒体?
Section titled “为什么要使用托管媒体?”¥Why use hosted media?
托管媒体帮助个人、团队和组织通过专用 API 从中心位置存储、管理、优化和交付其图片和视频资源。
¥Hosted media helps individuals, teams, and organizations store, manage, optimize, and deliver their image and video assets with dedicated APIs from a central location.
这种集中化方式非常有用,尤其是在多个 Web 或移动应用之间使用单一数据源来管理资源时。如果你所在的组织需要多个团队使用相同的资源,或者正在集成到其他内容系统(如 PIM(产品信息管理器))以将你的资源连接到产品,那么这一点很重要。
¥This centralization can be useful, particularly when using a single source of truth for your assets between multiple web or mobile properties. This is important if you’re part of an organization that requires multiple teams to use the same assets, or are integrating into other content systems like a PIM (Product Information Manager) to connect your assets to products.
图片托管服务可以转换和优化你的图片,并自动为你的访问者提供优化版本。这些 远程镜像 组件可用于 Astro 内置的 <Image /> 和 <Picture /> 组件,并适用于项目中的所有文件类型,包括 Markdown、MDX 和 UI 框架组件。
¥Image hosting services can transform and optimize your images, automatically delivering optimized versions for your visitors. These remote images can be used in Astro’s built-in <Image /> and <Picture /> components, and are available to all file types in your project, including Markdown, MDX, and UI Framework components.
像 Mux 这样的视频托管服务可以提供高性能的点播和直播视频,以及可自定义的视频播放器,与处理本地内容相比,在可靠性和可扩展性方面具有显著优势。它们将处理视频转码、压缩和转换,以提供流畅的用户体验。像 Mux 这样的平台可能还包含数据分析功能,以帮助你了解用户参与度。
¥Video hosting services like Mux can provide performant on-demand and live-streaming video delivery along with customizable video players, giving significant reliability and scaling benefits over handling local content. They will handle video transcoding, compression, and transformation to provide a smooth user experience. A platform like Mux may also include data analysis to help you understand your user engagement.
哪些托管媒体系统与 Astro 兼容性良好?
Section titled “哪些托管媒体系统与 Astro 兼容性良好?”¥Which hosted media systems work well with Astro?
与使用 CMS 类似,你需要使用托管服务,以便通过 API 或 SDK 获取资源并与之交互。某些服务可能还会包含 Astro 原生组件,用于显示你的图片或视频。
¥Much like when using a CMS, you’ll want to use hosted services that allow you to fetch and interact with your assets via an API or SDK. Some services may additionally include Astro-native components for displaying your images or videos.
我可以在不使用托管媒体系统的情况下使用 Astro 吗?
Section titled “我可以在不使用托管媒体系统的情况下使用 Astro 吗?”¥Can I use Astro without a hosted media system?
是的!Astro 为 存储图片 提供了内置方法,包括对引用远程图片的支持。
¥Yes! Astro provides built-in ways to store images, including support for referencing remote images.
但是,Astro 本身不支持视频,我们建议选择像 Mux 这样的服务来处理优化和流式传输视频内容的需求。
¥However, there is no native video support in Astro, and we recommend choosing a service like Mux to handle the demands of optimizing and streaming video content.
Recipes