ios - iPhone 启动画面作为一个简短的 mp4 视频 swift ios

标签 ios swift ios8

我正在尝试制作一个简短的 .mp4 视频作为启动画面,以便在启动应用程序时显示它。

有什么例子吗?

最佳答案

请参阅下面 DarkDust 在 Emulating splash video in iOS application 中的回答.

我认为适合您的一种解决方案是显示启动画面 (IMG),然后播放您喜欢的视频。

要快速播放视频,请使用 AV Foundation https://developer.apple.com/av-foundation/

You cannot get rid of the static splash image. While it is shown, the OS is loading the application and instantiating stuff until it is ready to call your UIApplicationDelegate. So all you can do is either use no splash (black screen for a few seconds) or make your movie start exactly with the shown splash screen so it looks like the static image would suddenly animate.

To get rid of the black screen while the movie loads, you can try to make the player transparent and have an UIImageView behind the player that shows the splash image. The behavior would be this:

Splash screen is shown (static image). Application is loaded. You see the UIImageView, also showing the splash screen. On top of it is the transparent movie player. Movie player finally has loaded the move and starts playing it. At least in theory, this should cause the effect that the static image suddenly starts animating.

But if you don't use a splash screen at all (a lot of games do that), then it doesn't matter that the movie player is showing a black screen at first, you wouldn't notice.

Regarding showing the splash screen in an UIImageView: unfortunately, you have to test the interface rotation and load the image manually, there's no way to query which splash screen was shown. If you only support one interface orientation (again, a lot of games do this) you don't have this problem, of course.

关于ios - iPhone 启动画面作为一个简短的 mp4 视频 swift ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29131813/

相关文章:

ios - 无法使用自定义单元格更改某些属性

ios - 从ios中的现有数据库读取数据

swift - 在 AVPlayer.play() 之前使用 AVPlayer.seek() 时更新 AVPlayer 的显示帧

验证时 iOS 分发证书未连接

ios - 遵守 Swift 协议(protocol)

ios - NSUserDefaults in swift 用于为 TableView 保存字符串数组

objective-c - 如何在 IOS8 中隐藏 UISplitViewcontroller 的 masterView

ios8 - CGAffineTransformMakeTranslation 和 CGAffineTransformScale 变换在 ios7 和 ios8 中不同

ios - 我无法满足 IOS 8 今天扩展中的限制

ios - NSUserDefaults 不保存完整的对象