iphone trying to play video from a file but only get a black screen
<p>I'm trying to download a mp4 file from a server, then save it in a file.  After it is saved in the file, I try to play it. When the program runs, it pauses when the file is being download, then the screen turns black when I create the MPMoviePlayerController object.
I did the following.
1. Traced through the code and view the NSDAta object to make sure the right anount of data was being load.
2. added a if ( [mFile fileExistsAtPath:filename]==true ) to make sure the file exist.
3. checked all the return values for a nil.
I'm left out of idears now!</p>

<p>// set up file name to save it under and play it
    NSFileManager *mFile= [NSFileManager defaultManager];
    NSString *filename=[ NSHomeDirectory() stringByAppendingPathComponent:@"ted10.dat"];</p>

<pre><code>// load video
NSURL *movieUrl=[[NSURL alloc] initWithString:@"http://www.besttechsolutions.biz/projects/golfflix/ted.mp4"];
NSData *data = [NSData dataWithContentsOfURL:movieUrl];
[data writeToURL:movieUrl atomically:YES];  
[mFile createFileAtPath:filename contents: data attributes:nil];

// makse sure file exist


if ( [mFile fileExistsAtPath:filename]==true )
{
// play it
NSURL *fileUrl=[ NSURL fileURLWithPath:filename];
mp=[[MPMoviePlayerController alloc] initWithContentURL: fileUrl];
[mp.view setFrame: self.view.bounds];
[self.view addSubview: mp.view];

if ([mp respondsToSelector:@selector(loadState)]) 

{
    // Set movie player layout
    [mp setControlStyle:MPMovieControlStyleFullscreen];
    [mp setFullscreen:YES];

    // May help to reduce latency
    [mp prepareToPlay];

    // Register that the load state changed (movie is ready)

}//localhost/Dino/golflix2/Classes/videolist.h  
else
{
}


[mp play];

}   
</code></pre>
