我必须在我的Iphone
应用程序中播放视频,但我找不到下面的链接是什么类型的以及如何播放它?这个视频。以多种方式进行了测试,但仍未找到最佳实践。
问问题
106 次
1 回答
0
试试看
.h 文件中声明的 MPMoviePlayerController
-(void)playVideo:(id)sender
{
NSURL *movieURL = [NSURL URLWithString:[[newsFeedsMA objectAtIndex:0] valueForKey:@"url"]];
_player = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[self.view addSubview:_player.view];
[_player prepareToPlay];
_player.controlStyle = MPMovieControlStyleDefault;
_player.shouldAutoplay = YES;
[_player setFullscreen:YES animated:YES];
}
//Notification method:
- (void) moviePlayBackDidFinish:(NSNotification*)notification
{
MPMoviePlayerController *player = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification object:player];
if ([player respondsToSelector:@selector(setFullscreen:animated:)])
{
[player.view removeFromSuperview];
}
}
于 2013-08-06T06:24:13.283 回答