1

I have created my own MoviePlayerViewController derived from MPMoviePlayerViewController, I present it using the standard presentMoviePlayerViewController method - all works fine. On top of the movie player controller, I present another ShareThisMovie view controller when the user clicks some button (after I pause the movie). I do this using presentViewController.

I don't know why but as soon as the new VC comes up, the underlying MoviePlayerViewController immediately fires MPMoviePlayerPlaybackDidFinishNotification, which I respond to by dismissing the entire VC hierarchy, so the user does not have a chance to interact with the ShareThisMovie controller.

Even if I ignore the notification, still the fact that the movie player fires it means that once the ShareThisMovie controller closes, the movie STARTS OVER FROM THE BEGINNING. This is clearly not what I want...

Why is the MoviePlayerController firing this event? How do I ensure it doesn't, or how to I workaround this? I tried storing the last playback location before showing the ShareThisVideo controller, and setting it back afterwards, but it still plays from the beginning...

tnx

4

2 回答 2

0

不完全是答案而不是解决方法,但我最终改变了设计:我不是从 MPMoviePlayerViewController 派生,而是从标准 UIViewController 派生,并在其中嵌入了一个 MPMoviePlayerController。出于某种原因,在执行此操作时,当我在我的播放器视图控制器上显示其他一些 VC 时,播放器没有引发 didFinish 事件......

猜猜我现在的结论是不要从 MPMoviePlayerViewController 派生 VC ......

于 2013-07-28T11:48:12.607 回答
0

发生这种情况是因为当您从 MoviePlayerViewController 移动到另一个视图控制器时, MPMoviePlayer 会停止播放......所以您的 MPMoviePlayerPlaybackDidFinishNotification 委托正在调用。

当您在另一个 ViewController 上时,您无法继续播放 MPMoviePlayer。

一种解决方案是提供 ShareThisMovieviewcontroller,您可以简单地在同一控制器中的 MPMoviePlayer 之上添加 UIView 以进行共享。这将阻止 MPMoviePlayer 停止。

于 2013-07-28T08:03:48.840 回答