开发者

How to play sequence video continuously on iPhone?

I'm trying to play two videos continuously using MPMoviePlayer. I let the second video play when the MPMoviePlayerPlaybackDidFinishNotification is posted.

[[NSNotificationCenter defaultCenter] addObserver:self 
                                             selector:@selector(playSecondMovie)
                           开发者_C百科                      name:MPMoviePlayerPlaybackDidFinishNotification 
                                               object:nil];

The problem is when the first video stops, the view will go back to the previously view for a short while before play the next video.

Is there any idea about how to play video continuously or is it possible to get the image of the last frame in the first video?


The only way to have a youtube video play inside your own app is to create a UIWebView with the embed tag from Youtube for the movie you want to play as the UIWebView's content. UIWebView will detect that the embedded object is a Youtube link, and the web view's content will be the youtube preview for the video. When your user clicks the preview, the video will be shown in an MPMoviePlayerController. This is the technique described at the link that Muxecoid provided (http://iphoneincubator.com/blog/audio-video/how-to-play-youtube-videos-within-an-application), and this is (as far as I know of) the only way to have a youtube video play within an application. You can still have the Youtube application launch by passing the youtube URL to -[UIApplication openURL:], but of course this closes your own application which is often undesirable.

Unfortunately, there's no way to directly play a youtube video with MPMoviePlayerController because youtube does not expose direct links to the video files.


I've made a walkaround to solve the problem. The major idea is to add a fullscreen black view over the previous view before the first movie plays. So when the first movie ends playing the full screen will be black (This looks more natural than the previous view).

Some more modifications:

1 Another problem is that when I hides the status bar, the area will be white. So I also set the window color to black color.

2 When all the video finishes playing, the previous view is shown and the view frame will not leave space for status bar. So I change the view's orgin y to 20 before the status bar appears.

Hope this helps those who meet the same problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜