views:

481

answers:

2

Hello Guys ,

I am playing an video from url using MPMoviePlayerViewController class and it is working fine in all version of 3.(3.0,3.1,3.1.2,3.1.3)but in iOS4 video is not playing ? Have any one track this issue ?

thanks

A: 

After struggling 3 to 4 hrs. i Found out the solution of the issue. Here is the solution:

MPMoviePlayerViewController *mpViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:videoUrl];

[self presentMoviePlayerViewControllerAnimated:mpViewController];

[mpViewController.view setCenter:yourView.center];
[mpViewController release];

Cheers !!!!

sandy
A: 

Hi Both,

This is exactly what I've been looking for but need a tiny bit more guidance if possible!?

My code is:

NSString *st1 = [[NSBundle mainBundle] pathForResource:@"ScreenRecording" ofType:@"mov"];

NSURL *u = [[NSURL alloc] initFileURLWithPath:st1];

MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:u];

[self presentMoviePlayerViewControllerAnimated:mp];

However the video doesn't play, it simply closes the app on button tap (where this code exists)! - It'll be obvious I'm sure but what am I doing wrong!

Thanks so much in advance.

Chris.

Chris M
any crash log ? or any where are you making MPMoviewPlayerController instance and calling play than in 4.0 , it will definitely crash? check up your code ?
sandy
Hi, yeah the debugger is reporting: [Session started at 2010-07-05 08:19:58 +0100.]Terminating in response to SpringBoard's termination.Not making any MPMoviePLayerController obj's, only MPMoviePlayerViewController. Isn't there a child obj MPMoviePlayerController under MPMoviePlayerViewController.moviePlayer?Thanks again for any help!Chris.
Chris M