开发者

Audio only with MPMoviePlayerController on iO4

开发者 https://www.devze.com 2023-01-07 22:25 出处:网络
When I play a video doing this: NSString *videoFilepath = [[NSBundle mainBundle] pathForResource:@\"bacon\" ofType:@\"mov\"];

When I play a video doing this:

    NSString *videoFilepath = [[NSBundle mainBundle] pathForResource:@"bacon" ofType:@"mov"];
    NSURL *videoURL = [NSURL fileURLWithPath:videoFilepath];
    MPMoviePlayerController *movie;
    movie = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
    [开发者_StackOverflow中文版movie play];

on 3.2, it works pefeectly. But if I switch the base SDK to 4.0 i only hear the sound of the movie.

Any ideas?


I believe that adding this with your play command should improve matters for you:

[movie play] [movie setFullscreen:YES]; [self.view addSubview:movie.view];

Try testing this property as it sounds like the movie is playing but has not been set to fullscreen:

http://developer.apple.com/iphone/library/documentation/mediaplayer/reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html#//apple_ref/occ/instp/MPMoviePlayerController/fullscreen

This line of code is also of importance: [self presentMoviePlayerViewControllerAnimated:movie];


try,

//add frame works

 //   AVFoundation.framework
 //   MediaPlayer.framework
    [movie setFullscreen:YES]; 
    [self.view addSubview:movie.view];
    moviePlayer.controlStyle =  MPMovieControlStyleDefault; 
    moviePlayer.shouldAutoplay=YES;
     moviePlayer.repeatMode = YES; 
0

精彩评论

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