iOS5上的Vimeo使用MPMoviePlayerController不会加载视频

时间:2012-02-14 06:36:07

标签: iphone video ios5 html5-video vimeo

以下代码在Webview中加载Vimeo vide,但用户必须单击该播放 按钮开始

    VidViewController *webScrollView = 
    [[VidViewController alloc] initWithNibName:@"VidViewController" bundle:nil];

    NSURL *url = [NSURL URLWithString:@"http://player.vimeo.com/video/36120576"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    webScrollView.request = request;
    [self.navigationController pushViewController:webScrollView animated:YES];
    [webScrollView release];

我想让MPMoviePlayerController工作,但无法加载视频。

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSURL *audioURL = [NSURL URLWithString:@"http://player.vimeo.com/video/36120576"];
    MPMoviePlayerController *player = [[MPMoviePlayerController alloc]
    initWithContentURL:audioURL];

    [[NSNotificationCenter defaultCenter]
         addObserver:self
         selector:@selector(movieFinishedCallback:)                                                 
         name:MPMoviePlayerPlaybackDidFinishNotification
         object:player];


        [player play];    

}

- (void) movieFinishedCallback:(NSNotification*) aNotification {
    MPMoviePlayerController *player = [aNotification object];
    [[NSNotificationCenter defaultCenter]
    removeObserver:self
    name:MPMoviePlayerPlaybackDidFinishNotification
    object:player];    
    [player autorelease];    
}

对developer.apple

的支持不多

0 个答案:

没有答案