使用MPMoviePlayerController时,播放按钮被“Next”和“Previous”按钮包围。iPhone上的Next/Previous按钮MPMoviePlayerController
如何在点击时收到通知? 有没有一种方法可以将MPMoviePlayerController与一个列表(数组)的内容一起提供?
使用MPMoviePlayerController时,播放按钮被“Next”和“Previous”按钮包围。iPhone上的Next/Previous按钮MPMoviePlayerController
如何在点击时收到通知? 有没有一种方法可以将MPMoviePlayerController与一个列表(数组)的内容一起提供?
弥敦道是正确的需要实现自己的用户界面的球员,如果你想按钮通知。尽管你可以从播放器获得有关播放状态的通知。
从AddMusic例如,当自我是包含MPMusicPlayerController实例的控制器或模型:
- (void) registerForMediaPlayerNotifications {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver: self
selector: @selector (handle_NowPlayingItemChanged:)
name: MPMusicPlayerControllerNowPlayingItemDidChangeNotification
object: musicPlayer];
[notificationCenter addObserver: self
selector: @selector (handle_PlaybackStateChanged:)
name: MPMusicPlayerControllerPlaybackStateDidChangeNotification
object: musicPlayer];
/*
// This sample doesn't use libray change notifications; this code is here to show how
// it's done if you need it.
[notificationCenter addObserver: self
selector: @selector (handle_iPodLibraryChanged:)
name: MPMediaLibraryDidChangeNotification
object: musicPlayer];
[[MPMediaLibrary defaultMediaLibrary] beginGeneratingLibraryChangeNotifications];
*/
[musicPlayer beginGeneratingPlaybackNotifications];
}
我不认为你对MPMoviePlayerController
有很大的控制权。这是一个标准的组件,基本上可以开始和停止播放电影,而不是其他的。
我猜你是对的。然而,为什么这些控制仍然存在?在youTube应用程序中 - 他们确实转到下一个/ prev视频。 – 2009-07-16 11:28:00
在iPhone上,他们会转到当前电影的开头或结尾。他们不是next/prev按钮。 – 2009-07-16 12:12:54
当用户按下下一个/上一个按钮(您应该提交一个关于该错误的bug)时不会生成任何通知,因此解决此问题的唯一方法就是实现您自己的视频叠加视图:
MPMoviePlayerController* moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:someUrl];
moviePlayer.movieControlMode = MPMovieControlModeHidden;
[moviePlayer play];
NSArray* windows = [[UIApplication sharedApplication] windows];
if ([windows count] > 1) {
UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];
[moviePlayerWindow addSubview:yourCustomOverlayView];
}
不理想,但标准控件很容易重新实现。
我找到了一种方法,请参阅我的问题和答案。 http://stackoverflow.com/questions/3593683/how-can-i-know-users-click-fast-forward-and-fast-rewind-buttons-on-the-playback-c/3598383#3598383 – alones 2010-08-30 06:41:52