繁体   English   中英

我必须在哪里声明 MPMoviePlayer 的通知功能。 请帮我

[英]Where i have to declare the notification functions of MPMoviePlayer . Please help me

我正在尝试在我的 iOS 应用程序中实现 HTTP VideoStreaming。 我的应用程序中有两个视图。 第一个是主视图。 在该视图中有按钮,当用户单击该按钮时,VideoPlayerView 将从服务器加载并播放视频。视频正在我的应用程序中播放,一切正常。

在我的应用程序中,我有两个视图和一个 AppDelegate。

AppDelegate
MainViewController
VideoPlayerView

我正在我的 VideoPlayerView class 中创建我的 MPMoviePlayer 播放器。 我想实现通知 function

// Register to receive a notification that the movie is now in memory and ready to play

[[NSNotificationCenter defaultCenter] addObserver:self 

                     selector:@selector(moviePreloadDidFinish:) 

                     name:MPMoviePlayerContentPreloadDidFinishNotification 

                     object:nil];

我必须在 AppDelegate 或 VideoPlayerView 中声明这个 function。

我必须在哪里调用这个 function,这意味着 class

//  Notification called when the movie finished preloading.

 - (void) moviePreloadDidFinish:(NSNotification*)notification

 {



 }

请帮我.....................

The notification register function should go in the function where the MPMoviePlayer is allocated (probably in the VideoPlayerView) and initialized, in Apple's documentation they put the notification function before the MPMoviePlayer is allocated.

videoPlayerView controller 中的 moviePreloadDidFinish 和任何其他事件处理程序也应该是 go。

这可能会有所帮助,但可能有点过时: http://developer.apple.com/library/ios/#samplecode/MoviePlayer_iPhone/Listings/Classes_MyViewController_m.html#//apple_ref/doc/uid/DTS40007798-Classes_MyViewController_m-DontLinkElementID_14

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM