开发者

MPMoviePlayerController problem when play a movie

开发者 https://www.devze.com 2022-12-16 10:06 出处:网络
i put a movie when my application will lunch . just like gameloft games . so when application has lunched , movie plays fine but before the move plays .. my FirstViewController xib file show first t

i put a movie when my application will lunch . just like gameloft games . so when application has lunched , movie plays fine but before the move plays .. my FirstViewController xib file show first then moview start to play ! why ? here is my code :

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
NSBundle *bundle = [NSBundle mainBundle];
    NSString *moviePath = [bundle pathForResource:@"movie" ofType:@"m4v"];

    NSURL *movieURL = [[NSURL fileU开发者_Python百科RLWithPath:moviePath] retain];

    MPMoviePlayerController *IntroMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

    IntroMovie.movieControlMode = MPMovieControlModeHidden;
    [IntroMovie play];
}


Your question is a little unclear, but what I think you are asking is why your movie is not playing when the application launches before the user sees the controls and items in your XIB file. If this is correct, then this is the normal behavior as typically the application will launch and only then call the function you have (applicationDidFinishLaunching). There is no guarantee that you will get that function called before the controls have loaded and are viewable on the screen all the time.

It is bad form to start you application with a movie, but if you want to then you have to deal with the fact that there will potentially be a default image or even your controls that you put in your XIB file.

One way to start with a movie, is that you must hide or delete everything in the XIB file so the screen will appear blank when the application loads. Then, when you application calls the applicationDidFinishLaunching function the user will not have seen your application and the first thing they will see is the movie. When the movie is finished playing, you will need to have a notification listener instruct your application to show the controls for your application or switch to another XIB file that has the app controls within it.

I hope this helps.

0

精彩评论

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

关注公众号