是“切片"吗?可以将视频附加到iOS应用程序资产吗? [英] Is "slicing" a video attached to iOS app assets possible?

查看:70
本文介绍了是“切片"吗?可以将视频附加到iOS应用程序资产吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PNG图片时,您可以通过素材资源附加img.png,img @ 2x.png和img@3x.png,然后在运行时根据设备屏幕尺寸加载正确的图片.另外,iTunes上载/下载过程将分割"资产资源,以便包含1x,2x和3x资产的大型应用程序可以避免在2x设备上运行时下载1x和3x资产.我想知道的是,附加到应用程序的视频还能利用切片功能,以便在应用程序中包含针对特定屏幕尺寸创建的视频的情况下,该应用程序无需下载3套视频资源吗?我看到资产确实包含通用的数据"类型,但似乎只能将数据文件标记为与Metal API版本不同.

With PNG images, one can attach img.png, img@2x.png, and img@3x.png via assets and then load the correct one at runtime based on the device screen dimensions. In addition, the iTunes upload/download process will "slice" asset resources so that a large app that contains 1x, 2x, and 3x assets can avoid having to download 1x and 3x assets when running on a 2x device. What I am wondering is this, can videos attached to an app also take advantage of slicing so that the app need not download 3 sets of video resources in those cases where videos created for specific screen sizes are included in the app? I see that assets do contain a generic "data" type, but it seems to only be able to mark data files as differing in terms of the Metal API version.

推荐答案

因此,我环顾了互联网,却找不到解决该棘手问题的方法.最后,我推出了自己的自定义解决方案,该解决方案基本上包装了m4v视频文件并将二进制文件视为PNG图像,以便可以将其包含在iOS资产目录中.这样就可以在iPhone上加载@ 2x或@ 3x资产,并在iPad上使用iPad特定的视频资产尺寸,同时还支持切片.对于一个工作示例,请看一下我在github上的 AlphaOverVideo 框架,Bloom演示显示了客户端从PNG解码的逻辑,然后将解码的.m4v视频加载到循环播放器中.该演示很酷,因为它展示了切片的想法,但是它还包含花朵盛开的全屏1到1像素长宽比视频,该视频显示了完美呈现的视频看起来如何惊人.如果有人对命令行编码器感兴趣,我将其上传到github上的 PNGRewrap .

So, I looked all around the internets but was unable to find anything on how to solve this tricky issue. In the end, I rolled my own custom solution that basically wraps the m4v video file and treats the binary file as a PNG image, so that it can be included in an iOS asset catalog. This makes it possible to load @2x or @3x assets on iPhone and use iPad specific video asset dimensions on an iPad while also supporting slicing. For a working example, take a peek at my AlphaOverVideo Framework on github, the Bloom demo shows the client side logic to decode from PNG and then load the decoded .m4v video into a looping player. This demo is cool because it shows off the slicing idea, but it also contains a full screen 1 to 1 pixel aspect video of a flower blooming that shows how amazing perfectly rendered video can look. If anyone is interested in the command line encoder, I uploaded it to github at PNGRewrap.

这篇关于是“切片"吗?可以将视频附加到iOS应用程序资产吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆