playing video on iphone
<p>i have a weird problem in my application. I am trying to play video on iphone after pressing a button in the UI.My problem is that it is played as audio only . and media player doesn't show up , i just hear the sound. 
Below is the code of the methods i use to play video.</p>

<pre><code>-(void) playMovieAtURL: (NSURL*) theURL {

MPMoviePlayerController* theMovie =

[[MPMoviePlayerController alloc] initWithContentURL: theURL];
theMovie.scalingMode = MPMovieScalingModeAspectFill;

theMovie.movieControlMode = MPMovieControlModeDefault;

// Register for the playback finished notification

[[NSNotificationCenter defaultCenter]

 addObserver: self

 selector: @selector(myMovieFinishedCallback:)

 name: MPMoviePlayerPlaybackDidFinishNotification

 object: theMovie];

[theMovie play];
}   



-(void) myMovieFinishedCallback: (NSNotification*) aNotification

{

MPMoviePlayerController* theMovie = [aNotification object];

[[NSNotificationCenter defaultCenter]

 removeObserver: self

 name: MPMoviePlayerPlaybackDidFinishNotification

 object: theMovie];

[theMovie release];

}
</code></pre>

<p>and this is how i call the previous functions to play a video located in my resources</p>

<pre><code>-(IBAction)play:(id)sender
{
NSString * url;
NSURL *theUrl;

NSBundle *bundle = [NSBundle mainBundle];
if (bundle) 
{
    NSString *moviePath = [bundle pathForResource:@"240_320_p" ofType:@"mp4"];
    if (moviePath)
    {
        theUrl = [NSURL fileURLWithPath:moviePath];
    }
}

[self playMovieAtURL:theUrl];

}
</code></pre>
