Audio only with MPMoviePlayerController on iO4

When I play a video by doing this:

    NSString *videoFilepath = [[NSBundle mainBundle] pathForResource:@"bacon" ofType:@"mov"];
    NSURL *videoURL = [NSURL fileURLWithPath:videoFilepath];
    MPMoviePlayerController *movie;
    movie = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
    [movie play];

at 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?

+3
source share
2 answers

I believe that adding this to your game will lead to an improvement for you:

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

Try checking this property, as it sounds as if the movie is playing, but has not been set to full screen:

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

: [self presentMoviePlayerViewControllerAnimated: movie];

+1

,

//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

Source: https://habr.com/ru/post/1755579/


All Articles