iphone播放音频和打电话的例子
-(void) initAndPlay:(NSString *)videoURL{
if(!videoURL)return;
NSURL*URL=[NSURL URLWithString:[(NSString*) CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)videoURL, NULL, NULL, kCFStringEncodingUTF8) autorelease]];
if (URL) {
double ver=[[[UIDevice currentDevice] systemVersion] doubleValue];
if (ver >= 3.2)
{
[moviePlayViewController release];
moviePlayViewController=[[MPMoviePlayerViewController alloc] initWithContentURL:URL];
if (moviePlayViewController)
{
[self presentMoviePlayerViewControllerAnimated:moviePlayViewController];
moviePlayViewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[moviePlayViewController.moviePlayer play];
}
}
else if(ver < 3.2)
{
[moviePlayViewController release];
moviePlayViewController=[[MPMoviePlayerController alloc] initWithContentURL:URL];
if (moviePlayViewController)
{
[moviePlayViewController play];
}
}
}
if(!videoURL)return;
NSURL*URL=[NSURL URLWithString:[(NSString*) CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)videoURL, NULL, NULL, kCFStringEncodingUTF8) autorelease]];
if (URL) {
double ver=[[[UIDevice currentDevice] systemVersion] doubleValue];
if (ver >= 3.2)
{
[moviePlayViewController release];
moviePlayViewController=[[MPMoviePlayerViewController alloc] initWithContentURL:URL];
if (moviePlayViewController)
{
[self presentMoviePlayerViewControllerAnimated:moviePlayViewController];
moviePlayViewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[moviePlayViewController.moviePlayer play];
}
}
else if(ver < 3.2)
{
[moviePlayViewController release];
moviePlayViewController=[[MPMoviePlayerController alloc] initWithContentURL:URL];
if (moviePlayViewController)
{
[moviePlayViewController play];
}
}
}
}
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"telprompt://123456"]]];