1

我从预告片的 imdb 中获取视频网址,例如:

http://video-http.media-imdb.com/MV5BMjM2OTAxNDA2Nl5BMTFeQW1wNF5BbWU3MDYwMDA4OTY@.mp4?Expires=1347051666&Signature=4OPreoHNu1wcEMX2UIkKYvnu1y7r9NG6qoLf5w1egm7D-5UVSZI6KAZkxX5BA9h7Zj88LZEEWowBbgdh2CC8Zdr2syj1IL4Ncew~rqgLvuBRkwbHyIJzag2CBXEblmAHkMR3NRoOxy93iUXMvZrNj2pnxuYjF9Bf9AODrBxmUdc_&Key-Pair-Id=APKAILW5I44IHKUN2DYA

通过添加其余代码:

moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL]; 
    [moviePlayerController.view setFrame:CGRectMake(0, 70, 320, 270)]; 
    [self.view addSubview:moviePlayerController.view];

我只收到此错误(在模拟器中,未在设备上尝试):

Error getting audio input device sample rate

问候米尔扎

4

1 回答 1

1

试试下面的代码

NSString *url = [NSString stringWithFormat:@"Url"];

    mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]];

    [[mp moviePlayer] prepareToPlay];
    [[mp moviePlayer] setUseApplicationAudioSession:NO];
    [[mp moviePlayer] setShouldAutoplay:YES];
    [[mp moviePlayer] setControlStyle:2];
    [[mp moviePlayer] setRepeatMode:MPMovieRepeatModeOne];
    [self presentMoviePlayerViewControllerAnimated:mp];
于 2012-09-08T06:49:35.190 回答