Cocoa-Touch如何:MPMoviePlayerController循环? [英] Cocoa-Touch How to: MPMoviePlayerController loop?

查看:89
本文介绍了Cocoa-Touch如何:MPMoviePlayerController循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有启动画面的应用程式。对于splashscreen我决定添加一个m4v电影。我使用 MPMoviePlayerController 显示电影。一切都按预期工作,除了一件事:



我想通过订阅使 MPMoviePlayerController 循环如果数据没有完成加载,则它是 MPMoviePlayerPlaybackDidFinishNotification 通知并发出 [notification.object play] 。 >

这部分工作,它重新启动电影,但有褪色和重新褪色,使它看起来不好。



是否有其他方法循环播放电影?

或任何方式删除淡入淡出?

解决方案

完全巧合,我刚刚写了一个博客帖子关于这个主题 - 我们遇到这个问题,而我们正在写我们最新的应用程序:)



假设


  1. 确保电影从
    开始

  2. 在启动时,将Default.png添加到窗口中,如下所示: a UIImageView

  3. 让电影有一个清晰的背景

  4. 播放和循环电影

当电影结束时,它会在它循环之前淡出。由于Default.png与开始和结束帧完全相同,用户永远不会注意到:)



当你想结束电影只是删除Default.png UIImageView和停止电影 - 因为背景很清楚,它只会淡出你在你的窗口中的任何ui。



Sam


I have an app with a splash screen. For the splashscreen I've decided to add a m4v movie. I'm using the MPMoviePlayerController to show the movie. Everything is working as expected except for one thing:

I'm trying to make the MPMoviePlayerController loop by subscribing to it's MPMoviePlayerPlaybackDidFinishNotification notification and issuing a [notification.object play] if the data didn't finish loading.

This works partially, it restarts the movie, but there's the fadeout and re-fadein that make it look bad.

Is there any other way to loop the movie?
Or any way to remove the fades?

解决方案

By complete coincidence I have just written a blog post on this subject - we ran into this problem while we were writing our latest app :)

Assuming that you don't want to follow my shameless plug, here's how we fixed it :

  1. Make sure that the movie starts and ends on the same frame.
  2. Make the starting frame the Default.png of the app
  3. On startup add Default.png to the window as a UIImageView
  4. Make the movie have a clear background
  5. Play and loop the movie

When the movie ends, it will fade out before it loops round. As Default.png is exactly the same as the start and end frames, the user will never notice :)

When you want to end the movie just remove the Default.png UIImageView and stop the movie - as the background is clear it will just fade out to whatever ui you have in your window.

Sam

这篇关于Cocoa-Touch如何:MPMoviePlayerController循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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