iOS5 上使用 MPMoviePlayerController 的 Vimeo 无法加载视频
以下代码在 Web 视图中加载 Vimeo 视频效果很好,但用户必须单击播放 按钮开始
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 上没有太多支持
The following code loads a Vimeo vide just fine in a webview, but the user has to click the play
button to start
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];
I would like to get MPMoviePlayerController to work, but can't get the video to load.
- (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];
}
There isn't much support on developer.apple
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论