简体   繁体   English

如何为 tvOS 包含 1x 1080p 和 2x 4K 视频资产

[英]How to include 1x 1080p and 2x 4K video assets for tvOS

I have an app that plays videos using AVFoundation APIs.我有一个使用AVFoundation API 播放视频的应用程序。 These videos are currently placed into the project as separate files.这些视频目前作为单独的文件放入项目中。 They're 1080p videos, but now I have new 4K versions that I would like to use when the app is run on 4K Apple TVs, and it should continue using the 1080p assets on HD Apple TVs.它们是 1080p 视频,但现在我有了新的 4K 版本,当应用程序在 4K Apple TV 上运行时我想使用它们,并且它应该继续在高清 Apple TV 上使用 1080p 资产。 I don't want both resolutions included in the app as that would dramatically increase the download size.我不希望应用程序中包含这两种分辨率,因为这会大大增加下载大小。 App thinning does this for image assets placed in the asset catalog for 1x and 2x scales, but unfortunately it seems this isn't available for videos. App Thinning 对放置在资产目录中的 1x 和 2x 比例的图像资产执行此操作,但不幸的是,这似乎不适用于视频。 Is there a way to provide 1x and 2x video assets such that the appropriate resolution is provided based on the Apple TV hardware downloading the app?有没有办法提供 1x 和 2x 视频资产,以便根据下载应用程序的 Apple TV 硬件提供适当的分辨率? Perhaps with on-demand resources?也许有按需资源? I do want the assets to always be available - the user shouldn't have to download them after the app is installed.我确实希望资产始终可用 - 用户不必在安装应用程序后下载它们。

In response to feedback I submitted, I was informed this is possible if you use a Data Asset in Asset Catalog and the NSDataAsset API to retrieve the video.根据我提交的反馈,我被告知如果您使用资产目录中的数据资产和 NSDataAsset API 来检索视频,这是可能的。 Tag the 4K version of the asset with the “APPLE 3” graphics feature class and put the 1080p version in the Any/Any slot.使用“APPLE 3”图形功能 class 标记资产的 4K 版本,并将 1080p 版本放入 Any/Any 插槽。 This will ensure the 4K version of the video asset is included for 4K Apple TV devices and the 1080p version is included for the others.这将确保 4K 版本的视频资产包含在 4K Apple TV 设备中,而 1080p 版本包含在其他设备中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM