iPhone从一个视频平滑过渡到另一个视频 [英] iPhone Smooth Transition from One Video To Another

查看:214
本文介绍了iPhone从一个视频平滑过渡到另一个视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须弄清楚从一个视频过渡到下一个视频的最佳方式

I have to figure out the best way to transition from one video to the next

基本理念:一个例子就是有一个人走路的视频.....用户点击视频,一个人的视频无缝转换(简化示例)

BASIC IDEA: An example would be that there is a video of a person walking.....the user taps the video and a seamless transition occurs to a video of a person running (over simplified example)

我的第一个想法是制作2部电影玩家并使用2个视图元素之间的过渡。但电影播放器​​不支持。

My first thought was to create 2 movie players and use transitions between the 2 view elements. But movie-player doesn't support that.

停止当前视频,加载新内​​容,然后启动它是一个解决方案,但不是很优雅。我们正在为我们的销售代表制作一个交互式销售工具,我们希望它看起来尽可能专业。

stopping the current video, loading new content, and then starting it is a solution but not very elegant. We are making a interactive sales tool for our reps and we want this to look as professional as possible.

当前的想法:如果有一些AVPlayer的示例代码,它会似乎我可以使用AVVideoComposition在视频之间切换?但目前似乎没有关于如何发生这种情况的详细信息。

CURRENT THOUGHT: If there was some sample code for AVPlayer, it would seem I could use AVVideoComposition to switch between videos? But details on how that might happen don't seem to be currently available.

可能的CLUE:我认为这很容易,因为我买了一款名为Live Cams HD的应用程序一次显示16种不同的视频。

POSSIBLE CLUE: I figured this would be easy as I bought an app called Live Cams HD that shows 16 different video feeds at once.

有什么想法吗?提前致谢!

Any ideas? Thanks in advance!

推荐答案

史蒂夫,简短的回答是你无法获得那种结果你想要使用AVPlayer。 iOS中包含的h.264视频逻辑非常适合一起播放视频和视频/音频,但它在启动/停止和从一个剪辑切换到另一个剪辑时非常糟糕。原因是加载并开始在硬件中播放h.264视频时需要进行大量缓冲。基本上,您需要滚动自己的代码,为您的视图设置UIImage / CGImageRef,这样可以通过简单地从一个UIImage对象数组切换到另一个对象,轻松地从一个剪辑切换到另一个剪辑。当然,这很容易说而不是那么容易实现。

Steve, the short answer is that you are not going to be able to get the kind of results you want using AVPlayer. The h.264 video logic included in iOS is really great at playing video and video/audio together, but it really sucks at starting/stopping and switching from one clip to another. The reason is that there is a lot of buffering that needs to happen to load up and start playing a h.264 video in hardware. Basically, you need to roll your own code that sets UIImage/CGImageRef for your views in a way that makes it easy to switch from one clip to another by simply switching from one array of UIImage objects to another. Of course, that is easy to say yet not so easy to implement.

我建议您评估已经实现此逻辑的现有代码而不是自己编写。例如,请查看此 StreetFighter 演示应用。它展示了如何使用一系列剪辑来构建像iPhone UI这样的非常简单的游戏,这些剪辑显示角色正在踢,踢或投掷火球。结果如下所示:

What I would suggest is that you evaluate existing code that already implements this logic instead of rolling your own. For example, have a look at this StreetFighter demo app. It shows how a very simple game like iPhone UI can be constructed using a series of clips that show a character doing a kick, a punch, or throwing a fireball. The results looks like this:

我还写了一篇关于无缝视频套住上-IOS 。您当然可以使用自己的代码来完成所有这些操作,但我建议您在链接网站上阅读有关我的图书馆的更多信息,因为它可以为您节省大量时间。

I also wrote up a blog post about seamless-video-looping-on-ios. You can of course roll your own code to do all this, but I would suggest reading more about my library at the linked website as it will save you a lot of time.

这篇关于iPhone从一个视频平滑过渡到另一个视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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