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];
            }
        }
    }

}

 

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"telprompt://123456"]]];

 

posted @ 2011-01-19 09:43  tony508  阅读(394)  评论(0编辑  收藏  举报